X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gprof%2Futils.c;h=76bc57d31831994d696795b58cf5fb8e1cce51b3;hb=87f83f20023bf366c14ec4e0fd307948d96caaee;hp=0f54a61fd11b5cba906c1626344c29d7ae0c49a0;hpb=5ec4a8f31301e303c88a997205069237b9bbe29e;p=deliverable%2Fbinutils-gdb.git diff --git a/gprof/utils.c b/gprof/utils.c index 0f54a61fd1..76bc57d318 100644 --- a/gprof/utils.c +++ b/gprof/utils.c @@ -26,21 +26,21 @@ * 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);