Fix two bugs:
(1) In r14664 VG_(get_fnname_if_entry) was changed to always
    return a function name, even if that function was *not* an
    entry. That broke callgrind and was also confusing because
    it contradicts what "get_fnname_if_entry" suggests.
(2) In r14189 a function call was removed because it was considered
    redundant which it was not.

Both bugs were hunted down by Joseph Weidendorfer.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@15003 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/coregrind/m_debuginfo/debuginfo.c b/coregrind/m_debuginfo/debuginfo.c
index 5d235ac..14d5e60 100644
--- a/coregrind/m_debuginfo/debuginfo.c
+++ b/coregrind/m_debuginfo/debuginfo.c
@@ -1724,7 +1724,7 @@
 
 /* The whole point of this whole big deal: map a code address to a
    plausible symbol name.  Returns False if no idea; otherwise True.
-   Caller supplies buf and nbuf.  If do_cxx_demangling is False, don't do
+   Caller supplies buf.  If do_cxx_demangling is False, don't do
    C++ demangling, regardless of VG_(clo_demangle) -- probably because the
    call has come from VG_(get_fnname_raw)().  findText
    indicates whether we're looking for a text symbol or a data symbol
@@ -1850,13 +1850,19 @@
    of the return string at function get_sym_name */
 Bool VG_(get_fnname_if_entry) ( Addr a, const HChar** buf )
 {
-   return get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True,
+   const HChar *tmp;
+   Bool res;
+
+   res =  get_sym_name ( /*C++-demangle*/True, /*Z-demangle*/True,
                          /*below-main-renaming*/True,
-                         a, buf,
+                         a, &tmp,
                          /*match_anywhere_in_fun*/False, 
                          /*show offset?*/False,
                          /*text syms only*/True,
                          /*offsetP*/NULL );
+   if (res)
+      *buf = tmp;
+   return res;
 }
 
 /* This is only available to core... don't C++-demangle, don't Z-demangle,
diff --git a/exp-bbv/bbv_main.c b/exp-bbv/bbv_main.c
index d7008c1..db7835f 100644
--- a/exp-bbv/bbv_main.c
+++ b/exp-bbv/bbv_main.c
@@ -392,6 +392,7 @@
       block_num++;
          /* get function name and entry point information */
       const HChar *fn_name;
+      VG_(get_fnname)(origAddr, &fn_name);
       bbInfo->is_entry=VG_(get_fnname_if_entry)(origAddr, &fn_name);
       bbInfo->fn_name =VG_(strdup)("bbv_strings", fn_name);
          /* insert structure into table */