This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Remote debugging: setting breakpoints in shared libraries
- From: Klaus Zeitler <Klaus dot Zeitler at alcatel-lucent dot com>
- To: gdb at sourceware dot org
- Date: Tue, 31 Jan 2012 17:16:30 +0100
- Subject: Remote debugging: setting breakpoints in shared libraries
- Reply-to: Klaus dot Zeitler at alcatel-lucent dot com
Hello,
I'm trying to figure out how to debug shared libraries remotely with
gdbserver. My first try was on the same host:
[]$ gdbserver localhost:7777 test
and then in gdb:
(gdb) target remote localhost:7777
(gdb) b function_in_shared_lib
Function "function_in_shared_lib" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
(gdb) c
this works beautifully, i.e. the test program stops at the breakpoint.
Now when I try running the same sequence with gdbserver on a remote host
(and localhost replaced accordingly), gdb doesn't stop at the
breakpoint. My test program doesn't stop.
I found some cumbersome workaround. Put a breakpoint in test program
right after the shared library (dlopen) is loaded, then I manually do:
(gdb) add-symbol-file shared-lib.so <address>
Am I missing something or is this behavior to be expected?
I'm using:
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5_7.1)
Thanks
Klaus
--
-------------------------------------------------------------------
| Klaus Zeitler Alcatel-Lucent |
| Lorenzstrasse 10 70435 Stuttgart, Germany |
| Department: Building: 005 Office: 3/171 |
| Telefon: +49 711821 43898 |
| Email: klaus.zeitler@alcatel-lucent.com |
| |
| Alcatel-Lucent Deutschland AG |
| Sitz der Gesellschaft: Stuttgart  Amtsgericht Stuttgart HRB 4026 |
| Vorsitzender des Aufsichtsrates: Michael Oppenhoff |
| Vorstand: |
| Alf Henryk Wulf (Vorsitzender) Â Dr. Rainer Fechner |
-------------------------------------------------------------------
---
Those who can, do. Those who can't, simulate.