[Patch] gprof: accept nested subprograms

Tristan Gingold gingold@adacore.com
Wed Jul 4 15:36:00 GMT 2007


Updated version (thank you for pointing out typos)

gprof/ChangeLog:
2007-07-04  Tristan Gingold  <gingold@adacore.com>

	* corefile.c (core_sym_class): Do not discard nested subprograms.


*** gprof/corefile.c    19 Apr 2007 10:46:56 -0000      1.27
--- gprof/corefile.c    4 Jul 2007 15:28:16 -0000
***************
*** 20,25 ****
--- 20,26 ----
      Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
      02110-1301, USA.  */


+ #include <ctype.h>
   #include "libiberty.h"
   #include "gprof.h"
   #include "search_list.h"
*************** core_sym_class (asymbol *sym)
*** 365,372 ****

     for (name = sym->name; *name; ++name)
       {
!       if (*name == '.' || *name == '$')
         return 0;
       }

     /* On systems where the C compiler adds an underscore to all
--- 366,381 ----

     for (name = sym->name; *name; ++name)
       {
!       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;
+       }
       }

     /* On systems where the C compiler adds an underscore to all



More information about the Binutils mailing list