November 21, 2024, 10:35:34 PM

News : LinuxSolved.com Linux Help Community Forum..


Author Topic: Dwarf debug information, how to?  (Read 6831 times)

Offline webquinty

  • New Member
  • Posts: 1
Dwarf debug information, how to?
« on: May 17, 2011, 12:50:04 PM »
Hello,

I would like to extract debug information but I have some problems.

For example, I have a executable a.out...

Quote
nm -f sysv a.out | grep ".global_var" >vars.txt

With this command I extract all my variables. All of them are in .global_var section, and it give me follow information:

Quote
CAN_station_n       |08073258|   D  |            OBJECT|00000001|     |.global_var
CONTROLend          |080732a7|   D  |            OBJECT|00000001|     |.global_var
CONTROLinit         |080732a8|   D  |            OBJECT|00000001|     |.global_var
FORCEempty_changed  |080732a5|   D  |            OBJECT|00000001|     |.global_var
FORCEmax_bar        |08073283|   D  |            OBJECT|00000007|     |.global_var
FORCEmax_changed    |080732a6|   D  |            OBJECT|00000001|     |.global_var

Well, I have only address of my vars, but I would like to know type var or struct of the variables. With dwarf dump I have all of information, but it is a mess...

Quote
<1><117bc>: Abbrev Number: 32 (DW_TAG_variable)
    <117bd>   DW_AT_name        : (indirect string, offset: 0x153d): draw_limits   
    <117c1>   DW_AT_decl_file   : 128   
    <117c2>   DW_AT_decl_line   : 207   
    <117c3>   DW_AT_type        : <0x1179a>   
    <117c7>   DW_AT_external    : 1   
    <117c8>   DW_AT_location    : 5 byte block: 3 72 32 7 8    (DW_OP_addr: 8073272)
 <1><117ce>: Abbrev Number: 32 (DW_TAG_variable)
    <117cf>   DW_AT_name        : (indirect string, offset: 0x15cd): step   
    <117d3>   DW_AT_decl_file   : 128   
    <117d4>   DW_AT_decl_line   : 209   
    <117d5>   DW_AT_type        : <0x10139>   
    <117d9>   DW_AT_external    : 1   
    <117da>   DW_AT_location    : 5 byte block: 3 7a 32 7 8    (DW_OP_addr: 807327a)

Is there any parser or way to put in order this information??

My idea is create a file with the follow information:

name of var  -  address -  type -  size  -  struct or not

Best regards
John Martin