BRN:Software:Build and Distribution:Userland Debugging: Difference between revisions
No edit summary |
(→FAQ) |
||
Line 30: | Line 30: | ||
= FAQ = |
= FAQ = |
||
* Q: I run 'set solib-absolute-prefix /openwrtroot/' and get |
|||
* Error Message "..." during ... |
|||
<pre> |
|||
* A: ... |
|||
Reading symbols from /openwrtroot/lib/libgcc_s.so.1...warning: no loadable sections found in added symbol-file /openwrtroot/lib/libgcc_s.so.1 |
|||
done. |
|||
Loaded symbols for /openwrtroot/lib/libgcc_s.so.1 |
|||
Reading symbols from /openwrtroot/lib/libc.so.0...warning: no loadable sections found in added symbol-file /openwrtroot/lib/libc.so.0 |
|||
done. |
|||
Loaded symbols for /openwrtroot/lib/libc.so.0 |
|||
Reading symbols from /openwrtroot/lib/ld-uClibc.so.0...warning: no loadable sections found in added symbol-file /openwrtroot/lib/ld-uClibc.so.0 |
|||
done. |
|||
Loaded symbols for /openwrtroot/lib/ld-uClibc.so.0 |
|||
</pre> |
|||
for some libraries. Further I get |
|||
<pre> |
|||
Remote debugging using wgt71:2000 |
|||
0x2acece24 in ?? () |
|||
warning: Unable to find dynamic linker breakpoint function. |
|||
GDB will be unable to debug shared library initializers |
|||
and track explicitly loaded dynamic code. |
|||
</pre> |
|||
when starting remote debugging via 'target remote wgt71:2000'. |
|||
A: You need to build the libraries without running sstrip, which removes all symbols from the binary to reduce size. See [http://forum.openwrt.org/viewtopic.php?pid=19195] |
Revision as of 07:55, 1 February 2007
Debug Setup
The remove debugging setup consists of a debugger stub (named gdbserver), which runs on the target machine (mipsel in our case) and is attached to the debuggee process. The debugger resists on a (remove) host machine and is connectet to the stub via a TCP/IP or serial connection. At first we have to build both a debugger stub and a cross-debugger (note that the host debugger which is shipped with the linux distribution could not be used for cross debugging).
- Build the gdbserver. It must be configured for host and target mipsel.
- Build the cross-gdb. Configure it for target mipsel and host i386.
Precompiled binaries could be found in the NFS rootfs and in /usr/local/bin/mipsel-linux-uclibc-gdb on nfs-student.
Debugging Userland Applications
- At first, start the gdbserver on the mips. You can either specify an executable which is load or attach it to a running process. To debug a process with PID 333 for example, simply type
wgt30$ gdbserver :2000 --attach 333
The debugger stub is now attached to the process with given PID and reachable on TCP port 2000.
- Start the cross-debugger on the host system and connect it to the stub, e.g.
(gdb) target remote wgt30:2000
It may be the case that the gdb does not find the images of the linked-in shared libraries, since host and target system may differ. As a result, the debugger is not able to exermine the stack correctly and no (of no usefull) backtrace could be generated. You can solve this problem by specifying a shared object lookup prefix using the following command:
(gdb) set solib-absolute-prefix /openwrtroot/gdb/lib
This must be done every time you attach to a process.
Now you should be able to use the remote debugger in the same was as a local debugger.
FAQ
- Q: I run 'set solib-absolute-prefix /openwrtroot/' and get
Reading symbols from /openwrtroot/lib/libgcc_s.so.1...warning: no loadable sections found in added symbol-file /openwrtroot/lib/libgcc_s.so.1 done. Loaded symbols for /openwrtroot/lib/libgcc_s.so.1 Reading symbols from /openwrtroot/lib/libc.so.0...warning: no loadable sections found in added symbol-file /openwrtroot/lib/libc.so.0 done. Loaded symbols for /openwrtroot/lib/libc.so.0 Reading symbols from /openwrtroot/lib/ld-uClibc.so.0...warning: no loadable sections found in added symbol-file /openwrtroot/lib/ld-uClibc.so.0 done. Loaded symbols for /openwrtroot/lib/ld-uClibc.so.0
for some libraries. Further I get
Remote debugging using wgt71:2000 0x2acece24 in ?? () warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code.
when starting remote debugging via 'target remote wgt71:2000'.
A: You need to build the libraries without running sstrip, which removes all symbols from the binary to reduce size. See [1]