It does following things for us automatically:
- find the binary that contains symbol data of target process
- attach gdbserver to the target process on device, or start the target process under gdbserver if the process isn't already running
- start gdb client and set correct symbol file search path
prerequirements
agdb must know the root directory of android source code. We can tell it by passing --android-src-root argument or setting ANDROID_SRC_ROOT environment variable.
agdb interacts with target device through adb, so the device must be accessible through adb.
gdb client communicates gdbserver through tcp protocol (tcp port 7890 by default). If using emulator, we need to forward or redir tcp ports in advance.
usage
After all prequirements are met, we can run "agdb.py process_name" to debug desired application. For example, if we want to debug mediaserver application, simply run agdb.py mediaserver.
If we want to debug code in native part of a dalvik (java) application, we can use:
agdb.py --dalvik [package_name (for example, com.android.launcher)]
Limitation
It doesn't work on Windows.
It starts gdbserver in network communication mode, serial port isn't supported.
Reference
http://source.android.com/porting/debugging_gdb.html
No comments:
Post a Comment