Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Klaus Zeitler <Klaus.Zeitler@alcatel-lucent.com>
To: gdb@sourceware.org
Subject: Remote debugging: setting breakpoints in shared libraries
Date: Tue, 31 Jan 2012 16:17:00 -0000	[thread overview]
Message-ID: <q5g4nvb6e5d.fsf@destgd0d00539.de.alcatel-lucent.com> (raw)

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.


             reply	other threads:[~2012-01-31 16:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-31 16:17 Klaus Zeitler [this message]
2012-02-08 19:42 ` Jan Kratochvil
2012-02-16 12:08   ` Klaus Zeitler
2012-02-16 13:35     ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=q5g4nvb6e5d.fsf@destgd0d00539.de.alcatel-lucent.com \
    --to=klaus.zeitler@alcatel-lucent.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox