diff options
author | Alan Modra <amodra@gmail.com> | 2002-07-02 04:21:25 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2002-07-02 04:21:25 +0000 |
commit | a6637ec0ed383a4658dfddbf625dee74af000f06 (patch) | |
tree | 2ad7332d153a8e7ab118192f27b1a9557dcad961 /binutils/nm.c | |
parent | 793011ca4e1df774bacdbb1bd731d77779c6d9c0 (diff) | |
download | fsf-binutils-gdb-a6637ec0ed383a4658dfddbf625dee74af000f06.zip fsf-binutils-gdb-a6637ec0ed383a4658dfddbf625dee74af000f06.tar.gz fsf-binutils-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/nm.c')
-rw-r--r-- | binutils/nm.c | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/binutils/nm.c b/binutils/nm.c index f97732e..b9689b1 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -23,6 +23,7 @@ #include "bfd.h" #include "progress.h" #include "bucomm.h" +#include "budemang.h" #include "getopt.h" #include "aout/stab_gnu.h" #include "aout/ranlib.h" @@ -1085,43 +1086,11 @@ print_symname (format, name, abfd) { if (do_demangle && *name) { - char *res; - const char *p; - - /* In this mode, give a user-level view of the symbol name - even if it's not mangled; strip off any leading - underscore. */ - if (bfd_get_symbol_leading_char (abfd) == name[0]) - name++; - - /* This is a hack for XCOFF, PowerPC64-ELF or the MS PE format. - These formats have a number of leading '.'s on at least some - symbols, so we remove all dots to avoid confusing the - demangler. */ - p = name; - while (*p == '.') - ++p; - - res = cplus_demangle (p, DMGL_ANSI | DMGL_PARAMS); - if (res) - { - size_t dots = p - name; - - /* Now put back any stripped dots. */ - if (dots != 0) - { - size_t len = strlen (res) + 1; - char *add_dots = xmalloc (len + dots); + char *res = demangle (abfd, name); - memcpy (add_dots, name, dots); - memcpy (add_dots + dots, res, len); - free (res); - res = add_dots; - } - printf (format, res); - free (res); - return; - } + printf (format, res); + free (res); + return; } printf (format, name); |