Merge in the DATASYMS branch.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@7540 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h
index 1c03ce0..a6849ab 100644
--- a/include/pub_tool_debuginfo.h
+++ b/include/pub_tool_debuginfo.h
@@ -74,9 +74,27 @@
entry points within it. */
extern Bool VG_(get_fnname_if_entry) ( Addr a, Char* fnname, Int n_fnname );
+/* Looks up data_addr in the collection of data symbols, and if found
+ puts its name (or as much as will fit) into dname[0 .. n_dname-1],
+ which is guaranteed to be zero terminated. Also data_addr's offset
+ from the symbol start is put into *offset. */
+extern Bool VG_(get_datasym_and_offset)( Addr data_addr,
+ /*OUT*/Char* dname, Int n_dname,
+ /*OUT*/OffT* offset );
+
+/* Try to form some description of data_addr by looking at the DWARF3
+ debug info we have. This considers all global variables, and all
+ frames in the stacks of all threads. Result (or as much as will
+ fit) is put into into dname{1,2}[0 .. n_dname-1] and is guaranteed
+ to be zero terminated. */
+extern Bool VG_(get_data_description)( /*OUT*/Char* dname1,
+ /*OUT*/Char* dname2,
+ Int n_dname,
+ Addr data_addr );
+
/* Succeeds if the address is within a shared object or the main executable.
It doesn't matter if debug info is present or not. */
-extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname );
+extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname );
/* Puts into 'buf' info about the code address %eip: the address, function
name (if known) and filename/line number (if known), like this:
@@ -87,42 +105,44 @@
*/
extern Char* VG_(describe_IP)(Addr eip, Char* buf, Int n_buf);
-
/*====================================================================*/
/*=== Obtaining segment information ===*/
/*====================================================================*/
/* A way to get information about what segments are mapped */
-typedef struct _SegInfo SegInfo;
+typedef struct _DebugInfo DebugInfo;
-/* Returns NULL if the SegInfo isn't found. It doesn't matter if debug info
- is present or not. */
-extern SegInfo* VG_(find_seginfo) ( Addr a );
+/* Returns NULL if the DebugInfo isn't found. It doesn't matter if
+ debug info is present or not. */
+extern DebugInfo* VG_(find_seginfo) ( Addr a );
-/* Fish bits out of SegInfos. */
-extern Addr VG_(seginfo_start) ( const SegInfo *si );
-extern SizeT VG_(seginfo_size) ( const SegInfo *si );
-extern const UChar* VG_(seginfo_soname) ( const SegInfo *si );
-extern const UChar* VG_(seginfo_filename) ( const SegInfo *si );
-extern ULong VG_(seginfo_sym_offset)( const SegInfo *si );
+/* Fish bits out of DebugInfos. */
+extern Addr VG_(seginfo_get_text_avma)( const DebugInfo *di );
+extern SizeT VG_(seginfo_get_text_size)( const DebugInfo *di );
+extern const UChar* VG_(seginfo_soname) ( const DebugInfo *di );
+extern const UChar* VG_(seginfo_filename) ( const DebugInfo *di );
+extern ULong VG_(seginfo_get_text_bias)( const DebugInfo *di );
/* Function for traversing the seginfo list. When called with NULL it
returns the first element; otherwise it returns the given element's
successor. */
-extern const SegInfo* VG_(next_seginfo) ( const SegInfo *si );
+extern const DebugInfo* VG_(next_seginfo) ( const DebugInfo *di );
-/* Functions for traversing all the symbols in a SegInfo. _howmany
+/* Functions for traversing all the symbols in a DebugInfo. _howmany
tells how many there are. _getidx retrieves the n'th, for n in 0
.. _howmany-1. You may not modify the function name thereby
acquired; if you want to do so, first strdup it. */
-extern Int VG_(seginfo_syms_howmany) ( const SegInfo *si );
-extern void VG_(seginfo_syms_getidx) ( const SegInfo *si,
+extern Int VG_(seginfo_syms_howmany) ( const DebugInfo *di );
+extern void VG_(seginfo_syms_getidx) ( const DebugInfo *di,
Int idx,
- /*OUT*/Addr* addr,
+ /*OUT*/Addr* avma,
/*OUT*/Addr* tocptr,
/*OUT*/UInt* size,
- /*OUT*/HChar** name );
+ /*OUT*/HChar** name,
+ /*OUT*/Bool* isText );
+/* A simple enumeration to describe the 'kind' of various kinds of
+ segments that arise from the mapping of object files. */
typedef
enum {
Vg_SectUnknown,
@@ -130,13 +150,23 @@
Vg_SectData,
Vg_SectBSS,
Vg_SectGOT,
- Vg_SectPLT
+ Vg_SectPLT,
+ Vg_SectOPD
}
VgSectKind;
-extern VgSectKind VG_(seginfo_sect_kind)(Addr);
+/* Convert a VgSectKind to a string, which must be copied if you want
+ to change it. */
+extern
+const HChar* VG_(pp_SectKind)( VgSectKind kind );
-extern Char* VG_(seginfo_sect_kind_name)(Addr a, Char* buf, UInt n_buf);
+/* Given an address 'a', make a guess of which section of which object
+ it comes from. If name is non-NULL, then the last n_name-1
+ characters of the object's name is put in name[0 .. n_name-2], and
+ name[n_name-1] is set to zero (guaranteed zero terminated). */
+extern
+VgSectKind VG_(seginfo_sect_kind)( /*OUT*/UChar* name, SizeT n_name,
+ Addr a);
#endif // __PUB_TOOL_DEBUGINFO_H