Change the behaviour of VG_(get_fnname) back to what it was, viz, not
adding offsets ("+N") to the end of function names. Make a new
function VG_(get_fnname_w_offset) with that behaviour and use it for
%y in VG_(printf) et al.
This is needed so that all addresses within a function generate the
same function name. The offset'd behaviour was breaking the cache
profiler and dependent program kcachegrind.
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@1381 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/vg_mylibc.c b/coregrind/vg_mylibc.c
index 60f969f..7611892 100644
--- a/coregrind/vg_mylibc.c
+++ b/coregrind/vg_mylibc.c
@@ -601,7 +601,7 @@
if (flags & VG_MSG_PAREN)
*cp++ = '(';
- if (VG_(get_fnname)(a, cp, sizeof(buf)-2)) {
+ if (VG_(get_fnname_w_offset)(a, cp, sizeof(buf)-4)) {
if (flags & VG_MSG_PAREN) {
cp += VG_(strlen)(cp);
*cp++ = ')';
diff --git a/coregrind/vg_symtab2.c b/coregrind/vg_symtab2.c
index ba70ce4..8c149a9 100644
--- a/coregrind/vg_symtab2.c
+++ b/coregrind/vg_symtab2.c
@@ -2123,26 +2123,41 @@
return True;
}
-/* This is available to skins... always demangle C++ names */
+/* This is available to skins... always demangle C++ names,
+ match anywhere in function, but don't show offsets. */
Bool VG_(get_fnname) ( Addr a, Char* buf, Int nbuf )
{
return get_fnname ( /*demangle*/True, a, buf, nbuf,
- /*match_anywhere_in_fun*/True, True );
+ /*match_anywhere_in_fun*/True,
+ /*show offset?*/False );
}
/* This is available to skins... always demangle C++ names,
- only succeed if 'a' matches first instruction of function. */
+ match anywhere in function, and show offset if nonzero. */
+Bool VG_(get_fnname_w_offset) ( Addr a, Char* buf, Int nbuf )
+{
+ return get_fnname ( /*demangle*/True, a, buf, nbuf,
+ /*match_anywhere_in_fun*/True,
+ /*show offset?*/True );
+}
+
+/* This is available to skins... always demangle C++ names,
+ only succeed if 'a' matches first instruction of function,
+ and don't show offsets. */
Bool VG_(get_fnname_if_entry) ( Addr a, Char* buf, Int nbuf )
{
return get_fnname ( /*demangle*/True, a, buf, nbuf,
- /*match_anywhere_in_fun*/False, False );
+ /*match_anywhere_in_fun*/False,
+ /*show offset?*/False );
}
-/* This is only available to core... don't demangle C++ names */
+/* This is only available to core... don't demangle C++ names,
+ match anywhere in function, and don't show offsets. */
Bool VG_(get_fnname_nodemangle) ( Addr a, Char* buf, Int nbuf )
{
return get_fnname ( /*demangle*/False, a, buf, nbuf,
- /*match_anywhere_in_fun*/True, False );
+ /*match_anywhere_in_fun*/True,
+ /*show offset?*/False );
}
/* Map a code address to the name of a shared object file or the executable.