Re: Getting Debug Information from a binary (122 Views)
Reply
Advisor
Suchitra Venugopal
Posts: 23
Registered: ‎02-25-2010
Message 1 of 3 (122 Views)

Getting Debug Information from a binary

In our code we extract the debug information from the binaries( .so files) that are built using debug mode and store this information in a separate file. This is required because we strip all debug information from the binaries and then ship them to the customer along with the extraction debug information files .

Incase any failure occurrs ,our application will read the debug information from the stored/extracted file and give proper trace information to the user ( with source , line number where error occured etc debug information).

We are working on HP Itanium and we have code in Solaris and Linux which does the extraction of the debug information. But Solaris and Linux supports ELF STAB format while HP Itanium supports DWARF2 format. Basically we need to extract informations like function name , src file names . source code of functions/sybols , size of function, start offset in exe, 1st function in source file, last function in src file, etc(the information in STAB in Solaris) using the DWARF2 format.

In short this is more or less similar to a debugger code .


Is there any open source code or any API which we can re-use to attain this in HP Itanium ( DWARF2 reader )?
Acclaimed Contributor
Dennis Handly
Posts: 25,204
Registered: ‎03-06-2006
Message 2 of 3 (122 Views)

Re: Getting Debug Information from a binary

By default there is no debug info in load modules, +objdebug, it is left in the object files.
You would have to use +noobjdebug.

>we need to extract info like function name, src filenames. size of function, start offset in exe,

This info is already in the minimal line table and you don't need -g to include it.


Occasional Visitor
ajay.paragi
Posts: 3
Registered: ‎05-29-2009
Message 3 of 3 (122 Views)

Re: Getting Debug Information from a binary

You could look into open source HP-WDB debugger.
It reads DWARF2 debugging information from binary.
You can download WDB and its source files from www.hp.com/go/wdb
The code that does this stuff is in file dwarf2read.c.
Hope this helps you.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.