* corefile.c (core_create_function_syms, core_create_line_syms): Don't
authorAlan Modra <amodra@gmail.com>
Thu, 19 Apr 2007 10:46:56 +0000 (10:46 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 19 Apr 2007 10:46:56 +0000 (10:46 +0000)
set discard_underscores.
* gprof.c (discard_underscores): Delete.
* gprof.h (discard_underscores): Delete.
* sym_ids.c (match): Use bfd_get_symbol_leading_char to check for
leading underscores.
* utils.c (print_name_only): Call bfd_demangle rather than
cplus_demangle.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.

gprof/ChangeLog
gprof/Makefile.am
gprof/Makefile.in
gprof/corefile.c
gprof/gprof.c
gprof/gprof.h
gprof/sym_ids.c
gprof/utils.c

index fb5fffc..bca9591 100644 (file)
@@ -1,3 +1,16 @@
+2007-04-19  Alan Modra  <amodra@bigpond.net.au>
+
+       * corefile.c (core_create_function_syms, core_create_line_syms): Don't
+       set discard_underscores.
+       * gprof.c (discard_underscores): Delete.
+       * gprof.h (discard_underscores): Delete.
+       * sym_ids.c (match): Use bfd_get_symbol_leading_char to check for
+       leading underscores.
+       * utils.c (print_name_only): Call bfd_demangle rather than
+       cplus_demangle.
+       * Makefile.am: Run "make dep-am".
+       * Makefile.in: Regenerate.
+
 2007-04-14  Steve Ellcey  <sje@cup.hp.com>
 
        * Makefile.am: Add ACLOCAL_AMFLAGS.
index 5ebdfe3..2a6a917 100644 (file)
@@ -226,7 +226,7 @@ corefile.o: corefile.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h ../bfd/config.h \
   $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h \
   $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h \
-  source.h symtab.h corefile.h
+  source.h symtab.h hist.h corefile.h
 gmon_io.o: gmon_io.c gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
@@ -270,13 +270,13 @@ sym_ids.o: sym_ids.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
   gconfig.h search_list.h source.h symtab.h cg_arcs.h \
-  sym_ids.h
+  sym_ids.h corefile.h
 utils.o: utils.c $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
   $(INCDIR)/ansidecl.h gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
   gconfig.h search_list.h source.h symtab.h cg_arcs.h \
-  utils.h
+  utils.h corefile.h
 i386.o: i386.c gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
index 0afe7c5..a73b356 100644 (file)
@@ -958,7 +958,7 @@ corefile.o: corefile.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h ../bfd/config.h \
   $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h ../bfd/bfd.h \
   $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h gconfig.h search_list.h \
-  source.h symtab.h corefile.h
+  source.h symtab.h hist.h corefile.h
 gmon_io.o: gmon_io.c gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
@@ -1002,13 +1002,13 @@ sym_ids.o: sym_ids.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
   gconfig.h search_list.h source.h symtab.h cg_arcs.h \
-  sym_ids.h
+  sym_ids.h corefile.h
 utils.o: utils.c $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
   $(INCDIR)/ansidecl.h gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
   gconfig.h search_list.h source.h symtab.h cg_arcs.h \
-  utils.h
+  utils.h corefile.h
 i386.o: i386.c gprof.h $(BFDDIR)/sysdep.h $(INCDIR)/ansidecl.h \
   ../bfd/config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
   ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
index 7ad18f1..a078d61 100644 (file)
@@ -581,12 +581,6 @@ core_create_function_syms ()
       else
        max_vma = MAX (symtab.limit->addr, max_vma);
 
-      /* If we see "main" without an initial '_', we assume names
-        are *not* prefixed by '_'.  */
-      if (symtab.limit->name[0] == 'm' && discard_underscores
-         && strcmp (symtab.limit->name, "main") == 0)
-       discard_underscores = 0;
-
       DBG (AOUTDEBUG, printf ("[core_create_function_syms] %ld %s 0x%lx\n",
                              (long) (symtab.limit - symtab.base),
                              symtab.limit->name,
@@ -746,12 +740,6 @@ core_create_line_syms ()
 
       prev = ltab.limit;
 
-      /* If we see "main" without an initial '_', we assume names
-        are *not* prefixed by '_'.  */
-      if (ltab.limit->name[0] == 'm' && discard_underscores
-         && strcmp (ltab.limit->name, "main") == 0)
-       discard_underscores = 0;
-
       DBG (AOUTDEBUG, printf ("[core_create_line_syms] %lu %s 0x%lx\n",
                              (unsigned long) (ltab.limit - ltab.base),
                              ltab.limit->name,
index 98406e6..aca143c 100644 (file)
@@ -60,7 +60,6 @@ int output_style = 0;
 int output_width = 80;
 bfd_boolean bsd_style_output = FALSE;
 bfd_boolean demangle = TRUE;
-bfd_boolean discard_underscores = TRUE;
 bfd_boolean ignore_direct_calls = FALSE;
 bfd_boolean ignore_static_funcs = FALSE;
 bfd_boolean ignore_zeros = TRUE;
index aa873f3..4cb9e4a 100644 (file)
@@ -119,7 +119,6 @@ extern int output_style;
 extern int output_width;               /* controls column width in index */
 extern bfd_boolean bsd_style_output;   /* as opposed to FSF style output */
 extern bfd_boolean demangle;           /* demangle symbol names? */
-extern bfd_boolean discard_underscores;        /* discard leading underscores? */
 extern bfd_boolean ignore_direct_calls;        /* don't count direct calls */
 extern bfd_boolean ignore_static_funcs;        /* suppress static functions */
 extern bfd_boolean ignore_zeros;       /* ignore unused symbols/files */
index d41a716..5b8f397 100644 (file)
@@ -27,6 +27,7 @@
 #include "symtab.h"
 #include "cg_arcs.h"
 #include "sym_ids.h"
+#include "corefile.h"
 
 static struct sym_id
   {
@@ -218,12 +219,19 @@ parse_id (struct sym_id *id)
 static bfd_boolean
 match (Sym *pattern, Sym *sym)
 {
-  return (pattern->file ? pattern->file == sym->file : TRUE)
-    && (pattern->line_num ? pattern->line_num == sym->line_num : TRUE)
-    && (pattern->name
-       ? strcmp (pattern->name,
-                 sym->name+(discard_underscores && sym->name[0] == '_')) == 0
-       : TRUE);
+  if (pattern->file && pattern->file != sym->file)
+    return FALSE;
+  if (pattern->line_num && pattern->line_num != sym->line_num)
+    return FALSE;
+  if (pattern->name)
+    {
+      const char *sym_name = sym->name;
+      if (*sym_name && bfd_get_symbol_leading_char (core_bfd) == *sym_name)
+       sym_name++;
+      if (strcmp (pattern->name, sym_name) != 0)
+       return FALSE;
+    }
+  return TRUE;
 }
 
 
index 146e1f3..cf79fd6 100644 (file)
@@ -33,6 +33,7 @@
 #include "symtab.h"
 #include "cg_arcs.h"
 #include "utils.h"
+#include "corefile.h"
 
 
 /*
@@ -49,20 +50,11 @@ print_name_only (Sym *self)
 
   if (name)
     {
-      if (!bsd_style_output)
+      if (!bsd_style_output && demangle)
        {
-         if (name[0] == '_' && name[1] && discard_underscores)
-           {
-             name++;
-           }
-         if (demangle)
-           {
-             demangled = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS);
-             if (demangled)
-               {
-                 name = demangled;
-               }
-           }
+         demangled = bfd_demangle (core_bfd, name, DMGL_ANSI | DMGL_PARAMS);
+         if (demangled)
+           name = demangled;
        }
       printf ("%s", name);
       size = strlen (name);