gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / gprof / utils.c
index 0f54a61fd11b5cba906c1626344c29d7ae0c49a0..76bc57d31831994d696795b58cf5fb8e1cce51b3 100644 (file)
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  */
-#include "demangle.h"
 #include "gprof.h"
+#include "demangle.h"
 #include "search_list.h"
 #include "source.h"
 #include "symtab.h"
 #include "cg_arcs.h"
 #include "utils.h"
+#include "corefile.h"
 
 
 /*
  * Print name of symbol.  Return number of characters printed.
  */
 int
-print_name_only (self)
-     Sym *self;
+print_name_only (Sym *self)
 {
   const char *name = self->name;
   const char *filename;
@@ -50,24 +50,15 @@ print_name_only (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);
-      if (line_granularity && self->file)
+      if ((line_granularity || inline_file_names) && self->file)
        {
          filename = self->file->name;
          if (!print_path)
@@ -82,15 +73,19 @@ print_name_only (self)
                  filename = self->file->name;
                }
            }
-         sprintf (buf, " (%s:%d @ %lx)", filename, self->line_num,
-                  (unsigned long) self->addr);
+         if (line_granularity)
+           {
+             sprintf (buf, " (%s:%d @ %lx)", filename, self->line_num,
+                      (unsigned long) self->addr);
+           }
+         else
+           {
+             sprintf (buf, " (%s:%d)", filename, self->line_num);
+           }
          printf ("%s", buf);
          size += strlen (buf);
        }
-      if (demangled)
-       {
-         free (demangled);
-       }
+      free (demangled);
       DBG (DFNDEBUG, printf ("{%d} ", self->cg.top_order));
       DBG (PROPDEBUG, printf ("%4.0f%% ", 100.0 * self->cg.prop.fract));
     }
@@ -99,8 +94,7 @@ print_name_only (self)
 
 
 void
-print_name (self)
-     Sym *self;
+print_name (Sym *self)
 {
   print_name_only (self);
 
This page took 0.025943 seconds and 4 git commands to generate.