1、push gdbserver到手机,并修改为可执行权限。
adb shell push gdbserver /system/bin/
adb shell chmod 777 /system/bin/gdbserver
2、得到进程号并attact上进程。
adb shell ps |grep system_server
adb shell gdbserver :1234 --attach 658
3、启动并设置gdb
shell adb forward tcp:1234 tcp:1234
target remote localhost:1234
file out/target/product/msm8960/symbols/system/bin/app_process
set solib-absolute-prefix android/out/target/product/generic/symbols/
set solib-search-path android/out/target/product/generic/symbols/system/lib
adb shell push gdbserver /system/bin/
adb shell chmod 777 /system/bin/gdbserver
2、得到进程号并attact上进程。
adb shell ps |grep system_server
adb shell gdbserver :1234 --attach 658
3、启动并设置gdb
shell adb forward tcp:1234 tcp:1234
target remote localhost:1234
file out/target/product/msm8960/symbols/system/bin/app_process
set solib-absolute-prefix android/out/target/product/generic/symbols/
set solib-search-path android/out/target/product/generic/symbols/system/lib
调试进程。
注意:
C++在类的方法里面设置断点的方式是b namespace::class::method,可使用nm命令查看方法。
Reference:
http://mogoweb.net/archives/309
本文详细介绍如何使用gdb在Android平台上进行应用程序调试。包括推送gdbserver到设备、获取进程ID并连接、配置gdb等步骤。同时介绍了C++类方法中设置断点的方法。
1152

被折叠的 条评论
为什么被折叠?



