From: Nicholas Nethercote Date: Tue, 28 Jan 2003 20:40:57 +0000 (+0000) Subject: Added VG_(get_obj)(). X-Git-Tag: svn/VALGRIND_1_9_4~41 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b1bf3397b17b143d012e3aea0530a69a48ea4e04;p=thirdparty%2Fvalgrind.git Added VG_(get_obj)(). Also added declaration for VG_(get_error_where)() to vg_skin.h (which should have been included with the last commit). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1407 --- diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c index 8c149a9107..c36d32b258 100644 --- a/coregrind/vg_symtab2.c +++ b/coregrind/vg_symtab2.c @@ -2177,6 +2177,21 @@ Bool VG_(get_objname) ( Addr a, Char* buf, Int nbuf ) return False; } +/* Map a code address to its SegInfo. Returns NULL if not found. Doesn't + require debug info. */ +SegInfo* VG_(get_obj) ( Addr a ) +{ + SegInfo* si; + + ensure_debug_info_inited(); + for (si = segInfo; si != NULL; si = si->next) { + if (si->start <= a && a < si->start+si->size) { + return si; + } + } + return False; +} + /* Map a code address to a filename. Returns True if successful. */ Bool VG_(get_filename)( Addr a, Char* filename, Int n_filename ) diff --git a/include/vg_skin.h b/include/vg_skin.h index 4a19b5ab27..3958de9819 100644 --- a/include/vg_skin.h +++ b/include/vg_skin.h @@ -1062,10 +1062,11 @@ typedef Error; /* Useful in SK_(error_matches_suppression)(), SK_(pp_SkinError)(), etc */ -SuppKind VG_(get_error_kind) ( Error* err ); -Addr VG_(get_error_address) ( Error* err ); -Char* VG_(get_error_string) ( Error* err ); -void* VG_(get_error_extra) ( Error* err ); +ExeContext* VG_(get_error_where) ( Error* err ); +SuppKind VG_(get_error_kind) ( Error* err ); +Addr VG_(get_error_address) ( Error* err ); +Char* VG_(get_error_string) ( Error* err ); +void* VG_(get_error_extra) ( Error* err ); /* Call this when an error occurs. It will be recorded if it hasn't been seen before. If it has, the existing error record will have its count @@ -1129,11 +1130,15 @@ extern Bool VG_(get_objname) ( Addr a, Char* objname, Int n_objname ); /* A way to get information about what segments are mapped */ typedef struct _SegInfo SegInfo; -extern const SegInfo* VG_(next_seginfo)(const SegInfo *); -extern Addr VG_(seg_start)(const SegInfo *); -extern UInt VG_(seg_size)(const SegInfo *); -extern const UChar* VG_(seg_filename)(const SegInfo *); -extern UInt VG_(seg_sym_offset)(const SegInfo *); +/* Returns NULL if the SegInfo isn't found. It doesn't matter if debug info + is present or not. */ +extern SegInfo* VG_(get_obj) ( Addr a ); + +extern const SegInfo* VG_(next_seginfo) ( const SegInfo *seg ); +extern Addr VG_(seg_start) ( const SegInfo *seg ); +extern UInt VG_(seg_size) ( const SegInfo *seg ); +extern const UChar* VG_(seg_filename) ( const SegInfo *seg ); +extern UInt VG_(seg_sym_offset)( const SegInfo *seg ); typedef enum {