adb 调试

来源:互联网 发布:国外云计算公司 编辑:程序博客网 时间:2024/04/30 03:05

refs:

http://blog.csdn.net/xiaojsj111/article/details/18599653


export ADB_TRACE=1



environmental variables:
  ADB_TRACE                    - Print debug information. A comma separated list of the following values
                                 1 or all, adb, sockets, packets, rwx, usb, sync, sysdeps, transport, jdwp
  ANDROID_SERIAL               - The serial number to connect to. -s takes priority over this if given.
  ANDROID_LOG_TAGS             - When used with the logcat option, only these debug tags are printed.

adb 出问题时的调试方法:
方法一:通过bus hound工具来抓pc跟device之间的usb 包的通讯。前提是需要对usb adb的命令包格式很熟悉。
方法二: 由属性变量:persist.adb.trace_mask来控制adb的log输出级别。其输出的log信息将被重定向到/data/adb/目录下的文件中。
具体源代码,请查看:/system/core/adb/adb.c(start_device_log函数), system/core/adb/adb.h(adb_trace_mask,AdbTrace)
方法三:由于方法二有一定的局限性,他是将printf的输出重定向到/data/adb/xxxx.txt文件中,这样很多的后台服务的打印信息是打印不出来的。
因为他的输入,输出被重定向到pty/pts或是pipe或是socket pair上了。所以我们的方法就是修改/system/core/adb/adb.h文件中的#  define  D(...) 宏,使其的打印输出到logcat中。方法如下:

0 0
原创粉丝点击