|
From: <sv...@va...> - 2006-01-18 04:23:14
|
Author: sewardj
Date: 2006-01-18 04:23:10 +0000 (Wed, 18 Jan 2006)
New Revision: 5548
Log:
Fix an all-platforms bug introduced by the recent overhaul of function
interception and wrapping. This was causing failures matching
function names in suppressions to function names in backtraces when
the latter names were Z-encoded (eg malloc), which typically caused
all leak suppressions to fail because they contain names such as
malloc, which are Z-encoded.
Modified:
trunk/coregrind/m_debuginfo/symtab.c
trunk/coregrind/m_errormgr.c
trunk/coregrind/pub_core_debuginfo.h
Modified: trunk/coregrind/m_debuginfo/symtab.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_debuginfo/symtab.c 2006-01-18 04:20:04 UTC (rev 554=
7)
+++ trunk/coregrind/m_debuginfo/symtab.c 2006-01-18 04:23:10 UTC (rev 554=
8)
@@ -2556,6 +2556,32 @@
/*show offset?*/False );
}
=20
+/* This is only available to core... don't demangle C++ names, but do
+ do Z-demangling, match anywhere in function, and don't show
+ offsets. */
+Bool VG_(get_fnname_Z_demangle_only) ( Addr a, Char* buf, Int nbuf )
+{
+# define N_TMPBUF 4096 /* arbitrary, 4096 =3D=3D ERRTXT_LEN */
+ Char tmpbuf[N_TMPBUF];
+ Bool ok;
+ vg_assert(nbuf > 0);
+ ok =3D get_fnname ( /*demangle*/False, a, tmpbuf, N_TMPBUF,
+ /*match_anywhere_in_fun*/True,=20
+ /*show offset?*/False );
+ tmpbuf[N_TMPBUF-1] =3D 0; /* paranoia */
+ if (!ok)=20
+ return False;
+ /* We have something, at least. Try to Z-demangle it. */
+ ok =3D VG_(maybe_Z_demangle)(tmpbuf, NULL, 0, buf, nbuf, NULL);
+ if (!ok) {
+ /* Didn't Z-demangle, so just return whatever we have. */
+ VG_(strncpy)(buf, tmpbuf, nbuf);
+ }
+ buf[nbuf-1] =3D 0; /* paranoia */
+ return True;
+# undef N_TMPBUF
+}
+
/* Map a code address to the name of a shared object file or the executa=
ble.
Returns False if no idea; otherwise True. Doesn't require debug info=
.
Caller supplies buf and nbuf. */
Modified: trunk/coregrind/m_errormgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_errormgr.c 2006-01-18 04:20:04 UTC (rev 5547)
+++ trunk/coregrind/m_errormgr.c 2006-01-18 04:23:10 UTC (rev 5548)
@@ -1110,8 +1110,12 @@
break;=20
=20
case FunName:=20
- // Nb: mangled names used in suppressions
- if (!VG_(get_fnname_nodemangle)(a, caller_name, ERRTXT_LEN))
+ // Nb: mangled names used in suppressions. Do, though,
+ // Z-demangle them, since otherwise it's possible to wind
+ // up comparing "malloc" in the suppression against
+ // "_vgrZU_libcZdsoZa_malloc" in the backtrace, and the
+ // two of them need to be made to match.
+ if (!VG_(get_fnname_Z_demangle_only)(a, caller_name, ERRTXT_=
LEN))
VG_(strcpy)(caller_name, "???");
break;
default: VG_(tool_panic)("supp_matches_callers");
Modified: trunk/coregrind/pub_core_debuginfo.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_debuginfo.h 2006-01-18 04:20:04 UTC (rev 554=
7)
+++ trunk/coregrind/pub_core_debuginfo.h 2006-01-18 04:23:10 UTC (rev 554=
8)
@@ -69,6 +69,12 @@
guest_code_addr. Returns 0 if not known. */
extern Addr VG_(get_tocptr) ( Addr guest_code_addr );
=20
+/* This is only available to core... don't demangle C++ names, but do
+ do Z-demangling, match anywhere in function, and don't show
+ offsets. */
+extern
+Bool VG_(get_fnname_Z_demangle_only) ( Addr a, Char* buf, Int nbuf );
+
#endif // __PUB_CORE_DEBUGINFO_H
=20
/*--------------------------------------------------------------------*/
|