Avoid m_redir.c importing priv_symtab.h.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@4024 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/symtab.c b/coregrind/m_debuginfo/symtab.c
index 3cc568b..b37dd2b 100644
--- a/coregrind/m_debuginfo/symtab.c
+++ b/coregrind/m_debuginfo/symtab.c
@@ -2580,6 +2580,11 @@
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 960aa7f..9048b2d 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 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 @@
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 @@
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 bafb59c..acbd511 100644
--- a/include/pub_tool_debuginfo.h
+++ b/include/pub_tool_debuginfo.h
@@ -105,6 +105,7 @@
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 );