OpenWrt Forum Archive

Topic: Debugging with gdb

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm trying to debug a segfault in kismet_server (the newest svn with madwifi_ng support). Where should I point the shared libs to?

[whm@megatron openwrt]$ ./toolchain_build_mipsel/gdbclient-6.3/gdb/gdb /storage/openwrt/kismet-devel/kismet_server
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=x86_64-pc-linux-gnu --target=mipsel-linux-uclibc"...
(gdb)  set  solib-absolute-prefix /storage/openwrt/trunk/openwrt/build_mipsel/root
(gdb) target remote 192.168.2.230:9999
Remote debugging using 192.168.2.230:9999
0x2aaa8a90 in ?? ()
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
(gdb) c
Continuing.
warning: no loadable sections found in added symbol-file /storage/openwrt/trunk/openwrt/build_mipsel/root/usr/lib/libuClibc++.so.0
warning: no loadable sections found in added symbol-file /storage/openwrt/trunk/openwrt/build_mipsel/root/lib/libm.so.0
warning: no loadable sections found in added symbol-file /storage/openwrt/trunk/openwrt/build_mipsel/root/lib/libc.so.0
warning: no loadable sections found in added symbol-file /storage/openwrt/trunk/openwrt/build_mipsel/root/lib/ld-uClibc.so.0

Is this caused by stripped shared libraries? Or is this a cross platform problem?

Can anyone point me how to build non stripped versions of the libs with debugging symbols included? Size doesn't matter so much for me, because I can put / on USB.

If you are using the buildsystem for Openwrt, I think there is a sstrip in there that removes all symbols from the binary to reduce size.  So not calling sstrip should do the trick I guess.

By the way how did you prepare the app for remote debugging using gdb?  I tried a few things, but never got it working (didn't try too hard).

E.

esteevens wrote:

If you are using the buildsystem for Openwrt, I think there is a sstrip in there that removes all symbols from the binary to reduce size.  So not calling sstrip should do the trick I guess.

By the way how did you prepare the app for remote debugging using gdb?  I tried a few things, but never got it working (didn't try too hard).

E.

I just installed gdbserver. I copied a non sstripd binary over to the wgt (3M binary.. hooray for USB storage), then ran gdbserver [remotehost:port] [binary] [arguments] .

On the remote host.. find the gdbclient directory in the build tree. there's a gdb binary in there. run "[/full/path/to/mips/]gdb [/full/path/to/compiled/binary]".
Do a "set  solib-absolute-prefix [svnroot]/trunk/openwrt/build_mipsel/root"
Then do a "target remote [remotehost:port]" and gdb should connect.

There's no symbols in the libs, so hope your non stripped application binary has enough for you to use.

(Last edited by whm3 on 17 Jan 2006, 21:02)

The discussion might have continued from here.