Re: [RFA 2/4] dwarf2_physname

Keith Seitz
2010-02-01T19:32:18Z

On 02/01/2010 08:48 AM, Daniel Jacobowitz wrote:
>> + case DW_TAG_variable:
>> + {
>> + struct attribute *attr;
>> + attr = dwarf2_attr (die, DW_AT_specification, cu);
>> + if (attr)
>> + return 1;
>> + attr = dwarf2_attr (die, DW_AT_external, cu);
>> + if (attr == NULL&& die->parent->tag != DW_TAG_namespace)
>> + return 0;
>> + return 1;
>> + }
>> + break;
>> +
>> default:
>> return 0;
>> }
>
> What's this about? It needs an explanation, and I don't think
> DW_AT_specification has anything to do with die_needs_namespace.

DW_AT_specification is, as I deduce from ifdefing that out and running
the testsuite :-), needed for many namespace-based variables:

*************** PASS: gdb.cp/namespace.exp: ptype OtherF
*** 12145,12159 ****
KFAIL: gdb.cp/namespace.exp: ptype ::C::OtherFileClass (PRMS: gdb/1448)
PASS: gdb.cp/namespace.exp: ptype C::OtherFileClass
PASS: gdb.cp/namespace.exp: print cX
! PASS: gdb.cp/namespace.exp: print 'F::cXf'
! PASS: gdb.cp/namespace.exp: print F::cXf
! PASS: gdb.cp/namespace.exp: print F::cXfX
PASS: gdb.cp/namespace.exp: print X
! PASS: gdb.cp/namespace.exp: print 'G::Xg'
! PASS: gdb.cp/namespace.exp: print G::Xg
! PASS: gdb.cp/namespace.exp: print G::XgX
! PASS: gdb.cp/namespace.exp: print cXOtherFile
! PASS: gdb.cp/namespace.exp: print XOtherFile
PASS: gdb.cp/namespace.exp: print AAA::ALPHA
Running ../../../src/gdb/testsuite/gdb.cp/namespace-nested-import.exp ...
PASS: gdb.cp/namespace-nested-import.exp: print C::x
--- 12145,12159 ----
KFAIL: gdb.cp/namespace.exp: ptype ::C::OtherFileClass (PRMS: gdb/1448)
PASS: gdb.cp/namespace.exp: ptype C::OtherFileClass
PASS: gdb.cp/namespace.exp: print cX
! FAIL: gdb.cp/namespace.exp: print 'F::cXf'
! FAIL: gdb.cp/namespace.exp: print F::cXf
! FAIL: gdb.cp/namespace.exp: print F::cXfX
PASS: gdb.cp/namespace.exp: print X
! FAIL: gdb.cp/namespace.exp: print 'G::Xg'
! FAIL: gdb.cp/namespace.exp: print G::Xg
! FAIL: gdb.cp/namespace.exp: print G::XgX
! FAIL: gdb.cp/namespace.exp: print cXOtherFile
! FAIL: gdb.cp/namespace.exp: print XOtherFile
PASS: gdb.cp/namespace.exp: print AAA::ALPHA
Running ../../../src/gdb/testsuite/gdb.cp/namespace-nested-import.exp ...
PASS: gdb.cp/namespace-nested-import.exp: print C::x

I apologize, it has been quite some time since this was written, and
I've forgotten much of the context. So commenting out the code and
re-running the test suite is the best I can do to remember why some
things were done.

Was there something else in particular that was unclear?
Keith

PS. Tom also has a patch on expr-cumulative in this spot that deals with
static variables defined inside a block.