1

I am developing a new tool of valgrind in which at some point I want to read the dwarf debug info in order to get the starting address and the size of a global array.

I know that this info is included into the .debug_info section of dwarf3 debug info.

In the derictory /valgrind/coregrind/m_debuginfo there is a header file priv_readdwarf3.h in which there is a func at line 57:

    /* Read variables and types from DWARF3 ".debug_info" sections. */
    extern void ML_(read_debuginfo_dwarf3)(

    struct _DebugInfo* di,
    UChar* debug_info_img,   SizeT debug_info_sz,
    UChar* debug_types_img,  SizeT debug_types_sz,
    UChar* debug_abbv_img,   SizeT debug_abbv_sz,
    UChar* debug_line_img,   SizeT debug_line_sz,
    UChar* debug_str_img,    SizeT debug_str_sz,
    UChar* debug_ranges_img, SizeT debug_ranges_sz,
    UChar* debug_loc_img,    SizeT debug_loc_sz,
    UChar* debug_info_alt_img, SizeT debug_info_alt_sz,
    UChar* debug_abbv_alt_img, SizeT debug_abbv_alt_sz,
    UChar* debug_line_alt_img, SizeT debug_line_alt_sz,
    UChar* debug_str_alt_img,  SizeT debug_str_alt_sz
    );

but i cant understand how to use this func.

Any help appreciated Thanks in advance.

lazlazari
  • 13
  • 3

1 Answers1

0

Any routine declared in a priv_ header is not currently available to tools - only the routines in the pub_tool_ header files are part of the core/tool interface.

The pub_tool_debuginfo.h header is the interface to debug information, and the VG_(get_data_description) function is the one to use to get information about the variable (if any) associated with an address. Note that your tool will need to call VG_(needs_var_info) from it's clo_init routine if it wants variable information to be loaded.

The best place to ask questions about writing tools is probably the valgrind-developers mailing list.

TomH
  • 8,900
  • 2
  • 32
  • 30
  • Thank you TomH, I followed your instructions and I wrote the following piece of code. `myxarr1 = VG_(newXA)( VG_(malloc), "football", VG_(free), sizeof(HChar) ); myxarr2 = VG_(newXA)( VG_(malloc), "football", VG_(free), sizeof(HChar) ); check=VG_(get_data_description)(myxarr1, myxarr2, addr); VG_(printf)("check%d\n",check);` Where addr contains the starting address of my array I also call VG_(needs_var_info) from my clo_init.The problem is that the Bool check variable is False.That means that no description is created by the `VG_(get_data_description)`. – lazlazari Dec 06 '12 at 19:08