Hi David,
Here is a patch to correct a previous gprof bug that was only partially
fixed. Apparently it is possible for GCC to clone its own cloned
functions.
Thanks for submitting this patch. I have tidied it up slightly and
applied it to the sources along with this changelog entry.
Cheers
Nick
gprof/ChangeLog
2011-06-07 David Warme <[email protected]>
* corefile.c (core_sym_class): Allow for multiple iterations of
clone clones and subprograms.
Index: gprof/corefile.c
===================================================================
RCS file: /cvs/src/src/gprof/corefile.c,v
retrieving revision 1.42
diff -u -3 -p -r1.42 corefile.c
--- gprof/corefile.c 28 Feb 2011 18:36:14 -0000 1.42
+++ gprof/corefile.c 7 Jun 2011 13:33:05 -0000
@@ -387,19 +387,27 @@ core_sym_class (asymbol *sym)
if (*name == '$')
return 0;
- if (*name == '.')
+ while (*name == '.')
{
- /* Allow GCC cloned functions. */
- if (strlen (name) > 7 && strncmp (name, ".clone.", 7) == 0)
- name += 6;
+ /* Allow both nested subprograms (which end with ".NNN", where N is
+ a digit) and GCC cloned functions (which contain ".clone").
+ Allow for multiple iterations of both - apparently GCC can clone
+ clones and subprograms. */
+ int digit_seen = 0;
+#define CLONE_NAME ".clone."
+#define CLONE_NAME_LEN strlen (CLONE_NAME)
+
+ if (strlen (name) > CLONE_NAME_LEN
+ && strncmp (name, CLONE_NAME, CLONE_NAME_LEN) == 0)
+ name += CLONE_NAME_LEN - 1;
- /* Do not discard nested subprograms (those
- which end with .NNN, where N are digits). */
for (name++; *name; name++)
- if (! ISDIGIT (*name))
+ if (digit_seen && *name == '.')
+ break;
+ else if (ISDIGIT (*name))
+ digit_seen = 1;
+ else
return 0;
-
- break;
}
}
_______________________________________________
bug-binutils mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-binutils