Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: f.hackenberger@chello.at, gdb@sourceware.org
Subject: Re: breakpoints in shared libraries
Date: Tue, 14 Feb 2006 17:31:00 -0000	[thread overview]
Message-ID: <20060214173107.GA27548@nevyn.them.org> (raw)
In-Reply-To: <200602141721.k1EHL7R0015198@elgar.sibelius.xs4all.nl>

On Tue, Feb 14, 2006 at 06:21:07PM +0100, Mark Kettenis wrote:
> But Florian is setting a breakpoint using FILENAME:LINE syntax and not
> using FUNCTIONNAME syntax.  That should work isn't it?  At least as
> long as GCC is not inlining the constructor such that there are
> actually multiple copies in the code and GDB sets the breakpoint in a
> different copy than the one being executed.

Nope.  I don't have a handy copy of the explanation, so here it is.

Take a look at the "Itanium C++ ABI", which has some Itanium-specific
language in it but is actually widely adopted for non-Itanium platforms
by multiple compilers, GNU and otherwise.  Here it is:

  http://www.codesourcery.com/cxx-abi/abi.html

It's got this to say about constructors:

  <ctor-dtor-name> ::= C1	# complete object constructor
		   ::= C2	# base object constructor
		   ::= C3	# complete object allocating constructor
		   ::= D0	# deleting destructor
		   ::= D1	# complete object destructor
		   ::= D2	# base object destructor

The relevant section is 2.6.  When constructing a virtual base class,
the C2 constructor is called instead of the C1 constructor.

Now, in theory, a compiler can generate one of these as a tiny
trampoline that jumps to the other, and only emit debug information for
the real one, and things will work.  But GCC doesn't do this and
attempts to get it to do so have, so far, met with failure.  So there's
two functions for every single constructor, and GDB tends to breakpoint
one of them more or less at random.

I maintain that the two right things to do here are (A) fix GCC to
support functions with multiple entry points, or at least something
that can give a good impression of it, and (B) set breakpoints by
function name or line number at all copies.

An astute observer will notice that both (A) and (B) are hard :-)
I've been working on (B) as I can find the time, and some cleanups
for it have already been done, and I posted an early prototype.
But I never got back to it.  The Ada folks expressed some interested,
and I think Fred did too, but so far nothing's come of it.

-- 
Daniel Jacobowitz
CodeSourcery


  parent reply	other threads:[~2006-02-14 17:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-14 16:29 Florian Hackenberger
2006-02-14 17:00 ` Daniel Jacobowitz
2006-02-14 17:10   ` Florian Hackenberger
2006-02-14 17:13     ` Daniel Jacobowitz
2006-02-14 17:52       ` Paul Koning
2006-02-14 18:00         ` Florian Hackenberger
2006-02-14 17:21   ` Mark Kettenis
2006-02-14 17:23     ` Bob Rossi
2006-02-14 17:31     ` Daniel Jacobowitz [this message]
2006-02-14 17:47       ` Mark Kettenis
2006-02-14 17:08 ` Mark Kettenis
2006-02-14 17:20   ` Florian Hackenberger
  -- strict thread matches above, loose matches on Subject: below --
2001-11-13  9:05 Tom Tromey
2001-11-13  9:41 ` Daniel Jacobowitz
2001-11-13 10:11   ` Tom Tromey
2001-11-13 10:20 ` Per Bothner

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=20060214173107.GA27548@nevyn.them.org \
    --to=drow@false.org \
    --cc=f.hackenberger@chello.at \
    --cc=gdb@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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