[Dwarf-Discuss] information about "Structure" and "Union" in Dwarf 2

Michael Eager eager@eagercon.com
Fri Dec 14 16:16:51 GMT 2012

Hi Slimani --

I recommend that you join the DWARF Discussion mailing list
and post your questions there.  You can join by going here:
(Please do not post with the confidentiality trailer that was
attached to the email you sent me.)

Please post a complete test case.  When you say that you are
getting errors, list what those errors are.  It also helps to
provide a listing of the generated DWARF, produced by readelf
or dwarfdump.  I also recommend that you simplify test cases as
much as possible.  In your example, it is likely that you can
eliminate the typedef.

I assume that you have a copy of the current DWARF Standard from
http://dwarf.std.  The paper I wrote is only an overview
of DWARF; the standard goes into much more detail and depth.

Struct and union in DWARF are similar, differing mostly in the
TAG of the DIE.  There is no hierarchical relationship between
the two.  Each member of a struct or union is represented by a
DIE which is a child of the struct/union DIE.

On 12/14/2012 07:07 AM, Slimani, Oussama wrote:
> Good morning Mr Eager,
> My name is Slimani and I work as an apprentice engineer (I am
> undergoing training) in SORIN Group (medical domain). I am working with Libdwarf library to parse an
> ELF file.
> However, I have a problem of comprehension of Debugging Information Entry (DIE).
> I have to parse variables from ELF file, when I parse ?structure? or ?union? I have some errors.
> For example :
> typedefstruct _MyStruct
> {
> int field1;
> char field2;
> MyStruct2 field3;
> char field4;
> } MyStruct;
> To regenerate DIE  tree, I use ?dwarf_child? and ?dwarf_siblingof? ( Libdwarf functions ) in my
> program (C ++). I know that DIE child can be retrieve by reference (dwarf_global_formref) or
> directly (dward_child).
> I didn?t understand dwarf (DWARF 2) hierarchy of Structure and Union ( I didn?t see an example in
> your introduction to the DWARF Debugging Format like for base types and pointer types ).
> Have a good day.
> Apprentice Engineer, ESW team.
> SORIN Group

Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077

More information about the Dwarf-discuss mailing list