I have built a binary excutable from pure C++ code and it prompts time error when running on android device.
How can I debug the pure native code for android? It seems that the existing methods are not for pure native code.
I have built a binary excutable from pure C++ code and it prompts time error when running on android device.
How can I debug the pure native code for android? It seems that the existing methods are not for pure native code.
Step 1: Put the gdbserver and your unstripped native binary executable (suppose it is named testexec) on the android emulator. E.g. you can put it under folder /data/data/test. And use chmod command to add permissions to them.
Step2: Start gdb debugger. And this step consists of following sub-steps:
Step 2.1: Start gdb debugger of the emulator by typing command on your host machine terminal:
adb shell /data/data/test/gdbserver 10.0.2.2:1234 /data/data/test/testexec
The emulator will then listen on port 1234.
Step 2.2: Connect the gdb debugger of the local machine with the gdbserver of the emulator:
telnet localhost 5554
It will prompt:
Android Console: type 'help' for a list of commands
OK
Then input:
redir add tcp:1234:1234
to enable data redirection and then type
exit
Step2.3: Start the gdb debugger of the local machine. Input:
arm-linux-androideabi-gdb.exe YOUR_ EXECUTABLE_PATH_ON_LOCAL_MACHINE\testexec
After that, input
target remote localhost:1234
to connect to the gdbserver.
Finally, enjoy your debugging!
adb shell ip -f inet addr show
but cannot connect –
Appellee Android supports the use of GDB. However, I should note that if by "pure C++" you mean that there is no Java at all in the application, this is technically not allowed (although you can definitely do it). See the NDK page.
© 2022 - 2024 — McMap. All rights reserved.