May I know others experience of using (gdb and gdbserver) for debugging mediaserver (Native Binary)
After reading several blogs and mannual I am in confused state.
Still I am struggling to get symbol info needed by GDB ...
Please find the console logs ...
rajeshkumar@tpvgtvvm1:/media/rajeshkumar/droid_2k14/ref/ws_home/dev1$ python $AUTIL/agdb.py mediaserver
found debugger: /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/android-x86/prebuilts/gcc/linux-x86/x86/i686-linux-android-4.7/bin/i686-linux-android-gdb
found symbol: /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/android-x86/out/target/product/x86/symbols/system/bin/mediaserver
found mediaserver, pid is: 1978
attach gdbserver to 1978, listen on port 7890
rajeshkumar@tpvgtvvm1:/media/rajeshkumar/droid_2k14/ref/ws_home/dev1$ i686-linux-android-gdb -q -x ./temp_dbg/gdbclient.cmds /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/android-x86/out/target/product/x86/symbols/system/bin/mediaserver
Reading symbols from /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/android-x86/out/target/product/x86/symbols/system/bin/mediaserver...done.
0x400f95a6 in ?? ()
(gdb) info threads
Id Target Id Frame
* 1 Thread 1978 0x400f95a6 in ?? ()
(gdb) bt
#0 0x400f95a6 in ?? ()
warning: (Internal error: pc 0x8 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x7 in read in psymtab, but not in symtab.)
warning: (Internal error: pc 0x7 in read in psymtab, but not in symtab.)
#1 0x00000008 in ?? ()
warning: (Internal error: pc 0x7 in read in psymtab, but not in symtab.)
#2 0x41717bf0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
(gdb) info sharedlibrary
From To Syms Read Shared Object Library
0x400079a0 0x40020059 Yes /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/android-x86/out/target/product/x86/symbols/system/bin/linker
(gdb)
Content of "./temp_dbg/gdbclient.cmds"
set solib-absolute-prefix /non_exist_dir
set sysroot /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/temp_dbg/symbols/system
set solib-search-path /media/rajeshkumar/droid_2k14/ref/ws_home/dev1/temp_dbg/symbols/system/lib:/media/rajeshkumar/droid_2k14/ref/ws_home/dev1/temp_dbg/symbols/system/bin
target remote 192.168.56.102:7890
Below are some of the possibilities I explored, But no luck ...
1, Added LOCAL_CFLAGS:= -g -O0 ( other possible values I tried -ggdb | -ggdb3 ) at Android.mk Module level file.
2, Modified the default compiler flags at global level ( build/core/combo/select.mk | build/core/combo/TARGET_linux-x86.mk) to "-g -O0", Observed build failure at components like Audioflinger, system/core/lib. I revert back to -O2.
System info ...
1, Installed the iso image on VirtualBox.
2, used lunch option "5. android_x86-eng" to build the image.
3, git branch info (x86/kitkat-x86) "Android-x86 4.4-RC2 (KitKat-x86)"
Please let me know other possibilities ...
When you build your project can you please include APP_OPTIM:=debug flag to generate symbol information.
Your command would look like
../<project-folder>: ndk-build APP_OPTIM:=debug NDK_DEBUG:=true
As a quick hack and un-block myself, I replaced prebuild gdbserver ( GNU gdbserver 6.6 ) with chromium android_tools prebuild gedserver ( GNU gdbserver (GDB) 7.6 ) downloaded from https://chromium.googlesource.com/android_tools
with i686-linux-android-gdb (GNU gdb (GDB) 7.6) + gdbserver ( GNU gdbserver (GDB) 7.6 ) I am able to progress in my debugging with muti-threaded mediaserver application.
User contributions licensed under CC BY-SA 3.0