Re: How to setup a breakpoint on constructor

Jim Blandy
2004-07-16T21:54:52Z

mec.gnu@mindspring.com (Michael Elizabeth Chastain) writes:

> To take the points in reverse order,
>
> > (B) It exposes the difference between complete and base constructors,
> > which is an implementation detail of the C++ ABI that most users don't
> > understand.
>
> That is reality. The reality is that g++ emits two functions in the
> object code. In my opinion, if we try to gloss over that, then we'll
> just create more confusion for commands such as 'disassemble' and
> 'tbreak'.
>
> > (A) It was an ugly interface change to work around an internal
> > limitation, and they needed to retrain users to it.
>
> I agree with this part, to an extent. However, the gdb group
> has no control over the fact that there are two object code
> functions.
>
> I like the way it worked in gcc 2.95.3. With gcc 2.95.3,
> gcc emits one function with a hidden parameter. c++ programmers
> and gdb are both familiar with hidden parameters ('this').
> If I recall correctly, Apple modified gcc 3.X to do something
> similar.

If I remember right, the use of separate complete and base
constructors is an ABI requirement; the compiler doesn't have the
option of just generating whatever code it likes.