[RFA 2/4] dwarf2_physname

Keith Seitz keiths@redhat.com
Fri Feb 5 17:13:00 GMT 2010


On 02/04/2010 10:14 AM, Daniel Jacobowitz wrote:

> 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?).

Yes, we are trying to ascertain whether the DIE (a DW_TAG_variable) in 
question needs to be prefixed -- same job it used to do AFAICT. The 
difference is that it is now being used for a much more complex job, 
which requires us to refine the behavior of pdi_needs_namespace for more 
inputs. In particular, it is the use of dwarf2_physname in new_symbol 
which necessitates this change.

Previously, this code (pdi_needs_namespace) unconditionally returned 1 
(for this DW_TAG_variable case), which is not unilaterally correct anymore.

>> 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 hadn't either. Next iteration in attached patch.

BTW, while goofing around with the code a bit, it appears that since I 
wrote all of this many, many months ago, things have changed (for the 
better). physname_prefix and dependents are no longer necessary. We can 
use determine_prefix instead. I apologize that I did not catch this earlier.

Since dwarf2_full_name and dwarf2_physname are almost identical, I've 
also merged the two functions.

I've also added a NAME parameter so that callers can pass in the result 
of a previous dwarf2_name call. I noticed quite some time ago that this 
method was being called several times in a row.

I've appended an updated patch of dwarf2read.c with CVS HEAD.

Keith
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: physname-dwarf2read.c-revised.patch
URL: <http://sourceware.org/pipermail/gdb-patches/attachments/20100205/61ed937a/attachment.ksh>


More information about the Gdb-patches mailing list