Google provides eclipse and plug-ins for Android Application development as development tools. Based on Eclipse, you can easily debug the APK.
(For example, opencore Development) does not provide similar intuitive development tools and debugging methods. This article describes a debugging method based on DDD + gdbserver.
Opencore C-level program debugging. The procedure is as follows: open a shell
ADB Shell
PS view mediaserver process number
Gdbserver: 5039
-- Attach PID (why is it mediaserver, because opencore/stagefright is referenced by the mediaserver process) // 5039 is the port number and another shell is opened.
ADB forward TCP: 5039 TCP: 5039
CD/working/myandroid
Ddd
-Debugger arm-Eabi-GDB
Out/target/product/generic/symbols/system/bin/mediaserver and then enter the DDD Program
In
In the console window, execute the following two commands. In fact, the so library will be loaded from the specified directory below.
Set solib-absolute-Prefix
/Working/myandroid/out/target/product/generic/Symbols
Set
Solib-search-Path
/Working/myandroid/out/target/product/generic/symbols/system/lib
Run the command T arget remote: 5039 on the server.
After executing this command, wait a bit. At this time, GDB will load the required so library.
You can
Breakpoint in the DDD source code browser window, or breakpoint in the console window through commands,
For example, B createplayer,
Then execute the command C to complete the DDD operation. Next, go to the simulator and click play video to go To the breakpoint. If you want to debug on the command line, run
Arm-Eabi-GDB
For debugging in out/target/product/generic/symbols/system/bin/mediaserver DDD, refer to related documents for usage of DDD.