public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Remote debugging: setting breakpoints in shared libraries
@ 2012-01-31 16:17 Klaus Zeitler
  2012-02-08 19:42 ` Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Klaus Zeitler @ 2012-01-31 16:17 UTC (permalink / raw)
  To: gdb

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-02-16 13:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-31 16:17 Remote debugging: setting breakpoints in shared libraries Klaus Zeitler
2012-02-08 19:42 ` Jan Kratochvil
2012-02-16 12:08   ` Klaus Zeitler
2012-02-16 13:35     ` Jan Kratochvil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).