Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top