[Dwarf-Discuss] How do we get the value of type attribute from dwarf info programatically
Mon Apr 28 03:50:35 GMT 2008
all help from you people has helped me to understand the dwarf info...
Thank you very much
----- Original Message ----
From: Jim Blandy <email@example.com>
To: ashim saikia <ar.saikia at yahoo.com>
Cc: dwarf info <dwarf-discuss at lists.dwarfstd.org>
Sent: Tuesday, April 8, 2008 10:09:48 PM
Subject: Re: [Dwarf-Discuss] How do we get the value of type attribute from dwarf info programatically
On Tue, Apr 8, 2008 at 5:38 AM, ashim saikia <ar.saikia at yahoo.com> wrote:
> Now suppose I have dwarf information for array as follows:-
> <2><1a1>: Abbrev Number: 11 (DW_TAG_variable)
> <1a2> DW_AT_name : ary
> <1a6> DW_AT_decl_file : 1
> <1a7> DW_AT_decl_line : 18
> <1a8> DW_AT_type : <1e2>
> <1ac> DW_AT_location : 3 byte block: 91 98 7f (DW_OP_fbreg: -104)
> <1><1e2>: Abbrev Number: 7 (DW_TAG_array_type)
> <1e3> DW_AT_sibling : <1f2>
> <1e7> DW_AT_type : <bb>
> <2><1eb>: Abbrev Number: 8 (DW_TAG_subrange_type)
> <1ec> DW_AT_type : <f9>
> <1f0> DW_AT_upper_bound : 19.
> Now I can conclude the following from the above given dwarf info:-
> 1. ary is a variable of type <1e2> and at location -104 off the frame base
> 2. Type <1e2> is an array with an element type of <bb>
> 3. Has one dimension with the implied lower bound of 0 and the declared
> upper bound of 19.
> Now, I am trying to write a program that will give me these information into
> a file .Everything goes fine until I encounter the DW_AT_type attribute.
> DW_AT_type attribute gives me the value <1e2>, and I get the die <1e2>.
> Again I have to read the die <1e2>. I do so,... again I get a DW_AT_type
> attribute again a die <bb>(... doing recursion). Now bb gives me the base
> type... (ok fine). Now what about the DW_TAG_subrange type, the
> DW_AT_upper_bound is of my interest. Because I m doing recursion, I end up
> with the die given by <bb>. Now If I check out this die, for "having a child
> die", obviously it doesnot have one. But the die <1e2> which defines array
> type has a child,... How do I keep track of that?
When you look at the DW_TAG_subrange_type, why do you end up at <bb>
again? The DW_AT_type attribute of a DW_TAG_subrange_type for an
array gives the type used to index the array --- in your example, the
type at <f9>. I don't see why the type of the elements of the array
would get involved here at all.
Be a better friend, newshound, and
know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Dwarf-discuss