Recipe Setting up GDB Debugging

The GNU project DeBugger (GDB) is a common way to debug programs on Linux. In Android, a gdb tool is available to debug native libraries. In NDK r4, every native library is generated; it also generates a gdbserver and gdb.setup.The following commands can be used to install gdb:

> adb shell

> mkdir myfolder

> adb push gdbserver /data/myfolder

To run gdb, the following command can be used:

> adb shell /data/myfolder/gdbserver host:port <native program>

For example, with a program named myprogram running on Android device with IP address and port number 1234, the following command starts the server:

> adb shell /data/myfolder/gdbserver myprogram

Then, open another terminal and run gdb on the program:

(gdb) set solib-search-path ../system/lib (gdb) target remote localhost:1234

At the gdb prompt, the first command sets the root directory of the target image, the second command sets the search path of shared libraries, and the last command sets the target.After the target remote localhost:1234 is running, debugging in the gdb environment can begin.

Character Building Thought Power

Character Building Thought Power

Character-Building Thought Power by Ralph Waldo Trine. Ralph draws a distinct line between bad and good habits. In this book, every effort is made by the writer to explain what comprises good habits and why every one needs it early in life. It draws the conclusion that habits nurtured in early life concretize into impulses in future for the good or bad of the subject.

Get My Free Ebook

Post a comment