This is the mail archive of the
mailing list for the GDB project.
Re: Variable values before initialisaton
Daniel Jacobowitz wrote:
> On Thu, Nov 23, 2006 at 05:32:39PM +0000, Rob Quill wrote:
>> How could I go about looking into a fix? I wouldn't really know where
>> to start, but it is quite annoying for what am trying to do.
> You have to emit proper debug info from the compiler. It's the only
> thing that knows. However, for things where initialization is
> complicated (like classes), there's basically no way to get it right.
Can you clarify? Certainly, each constructor invocation produces a finite
number of processor instruction. You can identify the "last" instruction of
those, and hack gcc to produce file last_instructions_of_ctors.txt and make
gdb read such file and do the right thing.
Now getting this work in nice way can be a lot of work, but where does "no
way to get it right" comes from? The only serious complexity I can imagine
is that if body of ctor is duplicated along two execution paths. I doubt
this happens regularly, at least at -O0.