* [patch] gprof corefile.c incorrectly handles .NNN functions
@ 2010-07-15 13:31 James Blackburn
2010-07-16 14:53 ` Nick Clifton
0 siblings, 1 reply; 2+ messages in thread
From: James Blackburn @ 2010-07-15 13:31 UTC (permalink / raw)
To: binutils
Hi,
We just pulled a patch to corefile.c for supporting 'nested subprograms'. It looks like a bug was introduced in corefile.c 1.28. There is no 'break;' after the nested for loop used to check for .NNN. This means if a function name matches <foo>.NNN, name is incremented pass the null-character and the loop iterates over other contents of the sym struct.
I've also added a check for *.clone.NNN which is present using link time optimisation with recent GCCs.
Cheers,
James
### Eclipse Workspace Patch 1.0
#P gprof
Index: corefile.c
===================================================================
RCS file: /cvs/src/src/gprof/corefile.c,v
retrieving revision 1.39
diff -u -r1.39 corefile.c
--- corefile.c 27 Apr 2010 14:46:09 -0000 1.39
+++ corefile.c 15 Jul 2010 13:29:20 -0000
@@ -385,12 +385,19 @@
if (*name == '$')
return 0;
- /* Do not discard nested subprograms (those
- which end with .NNN, where N are digits). */
if (*name == '.')
- for (name++; *name; name++)
- if (! ISDIGIT (*name))
- return 0;
+ {
+ /* allow GCC cloned functions */
+ if (strlen(name) > 7 && strncmp(name, ".clone.", 7) == 0)
+ name += 6;
+
+ /* Do not discard nested subprograms (those
+ which end with .NNN, where N are digits). */
+ for (name++; *name; name++)
+ if (! ISDIGIT (*name))
+ return 0;
+ break;
+ }
}
/* On systems where the C compiler adds an underscore to all
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [patch] gprof corefile.c incorrectly handles .NNN functions
2010-07-15 13:31 [patch] gprof corefile.c incorrectly handles .NNN functions James Blackburn
@ 2010-07-16 14:53 ` Nick Clifton
0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2010-07-16 14:53 UTC (permalink / raw)
To: James Blackburn; +Cc: binutils
Hi James,
> We just pulled a patch to corefile.c for supporting 'nested subprograms'.
> I've also added a check for *.clone.NNN which is present using link time optimisation with recent GCCs.
Thanks - I have checked the patch in along with this changelog entry.
Cheers
Nick
gprof/ChangeLog
2010-07-16 James Blackburn <james.blackburn@broadcom.com>
* corefile.c (core_sym_class): Fix handling of subprogram names
and add support for cloned function names.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-07-16 14:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-15 13:31 [patch] gprof corefile.c incorrectly handles .NNN functions James Blackburn
2010-07-16 14:53 ` Nick Clifton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).