Re: [RFA 2/4] dwarf2_physname

Daniel Jacobowitz
2010-02-04T18:14:20Z

On Thu, Feb 04, 2010 at 10:48:13AM -0700, Tom Tromey wrote:
> >> + case DW_TAG_variable:
> >> + {
> >> + struct attribute *attr;
> >> + attr = dwarf2_attr (die, DW_AT_specification, cu);
> >> + if (attr)
> >> + return 1;
>
> Based on the above I am guessing it is the early return here?

That's part of it. Also, I don't think the check for DW_AT_external
tests what we want (which is what I'm trying to pin down - what is the
desired property?).

Check the debug info for this:

namespace X
{
int xx;
static int yy;
}

xx is DW_AT_external, yy isn't.

> 1. If the variable is declared in the namespace scope, but defined
> outside, then a second defining DIE is emitted that refers to the
> declaration DIE using DW_AT_specification. In this case the declaration
> DIE's namespace is used.
>
> ... The code above seems to cheat a tiny bit because it unconditionally
> returns 1 in this case, whereas it should perhaps recurse.

Recursing's a good idea. I hadn't thought of that.

> I'm still not understanding what problem you see, but I would like to.

I really, really want a specification for this function that describes
what it's trying to accomplish. I don't understand what it's for, so
it's hard to translate my red flags into suggestions.

--
Daniel Jacobowitz
CodeSourcery