This is the mail archive of the
mailing list for the GDB project.
Re: breakpoints in constructors
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Michael Elizabeth Chastain <mec at shout dot net>
- Cc: drow at mvista dot com,pkoning at equallogic dot com,carlton at bactrian dot org,gdb at sources dot redhat dot com
- Date: Wed, 30 Apr 2003 01:20:04 -0400
- Subject: Re: breakpoints in constructors
On Wednesday, April 30, 2003, at 12:36 AM, Michael Elizabeth Chastain
Can I de-lurk for a minute?
gcc 2.95.3 had a single object code function for each constructor,
with a hidden flag to indicate its "in-charge-ness". I always thought
that was much nicer for debugging.
But gcc 3.X's multi-object-code implementation is mandated by the
multi-vendor ABI, which will make it harder.
No it isn't.
It's not required multi-object-code, it's only required that it does
the right thing when called with a certain name (not the same at all,
since one can just make up the symbols for the constructors that start
at the right points in the "one object code constructor" function,
without even having to make stub functions with gotos in them. Just
multiple symbol names and one object code).
One can also have "one object code implementation" with labels and use
gotos and stub functions if you like.
Or one can have three copies of the object code.
It's not like even with three copies, that this is a laborious task.
It just means that you set multiple breakpoints.
One way is to make one "visible" breakpoint and 2 "hidden" breakpoints.
This is a bit ugly, unless you special case the breakpoint printouts so
that it says the one "visible" breakpoint is at pc x, y, z, rather than
just x (the code to do this is probably ugly too in this method).
Another way is to do this is make it all invisible to the user, but
still have "hidden" breakpoints is to make breakpoints have an
associate set of methods, where they perform this magic internally.
You could also just make a hierarchy of breakpoints and avoid the magic
methods and hiding altogether.
You have one parent breakpoint named "Foo:Foo" that just consists of 3
sub-breakpoints, each at the right place in the constructor.
Only non-hidden top level breakpoints (since i imagine in some
extremely complex case, one could want to have a subbreakpoint
consisting of subbreakpoints) are visible, and thus, Foo:Foo is visible
in an info breakpoints printout, but it's sub-breakpoints aren't (You
can either just make it print "exists at multiple pc's, or recursively
print out the pc's of the sub breakpoints).
Hitting one of the subbreakpoints doesn't require any magic, since what
we say is that we've hit the parent breakpoint, "Foo:Foo".