Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Kris Warkentin <KEWarken@qnx.com>
To: 'Anthony Heading' <ajrh@ajrh.net>, gdb@sources.redhat.com
Subject: RE: debugging shared libraries
Date: Thu, 05 Jan 2006 14:17:00 -0000	[thread overview]
Message-ID: <3518719F06577C4F85DA618E3C37AB9101CFC9FC@nimbus.ott.qnx.com> (raw)

Hi Anthony,

GDB has support for deferred breakpoints.  Try:

gdb my_executable

(gdb) break my_buggy_shared_library_function()
(gdb) blah blah not found would you like to defer this? y
(gdb) r

Then gdb loads the shared libraries (based on information in the runtime
image of the executable) and sets the breakpoint.

That should work.

cheers,

Kris

> -----Original Message-----
> From: gdb-owner@sourceware.org 
> [mailto:gdb-owner@sourceware.org] On Behalf Of Anthony Heading
> Sent: Thursday, January 05, 2006 9:12 AM
> To: gdb@sources.redhat.com
> Subject: debugging shared libraries
> 
> Hello,
> 
> Happy New Year to all.
> 
> I know this is an old question, but (probably in a bout of 
> fresh New Year optimism) I hopefully tried the following:
> 
> ~% gdb y.so
> GNU gdb 6.4-debian
> Copyright 2005 Free Software Foundation, Inc.
> [...]
> 
> (gdb) break my_buggy_shared_library_function()
> Breakpoint 1 at 0x792: file y.cpp, line 5.
> (gdb) run my_executable
> Starting program: /home/ajrh/y.so my_executable Breakpoint 1 
> at 0x80000792: file y.cpp, line 5.
> warning: shared library handler failed to enable breakpoint
> 
> Command syntax aside, can GDB really not DWIM?  Starting GDB 
> on the .so seems like the right thing to do: the 
> tab-completion etc on the function names works to get 
> breakpoints set up, etc.  But if the debug target is a shared 
> library then I probably need to run a different executable to 
> get the process started.
> 
> (gdb) help file
> Use FILE as program to be debugged.
> It is read for its symbols, for getting the contents of pure 
> memory, and it is the program executed when you use the `run' command.
> 
> Equivalently, I think, do these two properties really need to 
> be hardwired together?
> 
> For reference, I think this works to my gratification in MS 
> Visual Studio on Win32:  if you try to debug a DLL, the 
> program prompts to ask which executable you'd like to start.
> 
> Regards
> 
> Anthony
> 


             reply	other threads:[~2006-01-05 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-05 14:17 Kris Warkentin [this message]
2006-01-06  1:37 ` Anthony Heading
2006-01-06  8:10   ` Jim Blandy
2006-01-06 14:56     ` Anthony Heading
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=3518719F06577C4F85DA618E3C37AB9101CFC9FC@nimbus.ott.qnx.com \
    --to=kewarken@qnx.com \
    --cc=ajrh@ajrh.net \
    --cc=gdb@sources.redhat.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