[Dwarf-Discuss] regarding files in libdwarf

David Anderson davea42 at earthlink.net
Fri Apr 24 10:33:25 PDT 2009

ranjith kumar wrote:
> Hi,
> I am debugging some project which uses libdwarf.
> 1)
> what is the purpose of dwarf_srcfiles(), dwarf_formudata() functions????
> I did searched in goole. I could not found a clue!
> I searched in  "DWARF Debugging Information Format Version 3" pdf file also.
> I got no clue.
Libdwarf is not part of the DWARF standard. It is independent
open source software.     Some distributions (SUSE and more recently
a Debian based release) have chosen to package the library in their
distribution.  But to do your own work you want to download
source so you have all the documentation and source for reference.
> Where can I found documentation and the set of  API of libdwarf?
> 2)

Full documentation is in the release.   See
Unpack the latest release and
in the libdwarf source see libdwarf2.1.pdf  .

The history of libdwarf (and dwarfdump) is on that web page too.

>                       .
>                       .
>                       .
> Dwarf_Half  dieTag;
>   switch( dieTag ) {
>                 case DW_TAG_subprogram:
>                 case DW_TAG_entry_point:
>                         .
>                         .
>                         .
> I have code like the above.
> My question how to know from which file libdwarf is currently reading
> the dwarf information???
The compilation-unit DIE  (Debugging Information Entry) gives that 
You can use dwarfdump as one way to understand what is  in the DWARF of a
particular executable and dwarfdump is an example of using libdwarf. 

I should mention that the most recent release of dwarfdump/libdwarf, when
printing frame information,   sometimes can print something like r1035 
or r1036
as a 'register number' due to a fairly old mistake.     Don't let this 
worry you.
The next release has this fixed (and adds a couple interface functions 
to libdwarf
to create a complete solution). 

GNU readelf is also an excellent tool for understanding what is
in an executable DWARF data (readelf does not use libdwarf).
> (I want to know it inside some particluar 'cases'. Thats why I gave
> code structure)
> Thanks in advance.
> P.S.: I am new to libdwarf. sorry if you could not understand my questions.
Thanks for your interest in libdwarf. 
It's probably best to address libdwarf issues to me directly,
off this list, as libdwarf is a separate issue from the DWARF
standard itself.

David Anderson

More information about the Dwarf-Discuss mailing list