This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Variable values before initialisaton
On Fri, Nov 24, 2006 at 09:52:52AM +0300, Vladimir Prus wrote:
> 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.
You can have:
- Initialize part A of structure
- Read part A of structure
- Initialize rest of structure
You don't want GDB to be unable to display the structure at that read,
do you? So you need to know which bits of it are initialized and which
aren't. And, in some cases, you want to be able to debug a structure
pointer after "new" returns some storage but before the constructor is
invoked.
I suppose this is doable though: a very interesting project for someone
interested in learning about debug info formats and generation would be
to annotate initializedness somehow. The compiler does know. But it
wouldn't be easy.
--
Daniel Jacobowitz
CodeSourcery