From 837cc4db6c00a7e076443df7947d898570c79ea9 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 20 Sep 2012 13:15:48 +0000 Subject: * corefile.c (core_sym_class): Allow for ".constprop.N" cloned functions. --- gprof/ChangeLog | 5 +++++ gprof/corefile.c | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'gprof') diff --git a/gprof/ChangeLog b/gprof/ChangeLog index 26fc2331f9..67a724c6f9 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,8 @@ +2012-09-20 Joe Seymour + + * corefile.c (core_sym_class): Allow for ".constprop.N" cloned + functions. + 2012-09-14 David Edelsohn * configure: Regenerate. diff --git a/gprof/corefile.c b/gprof/corefile.c index 9f93ceeab3..985ea2684c 100644 --- a/gprof/corefile.c +++ b/gprof/corefile.c @@ -1,7 +1,7 @@ /* corefile.c Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, - 2010, 2011 Free Software Foundation, Inc. + 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -68,7 +68,7 @@ parse_error (const char *filename) static int cmp_symbol_map (const void * l, const void * r) { - return strcmp (((struct function_map *) l)->function_name, + return strcmp (((struct function_map *) l)->function_name, ((struct function_map *) r)->function_name); } @@ -394,13 +394,19 @@ core_sym_class (asymbol *sym) 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) - +#define CLONE_NAME ".clone." +#define CLONE_NAME_LEN strlen (CLONE_NAME) +#define CONSTPROP_NAME ".constprop." +#define CONSTPROP_NAME_LEN strlen (CONSTPROP_NAME) + if (strlen (name) > CLONE_NAME_LEN && strncmp (name, CLONE_NAME, CLONE_NAME_LEN) == 0) name += CLONE_NAME_LEN - 1; + else if (strlen (name) > CONSTPROP_NAME_LEN + && strncmp (name, CONSTPROP_NAME, CONSTPROP_NAME_LEN) == 0) + name += CONSTPROP_NAME_LEN - 1; + for (name++; *name; name++) if (digit_seen && *name == '.') break; @@ -470,7 +476,7 @@ get_src_info (bfd_vma addr, const char **filename, const char **name, int *line_ /* Return number of symbols in a symbol-table file. */ -static int +static int num_of_syms_in (FILE * f) { const int BUFSIZE = 1024; @@ -479,7 +485,7 @@ num_of_syms_in (FILE * f) char type; char * name = (char *) xmalloc (BUFSIZE); int num = 0; - + while (!feof (f) && fgets (buf, BUFSIZE - 1, f)) { if (sscanf (buf, "%s %c %s", address, &type, name) == 3) -- cgit v1.2.1