aboutsummaryrefslogtreecommitdiff
path: root/binutils/addr2line.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2002-07-02 04:21:25 +0000
committerAlan Modra <amodra@gmail.com>2002-07-02 04:21:25 +0000
commita6637ec0ed383a4658dfddbf625dee74af000f06 (patch)
tree2ad7332d153a8e7ab118192f27b1a9557dcad961 /binutils/addr2line.c
parent793011ca4e1df774bacdbb1bd731d77779c6d9c0 (diff)
downloadgdb-a6637ec0ed383a4658dfddbf625dee74af000f06.zip
gdb-a6637ec0ed383a4658dfddbf625dee74af000f06.tar.gz
gdb-a6637ec0ed383a4658dfddbf625dee74af000f06.tar.bz2
* budemang.c: New file, "demangle" function.
* budemang.h: New file. * addr2line.c (translate_addresses): Use "demangle". * nm.c (print_symname): Likewise. * objdump.c (objdump_print_symname): Likewise. (dump_symbols): Likewise. Also, don't use bfd_asymbol_name macro here since that obfuscates. * rdcoff.c: Don't #include demangle.h. * Makefile.am (CFILES): Add budemang.c, emul_aix.c, emul_vanilla.c. Remove emul_$(EMULATION).c. Sort. (HFILES): Add budemang.h. Sort. (nm_new_SOURCES, objdump_SOURCES, addr2line_SOURCES): Add budemang.c. Run "make dep-am". * Makefile.in: Regenerate. * po/POTFILES.in: Regenerate.
Diffstat (limited to 'binutils/addr2line.c')
-rw-r--r--binutils/addr2line.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/binutils/addr2line.c b/binutils/addr2line.c
index fae7edd..2d9dc90 100644
--- a/binutils/addr2line.c
+++ b/binutils/addr2line.c
@@ -35,6 +35,7 @@
#include "libiberty.h"
#include "demangle.h"
#include "bucomm.h"
+#include "budemang.h"
static boolean with_functions; /* -f, show function names. */
static boolean do_demangle; /* -C, demangle names. */
@@ -191,23 +192,22 @@ translate_addresses (abfd)
{
if (with_functions)
{
- if (functionname == NULL || *functionname == '\0')
- printf ("??\n");
- else if (! do_demangle)
- printf ("%s\n", functionname);
- else
+ const char *name;
+ char *alloc = NULL;
+
+ name = functionname;
+ if (name == NULL || *name == '\0')
+ name = "??";
+ else if (do_demangle)
{
- char *res;
-
- res = cplus_demangle (functionname, DMGL_ANSI | DMGL_PARAMS);
- if (res == NULL)
- printf ("%s\n", functionname);
- else
- {
- printf ("%s\n", res);
- free (res);
- }
+ alloc = demangle (abfd, name);
+ name = alloc;
}
+
+ printf ("%s\n", name);
+
+ if (alloc != NULL)
+ free (alloc);
}
if (base_names && filename != NULL)