From 4b4e694fefc390f19c4d9ab5ddf2ff6381c8a4f2 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Sat, 25 Jun 2005 20:22:43 +0000 Subject: [PATCH] Avoid m_redir.c importing priv_symtab.h. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4024 --- coregrind/m_debuginfo/symtab.c | 5 +++++ coregrind/m_redir.c | 11 +++++------ include/pub_tool_debuginfo.h | 1 + 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c index 3cc568bc9..b37dd2bf9 100644 --- a/coregrind/m_debuginfo/symtab.c +++ b/coregrind/m_debuginfo/symtab.c @@ -2580,6 +2580,11 @@ SizeT VG_(seginfo_size)(const SegInfo* si) return si->size; } +const UChar* VG_(seginfo_soname)(const SegInfo* si) +{ + return si->soname; +} + const UChar* VG_(seginfo_filename)(const SegInfo* si) { return si->filename; diff --git a/coregrind/m_redir.c b/coregrind/m_redir.c index 960aa7ff9..9048b2d84 100644 --- a/coregrind/m_redir.c +++ b/coregrind/m_redir.c @@ -42,7 +42,6 @@ #include "pub_core_skiplist.h" #include "pub_core_trampoline.h" #include "pub_core_transtab.h" -#include "m_debuginfo/priv_symtab.h" // XXX: bad! For SegInfo internals /*------------------------------------------------------------*/ /*--- General purpose redirection. ---*/ @@ -97,16 +96,16 @@ static SkipList sk_resolved_redir = static CodeRedirect *unresolved_redir = NULL; -static Bool match_lib(const Char *pattern, const SegInfo *si) +static Bool soname_matches(const Char *pattern, const Char* soname) { // pattern must start with "soname:" vg_assert(NULL != pattern); vg_assert(0 == VG_(strncmp)(pattern, "soname:", 7)); - if (si->soname == NULL) + if (NULL == soname) return False; - return VG_(string_match)(pattern + 7, si->soname); + return VG_(string_match)(pattern + 7, soname); } static inline Bool from_resolved(const CodeRedirect *redir) @@ -200,7 +199,7 @@ static Bool resolve_redir(CodeRedirect *redir, const SegInfo *si) vg_assert(!resolved); vg_assert(redir->from_sym != NULL); - if (match_lib(redir->from_lib, si)) { + if (soname_matches(redir->from_lib, VG_(seginfo_soname)(si))) { redir->from_addr = VG_(reverse_search_one_symtab)(si, redir->from_sym); if (VG_(clo_trace_redir) && redir->from_addr != 0) VG_(printf)(" bind FROM: %p = %s:%s\n", @@ -244,7 +243,7 @@ void VG_(resolve_seg_redirs)(SegInfo *si) if (VG_(clo_trace_redir)) VG_(printf)("Considering redirs to/from %s(soname=%s)\n", - si->filename, si->soname); + VG_(seginfo_filename)(si), VG_(seginfo_soname)(si)); /* visit each unresolved redir - if it becomes resolved, then remove it from the unresolved list */ diff --git a/include/pub_tool_debuginfo.h b/include/pub_tool_debuginfo.h index bafb59caf..acbd511e9 100644 --- a/include/pub_tool_debuginfo.h +++ b/include/pub_tool_debuginfo.h @@ -105,6 +105,7 @@ extern SegInfo* VG_(get_obj) ( Addr a ); extern const SegInfo* VG_(next_seginfo) ( const SegInfo *si ); 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 );