This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: FYI: fix PR 9708
- From: Daniel Jacobowitz <dan at codesourcery dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 12 Mar 2010 21:36:34 -0500
- Subject: Re: FYI: fix PR 9708
- References: <m3r5np83vi.fsf@fleche.redhat.com>
On Fri, Mar 12, 2010 at 05:25:05PM -0700, Tom Tromey wrote:
> + attr = dwarf2_attr (die, DW_AT_external, cu);
> + if (attr == NULL && die->parent->tag != DW_TAG_namespace)
> + return 0;
> + /* A variable in a lexical block of some kind does not need a
> + namespace, even though in C++ such variables may be external
> + and have a mangled name. */
> + if (die->parent->tag == DW_TAG_lexical_block
> + || die->parent->tag == DW_TAG_try_block
> + || die->parent->tag == DW_TAG_catch_block)
> + return 0;
> + return 1;
Why is this:
int f()
{
static int x;
...
}
Different from this:
int f()
{
if (foo)
{
static int x;
...
}
}
Now one of those is going to get a namespace and the other isn't.
I'd have thought we would call them both f()::x - although clearly
that's not sufficient to uniquely identify them. Should they
both be ! die_needs_namespace?
> +
> + long method ()
> + {
> + static bool svar = true;
> + return key2;
> + }
Looking at your test case, I guess the answer is that you're relying on
GCC's extra DW_TAG_lexical_block emitted for all C++ functions; this
is not a DWARF requirement and other compilers omit it.
I'm sure I originally fixed some bug by giving these things the
physname of 'x'... but probably, whatever it was is also fixed by your
change to use list_in_scope.
--
Daniel Jacobowitz
CodeSourcery