读书人

用 jdb 跟踪 Android

发布时间: 2013-04-09 16:45:09 作者: rapoo

用 jdb 追踪 Android

You may have debug Android in eclipse, Have you ever used jdb tracing Android. Since Dalvikvm support jdwp, we can use jdb to debug the program. there are 2 ways

Android as debug hostSteps
1) update libandroid_runtime
change below

frameworks/base/core/jni/AndroidRuntime.cpp    620     opt.optionString =    621         "-agentlib:jdwp=transport=dt_android_adb,suspend=n,server=y";asopt.optionString = "-agentlib:jdwp=transport=dt_socket,address=localhost:8011,server=n,suspend=y";


if you won't run jdb on the same host, change "localhost" to other host/ip
2) change system/root/default.prop on your running envchange "ro.debuggable=0" to "ro.debuggable=1"
3) use jdb to listen the portjdb -listen 8011
4) Start Android or APPs
when your Dalvik VM start, it will connect 8011

The good advantages of "Jdb as Host" is that when you need to debug, you let jdb listen; if you won't listen, Android will run as normal.

For example, when I want to debug the App, I run "jdb -listen 8011", then I click the App icon on the Launcher and start to debug.

Attention:

The Apps have launch timeout limits or It will be terminated by AM, when you enter jdb console, you need to quickly set breakpoint, and enter "cont" to run


读书人网 >其他数据库

热点推荐