android gdb debug
$ . build/envsetup.sh $ lunch 12 $ adb shell ps | grep system_server system 404 129 580772 62000 ffffffff 00000000 S system_server $ gdbclient app_process :5039 404 (app_processのPID)
$cd ~/JB422R1/ <= 例 初期設定ファイル $cp ./out/target/product/maguro/gdbclient.cmds ./.gdbinit .gdbclient.initの例 echo mygdbclient set solib-absolute-prefix /home/m_fujii/JB422R1/out/target/product/maguro/symbols set solib-search-path /home/m_fujii/JB422R1/out/target/product/maguro/symbols/system/lib:/home/m_fujii/JB422R1/out/target/product/maguro/symbols/system/lib/hw:/home/m_fujii/JB422R1/out/target/product/maguro/symbols/system/lib/ssl/engines:/home/m_fujii/JB422R1/out/target/product/maguro/symbols/system/lib/drm:/home/m_fujii/JB422R1/out/target/product/maguro/symbols/system/lib/egl:/home/m_fujii/JB422R1/out/target/product/maguro/symbols/system/lib/soundfx ###target remote :5039
その他 (gdb) show solib-search-path (gdb) show solib-absolute-prefix (gdb) set verbose on (gdb) set debug remote 1
エラーの場合 app_processのPIDを探す。 $ adb shell ps | grep system_server system 389 129 578252 69316 ffffffff 00000000 S system_server gdbclientで接続してみる。 $ gdbclient app_process :5039 389 Cannot attach to lwp 389: Operation not permitted (1) Remote communication error. Target disconnected.: 接続が相手からリセットされました. (gdb) エラーで接続されない。 adbコマンドで実行してみる。 $ adb shell gdbserver :5039 --attach 389 Cannot attach to lwp 389: Operation not permitted (1) $adb root $ adb shell gdbserver :5039 --attach 389 つながるようになった。
android gdb debug - のねの日記
コマンドラインのgdbclientの方法を応用し、eclipseでデバッグ - のねの日記
linuxでのgdbclientの使い方 - のねの日記