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:
- Copied
gdbserver
fromNDK
to the target device - Sent the
exe
that I want to debug - runned gdb server on target using
./gdbserver :5039 exec
- this basically executes the process, and gets a
pid
- this basically executes the process, and gets a
Host:
- enabled the port
adb forward tcp:5039 tcp:5039
- runned:
arm-eabi-gcc exec
. - Then in gdb:
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.