From: Anthony Heading <ajrh@ajrh.net>
To: Jim Blandy <jimb@red-bean.com>
Cc: Kris Warkentin <KEWarken@qnx.com>, gdb@sources.redhat.com
Subject: Re: debugging shared libraries
Date: Fri, 06 Jan 2006 14:56:00 -0000 [thread overview]
Message-ID: <43BE8513.6020402@ajrh.net> (raw)
In-Reply-To: <8f2776cb0601060010l18ef2664laa60f4f9b3149ead@mail.gmail.com>
Jim Blandy wrote:
> One of the problems here is that, technically, we don't know which
> shared library the dynamic linker will actually load until the program
> starts running, so we can't offer completion on its symbols.
Hi Jim,
But my original suggestion was about trying to sidestep that. If gdb is
run on the shared library, it's clear even technically what library we're
trying to debug! And indeed that already works fine (on ELF at least):
% gdb y.so
GNU gdb 6.4-debian
[..]
(gdb) break m<TAB>
mbstate_t my_buggy_shared_library_function()
(gdb) break my_buggy_shared_library_function()
Breakpoint 1 at 0x792: file y.cpp, line 5.
The only problem that I can see is that within gdb you can't start
a different executable.
That is, most probably I have a main program, maybe just:
main() { my_buggy_shared_library_function() }
which I don't need to debug - I only need to use that executable
to get the process started.
(gdb) file y.so
Reading symbols from /home/ajrh/y.so...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) break y.cpp:5
Breakpoint 1 at 0x792: file y.cpp, line 5.
(gdb) execute my_main_program
Undefined command: "execute". Try "help".
<oh well...>
> We could try to guess what the dynamic linker was going to do, but
> that's kind of a mess.
Oh agreed, it's difficult if one tried to anticipate symbol
definitions by chasing them from the main executable. That's why I'm
suggesting something orthogonal: the programmer identifies the shared
library to be debugged. But gdb currently seems a bit fixated on
the idea that the debug target must be the executable object file,
rather than one of the shared object files.
Rgds
Anthony
next prev parent reply other threads:[~2006-01-06 14:56 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-05 14:17 Kris Warkentin
2006-01-06 1:37 ` Anthony Heading
2006-01-06 8:10 ` Jim Blandy
2006-01-06 14:56 ` Anthony Heading [this message]
2006-01-06 19:06 ` Jim Blandy
-- strict thread matches above, loose matches on Subject: below --
2006-01-05 14:12 Anthony Heading
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=43BE8513.6020402@ajrh.net \
--to=ajrh@ajrh.net \
--cc=KEWarken@qnx.com \
--cc=gdb@sources.redhat.com \
--cc=jimb@red-bean.com \
/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