From: Joel Brobecker <brobecker@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix C `extern' shadowing in a local block
Date: Thu, 02 Apr 2009 18:54:00 -0000 [thread overview]
Message-ID: <20090402185413.GC9017@adacore.com> (raw)
In-Reply-To: <20090326212128.GA32657@host0.dyn.jankratochvil.net>
Hi Jan,
> 2009-03-26 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * dwarf2read.c
> (new_symbol <DW_TAG_variable> <!DW_AT_location> <DW_AT_external>):
> Create the symbol in local scope.
This part makes me uncomfortable. I am afraid that doing so would be
misinterpreting the meaning of DW_AT_external. Also, I would mean
that we are treating this attribute differently depending on whether
we have a location attribute or not. This may be the correct thing
to do, but I want to make sure that the debugging information generated
in this case is correct.
We have to consider for instance the following example:
extern int toto;
int
main (void)
{
toto++;
return 0;
}
The debugging information generated for our extern looks like this:
.uleb128 0x4 # (DIE (0x55) DW_TAG_variable)
.long .LASF4 # DW_AT_name: "toto"
.byte 0x1 # DW_AT_decl_file (foo.c)
.byte 0x1 # DW_AT_decl_line
.long 0x4e # DW_AT_type
.byte 0x1 # DW_AT_external
.byte 0x1 # DW_AT_declaration
.byte 0x0 # end of children of DIE 0xb
The description for the global variable looks completely identical
to your example where the variable is bound to a local scope.
Now, in practice, I think that things would work in both cases.
In my example, with your patch, the variable would be inserted
at the file_symbols level instead of inside the local scope associated
to your block.
I would like to have Daniel's opinion on this. I'll see if he's on IRC.
--
Joel
next prev parent reply other threads:[~2009-04-02 18:54 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-26 21:38 Jan Kratochvil
2009-03-28 23:29 ` Jan Kratochvil
2009-04-02 18:54 ` Joel Brobecker [this message]
2009-04-02 19:06 ` Daniel Jacobowitz
2009-04-02 21:08 ` Jan Kratochvil
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=20090402185413.GC9017@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/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