Reprint: http://blog.chinaunix.net/uid-10995602-id-2918710.html
Google provides an Eclipse plug-in for Android app development as a development tool, and it's easy to debug the APK based on eclipse, while the underlying developers (such as opencore development) do not offer similar intuitive development tools and debugging tools. The purpose of this paper is to introduce a debugging method based on Ddd+gdbserver, which is used for program debugging of C-level similar to Opencore. The steps are as follows:Open a shell .
adb Shell
PS View MediaServer process number
gdbserver:5039--attach pid(why MediaServer, because opencore/stagefright are referenced by the mediaserver process) Open a shell again .
adb forward tcp:5039 tcp:5039
cd/working/myandroid
Ddd–debugger arm-eabi-gdb out/target/product/generic/symbols/system/bin/mediaserver
And then go into the DDD program .
The following two commands are executed in its console window, which in fact loads the so library from the directory specified below
Set Solib-absolute-prefix/working/myandroid/out/target/product/generic/symbols
the set Solib-search-path/working/myandroid/out/target/product/generic/symbols/system/lib next connects to the server side, Execute command target remote:5039
Wait a moment after executing the command, and GDB will load the required so library
At this point, you can break the point in the DDD Source browser window, or place a breakpoint in the console window via a command.
For example: B createplayer,
then execute command C This completes the ddd aspect, then enters the simulator, clicks the play video, then enters the breakpoint If you want to debug under a pure command line, perform
arm-eabi-gdb Out/target/product/generic/symbols/system/bin/mediaserverend.
DDD Debug Opencore/stagefright