[Dwarf-discuss] dwarf---inheritance

David Anderson davea42
Mon Feb 5 17:49:53 GMT 2007


gireesh subramaniam wrote:
> The reason i want to extract information about inheritance is to 
> develop a
> feature in the source code browser which will be able to list all base(or
> derived,depending on the level in the inheritance hierarchy) class 
> members
> of the class for a C++ program.It <http://program.it/> would be 
> helpful if
> you can give information specific to this task.

Brian explained a starting point to understand how inheritance is
shown in dwarf3.  Of course it's up to the compiler-writer to get it
written into the object files.

If the program is stripped there is nothing left to analyze, so that's 
hopeless :-)
Given a non-stripped program one can choose one of:

o Use a tool, say GNU readelf, to print the dwarf to text and use perl, 
c, python,
   or some other language to derive the graph by reading in the text readelf
   produces.

o Or use dwarfdump in similar fashion.

o Or write C/C++ code to read and process the dwarf directly from
   the program file.   That's what gdb does, for example.  You have to
   do the 'understanding' of the bits and bytes as well as higher levels.

o Or write C/C++ code to use libdwarf to read from the program file.
   But you still have to do all the higher level work of turning this into
   the hierarchy.

There are more choices, but those sort of outline the basic choices.

There is no shortcut, you have to closely study the dwarf3 documentation
to understand how the hierarchy is represented...

Hope this helps.
David Anderson





More information about the Dwarf-discuss mailing list