This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: FYI: fix PR 9708
>>>>> "Daniel" == Daniel Jacobowitz <dan@codesourcery.com> writes:
[...]
Daniel> Now one of those is going to get a namespace and the other isn't.
Daniel> I'd have thought we would call them both f()::x - although clearly
Daniel> that's not sufficient to uniquely identify them. Should they
Daniel> both be ! die_needs_namespace?
Yes, I think we should also omit DW_TAG_subprogram here. I just didn't
think of it. I can either just check it in, or if you have an easy way
to test it, let me know. I've appended the patch.
Calling them f()::x might be interesting, but there are some caveats.
First, I am not sure the rest of gdb (I'm thinking the parser at least)
is set up to handle this. AFAIK this would be a new feature.
Second, we'd probably have to insert two symbols here -- one for the
global name and one for the local name. There are cases where gcc has
to give the static a synthetic linkage name, e.g.:
struct K {
int m () {
static bool themagicstatic = false;
int x;
{
static bool themagicstatic = false;
x = themagicstatic ? 23 : 24;
}
return x + themagicstatic ? 23 : 24;
}
}
This leads to:
opsy. nm pr | grep themagicstatic
080497de V _ZZN1K1mEvE14themagicstatic
080497dd V _ZZN1K1mEvE14themagicstatic_0
.. so in the inner scope, we still need a symbol named "themagicstatic";
calling it "themagicstatic_0" would be confusing to the user.
Daniel> I'm sure I originally fixed some bug by giving these things the
Daniel> physname of 'x'... but probably, whatever it was is also fixed by your
Daniel> change to use list_in_scope.
Yeah, the die_needs_namespace change is needed to get the proper name
for the symbol in new_symbol. Otherwise it ends up like
"K::themagicstatic", which is wrong.
Tom
*** dwarf2read.c.~1.366.~ 2010-03-12 17:20:15.000000000 -0700
--- dwarf2read.c 2010-03-15 13:47:54.000000000 -0600
***************
*** 3241,3247 ****
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;
--- 3241,3248 ----
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
! || die->parent->tag == DW_TAG_subprogram)
return 0;
return 1;