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

* Re: Remote debugging: setting breakpoints in shared libraries
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Jan Kratochvil @ 2012-02-08 19:42 UTC (permalink / raw)
  To: Klaus Zeitler; +Cc: gdb

On Tue, 31 Jan 2012 17:16:30 +0100, Klaus Zeitler wrote:
> 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.

It may be affected for example by not yet fixed in that version:
	[patch] [i386] Fix {,un}prelinked libraries for attach/core-load
	http://sourceware.org/ml/gdb-patches/2011-02/msg00630.html
	http://sourceware.org/ml/gdb-patches/2011-04/msg00272.html

While there exist other methods for simplicity of the troubleshooting I would
connect the remote system via NFS and use `set sysroot' to that mounted
directory.

This will ensure the local symbol files match the remote files.


Regards,
Jan

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

* Re: Remote debugging: setting breakpoints in shared libraries
  2012-02-08 19:42 ` Jan Kratochvil
@ 2012-02-16 12:08   ` Klaus Zeitler
  2012-02-16 13:35     ` Jan Kratochvil
  0 siblings, 1 reply; 4+ messages in thread
From: Klaus Zeitler @ 2012-02-16 12:08 UTC (permalink / raw)
  To: Jan Kratochvil; +Cc: gdb

Hello,

>>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
    Jan>
    Jan> On Tue, 31 Jan 2012 17:16:30 +0100, Klaus Zeitler wrote:
    >> 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.
    Jan>
    Jan> It may be affected for example by not yet fixed in that version:
    Jan> 	[patch] [i386] Fix {,un}prelinked libraries for attach/core-load
    Jan> 	http://sourceware.org/ml/gdb-patches/2011-02/msg00630.html
    Jan> 	http://sourceware.org/ml/gdb-patches/2011-04/msg00272.html
    Jan>
    Jan> While there exist other methods for simplicity of the
    Jan> troubleshooting I would connect the remote system via NFS and
    Jan> use `set sysroot' to that mounted directory.

The sources are distributed over a few clearcase vobs. Maybe it's
easier if I just install a newer gdb. Since the patch above is quite
new, I wonder if it already made it into the last official release (7.4)?

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             |
 -------------------------------------------------------------------
---
You can learn many things from children. How much patience
you have, for instance.               -- Franklin P. Jones

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

* Re: Remote debugging: setting breakpoints in shared libraries
  2012-02-16 12:08   ` Klaus Zeitler
@ 2012-02-16 13:35     ` Jan Kratochvil
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kratochvil @ 2012-02-16 13:35 UTC (permalink / raw)
  To: Klaus Zeitler; +Cc: gdb

On Thu, 16 Feb 2012 13:07:08 +0100, Klaus Zeitler wrote:
>     Jan> It may be affected for example by not yet fixed in that version:
>     Jan> 	[patch] [i386] Fix {,un}prelinked libraries for attach/core-load
>     Jan> 	http://sourceware.org/ml/gdb-patches/2011-02/msg00630.html
>     Jan> 	http://sourceware.org/ml/gdb-patches/2011-04/msg00272.html
>     Jan>
>     Jan> While there exist other methods for simplicity of the
>     Jan> troubleshooting I would connect the remote system via NFS and
>     Jan> use `set sysroot' to that mounted directory.
> 
> The sources are distributed over a few clearcase vobs.

Source files do not matter for GDB operations, they are only displayed to the
user.  Library files (*.so*) matter for breakpoints placing/hit.


> Maybe it's
> easier if I just install a newer gdb. Since the patch above is quite
> new, I wonder if it already made it into the last official release (7.4)?

Yes; you can see the patch in gdb/ChangeLog there.


Regards,
Jan

^ 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).