This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: breakpoints in shared libraries


> Date: Tue, 14 Feb 2006 12:31:07 -0500
> From: Daniel Jacobowitz <drow@false.org>
> 
> 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.

Thanks for the explanation Daniel.  The complexity of C++ continues to
amaze me.

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]