Android使用gdb調試native程序

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 

調試進程。


注意:

C++在類的方法裏面設置斷點的方式是b namespace::class::method,可使用nm命令查看方法。


Reference:

http://mogoweb.net/archives/309

https://github.com/keesj/gomo/wiki/AndroidGdbDebugging

http://blog.chinaunix.net/uid-12567959-id-3214283.html

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章