I am trying to remotely debug a pure C
program on an Android device.
The Android device (target) is connected via USB to a host machine.
What I did was:
Copied from the target the following files:
/system/lib
, /vendor/lib
, /system/bin/app_process
, and /system/bin/linker
.
Target:
gdbserver
from NDK
to the target deviceexe
that I want to debug./gdbserver :5039 exec
pid
Host:
adb forward tcp:5039 tcp:5039
arm-eabi-gcc exec
.set solib-search-path ...
, with the libraries that I pulled earlier from the targettarget remote :5039
The arm-eabi-gcc
can connect to the remote process, and even continue(c
) the execution. However, I cannot set breakpoints. If I do, I get the following error:
Cannot access memory at address xxx
.
Am I missing something here?
Thank you.
So, at host, in gdb shell, before specifying the remote's target port, I should type shared
. This command loads the shared symbols.
Also, for compiling, I used -ggdb
.