Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@codesourcery.com>
To: gdb@sourceware.org
Subject: Re: Variable values before initialisaton
Date: Mon, 27 Nov 2006 20:09:00 -0000	[thread overview]
Message-ID: <m34psktzwl.fsf@codesourcery.com> (raw)
In-Reply-To: <20061124151537.GA12695@nevyn.them.org> (Daniel Jacobowitz's message of "Fri, 24 Nov 2006 10:15:38 -0500")


Daniel Jacobowitz <drow@false.org> writes:
> 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.

I think this is a bit afield from Rob's original question.  In the
code he posted:

    int i = 0;
    int j = 2;
    int k = 3;

the issue isn't initialization.  Rather it's that the scope of k
doesn't include the declarations of i and j, but GCC collapses all
these declarations into one block, so GDB thinks k's scope does
include the first two lines.  If GCC produced DW_AT_start_scope
attributes (p. 61, #11 in DWARF 3), and GDB understood them, then this
would work.


  reply	other threads:[~2006-11-27 20:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-23 17:12 Rob Quill
2006-11-23 17:27 ` Vladimir Prus
     [not found]   ` <baf6008d0611230932o355f2ba6h9f6b0e778c82bce@mail.gmail.com>
2006-11-23 17:32     ` Rob Quill
2006-11-23 19:55       ` Daniel Jacobowitz
2006-11-23 19:58         ` Rob Quill
2006-11-24  6:53         ` Vladimir Prus
2006-11-24 15:15           ` Daniel Jacobowitz
2006-11-27 20:09             ` Jim Blandy [this message]
2006-11-28 11:21               ` Rob Quill
2006-11-28 19:29                 ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m34psktzwl.fsf@codesourcery.com \
    --to=jimb@codesourcery.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox