Let's look at a schematic diagram:
I am the Linux and Android Dual 0 Foundation, the current understanding of GDB is very simple. (Note: Commands executed on Android need to be executed under the ADB shell.) )
① Open the command terminal (Ctrl + Alt + T) and enter the ADB shell. Create a new directory in the Android data directory, such as DOG_LD.
② copies the Gdbserver and the program to be debugged from Linux to the Android/data/dog_ld directory.
③ into the Android/data/dog_ld directory and see if the required files are copied successfully.
④ Modify the file permissions.
⑤ starts the program for debugging by Gdbserver in the Android/data/dog_ld directory.
The process ID is the port used by 732,gdbserver is 1234.
⑥ with Ctrl + ALT + T, and then open a Linux command-line window. The 1234 port of Linux is mapped to the 1234 port of Android via ADB ForWord.
⑦ into the Linux source directory under Dog_ld, start the NDK arm-linux-androideabi-gdbtui for remote debugging.
After the ⑧ is started, you can enter a command to debug. The input s represents stepping.
GDB Remote debugging Android native program