This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
wrapper for demangler
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: binutils at sourceware dot org
- Date: Thu, 19 Apr 2007 20:19:08 +0930
- Subject: wrapper for demangler
This patch merges the two cplus_demangle wrappers we have, one in ld/,
the other in binutils/, into a new bfd_demangle function. Then make
use of the wrapper in gprof to simplify handling of symbol name
leading underscores, and to fix gprof demangling on powerpc64.
bfd/
* bfd.c (bfd_demangle): New function.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
* bfd-in2.h: Regenerate.
binutils/
* budemang.c: Delete.
* budemang.h: Delete.
* addr2line.c (translate_addresses): Call bfd_demangle rather than
demangle.
* nm.c (print_symname): Likewise.
* objdump.c (objdump_print_symname, dump_symbols): Likewise.
(dump_bfd): Likewise.
* prdbg.c (struct pr_handle <demangler>): Add int param.
(tg_variable, tg_start_function): Adjust demangler calls.
* Makefile.am: Remove mention of budemang.[ch]. Run "make dep-am".
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
gprof/
* 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.
ld/
* ldcref.c (cref_fill_array): Call bfd_demangle rather than demangle.
* ldlang.c (lang_one_common): Likewise.
* ldmisc.c (vfinfo): Likewise.
(demangle): Delete.
* ldmisc.h (demangle): Delete.
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
opcodes/
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
* po/POTFILES.in: Regenerate.
gas/
* Makefile.am: Run "make dep-am".
* Makefile.in: Regenerate.
Index: bfd/bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.91
diff -u -p -r1.91 bfd.c
--- bfd/bfd.c 2 Apr 2007 16:51:13 -0000 1.91
+++ bfd/bfd.c 19 Apr 2007 07:16:25 -0000
@@ -207,6 +207,7 @@ CODE_FRAGMENT
#include "sysdep.h"
#include <stdarg.h>
#include "libiberty.h"
+#include "demangle.h"
#include "safe-ctype.h"
#include "bfdlink.h"
#include "libbfd.h"
@@ -1702,3 +1703,85 @@ bfd_emul_set_commonpagesize (const char
offsetof (struct elf_backend_data,
commonpagesize), target);
}
+
+/*
+FUNCTION
+ bfd_demangle
+
+SYNOPSIS
+ char *bfd_demangle (bfd *, const char *, int);
+
+DESCRIPTION
+ Wrapper around cplus_demangle. Strips leading underscores and
+ other such chars that would otherwise confuse the demangler.
+ If passed a g++ v3 ABI mangled name, returns a buffer allocated
+ with malloc holding the demangled name. Returns NULL otherwise
+ and on memory alloc failure.
+*/
+
+char *
+bfd_demangle (bfd *abfd, const char *name, int options)
+{
+ char *res, *alloc;
+ const char *pre, *suf;
+ size_t pre_len;
+
+ if (abfd != NULL
+ && *name != '\0'
+ && bfd_get_symbol_leading_char (abfd) == *name)
+ ++name;
+
+ /* This is a hack for better error reporting on 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. */
+ pre = name;
+ while (*name == '.' || *name == '$')
+ ++name;
+ pre_len = name - pre;
+
+ /* Strip off @plt and suchlike too. */
+ alloc = NULL;
+ suf = strchr (name, '@');
+ if (suf != NULL)
+ {
+ alloc = bfd_malloc (suf - name + 1);
+ if (alloc == NULL)
+ return NULL;
+ memcpy (alloc, name, suf - name);
+ alloc[suf - name] = '\0';
+ name = alloc;
+ }
+
+ res = cplus_demangle (name, options);
+
+ if (alloc != NULL)
+ free (alloc);
+
+ if (res == NULL)
+ return NULL;
+
+ /* Put back any prefix or suffix. */
+ if (pre_len != 0 || suf != NULL)
+ {
+ size_t len;
+ size_t suf_len;
+ char *final;
+
+ len = strlen (res);
+ if (suf == NULL)
+ suf = res + len;
+ suf_len = strlen (suf) + 1;
+ final = bfd_malloc (pre_len + len + suf_len);
+ if (final == NULL)
+ return NULL;
+
+ memcpy (final, pre, pre_len);
+ memcpy (final + pre_len, res, len);
+ memcpy (final + pre_len + len, suf, suf_len);
+ free (res);
+ res = final;
+ }
+
+ return res;
+}
Index: binutils/Makefile.am
===================================================================
RCS file: /cvs/src/src/binutils/Makefile.am,v
retrieving revision 1.88
diff -u -p -r1.88 Makefile.am
--- binutils/Makefile.am 14 Apr 2007 20:38:13 -0000 1.88
+++ binutils/Makefile.am 19 Apr 2007 05:41:01 -0000
@@ -77,14 +77,14 @@ INCLUDES = -D_GNU_SOURCE \
-Dbin_dummy_emulation=$(EMULATION_VECTOR)
HFILES = \
- arsup.h binemul.h bucomm.h budbg.h budemang.h \
+ arsup.h binemul.h bucomm.h budbg.h \
coffgrok.h debug.h dlltool.h nlmconv.h \
windres.h winduni.h
GENERATED_HFILES = arparse.h sysroff.h sysinfo.h defparse.h rcparse.h
CFILES = \
- addr2line.c ar.c arsup.c bin2c.c binemul.c bucomm.c budemang.c \
+ addr2line.c ar.c arsup.c bin2c.c binemul.c bucomm.c \
coffdump.c coffgrok.c cxxfilt.c \
dwarf.c debug.c dlltool.c dllwrap.c \
emul_aix.c emul_vanilla.c filemode.c \
@@ -214,9 +214,9 @@ readelf_LDADD = $(LIBINTL) $(LIBIBERTY
strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS)
-nm_new_SOURCES = nm.c budemang.c $(BULIBS)
+nm_new_SOURCES = nm.c $(BULIBS)
-objdump_SOURCES = objdump.c dwarf.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS)
+objdump_SOURCES = objdump.c dwarf.c prdbg.c $(DEBUG_SRCS) $(BULIBS)
objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(LIBINTL)
objdump.o:objdump.c
@@ -232,7 +232,7 @@ ranlib_SOURCES = ar.c is-ranlib.c arpars
binemul.c emul_$(EMULATION).c $(BULIBS)
ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(LIBINTL)
-addr2line_SOURCES = addr2line.c budemang.c $(BULIBS)
+addr2line_SOURCES = addr2line.c $(BULIBS)
# The following is commented out for the conversion to automake.
# This rule creates a single binary that switches between ar and ranlib
@@ -433,87 +433,85 @@ install-exec-local: install-binPROGRAMS
addr2line.o: addr2line.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \
$(INCDIR)/ansidecl.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
- bucomm.h $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h \
- budemang.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h $(INCDIR)/fopen-same.h
ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/progress.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h \
- arsup.h $(INCDIR)/filenames.h binemul.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/aout/ar.h $(BFDDIR)/libbfd.h \
+ $(INCDIR)/hashtab.h arsup.h $(INCDIR)/filenames.h binemul.h
arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/filenames.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h
bin2c.o: bin2c.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h
binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h
bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/libiberty.h \
- $(INCDIR)/ansidecl.h bucomm.h $(INCDIR)/ansidecl.h \
- config.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h \
- $(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h
-budemang.o: budemang.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/demangle.h $(INCDIR)/libiberty.h budemang.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h $(BFDDIR)/libbfd.h \
+ $(INCDIR)/hashtab.h
coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- coffgrok.h bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h
+ coffgrok.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h
coffgrok.o: coffgrok.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
- coffgrok.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
+ $(INCDIR)/bfdlink.h coffgrok.h
cxxfilt.o: cxxfilt.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h \
- $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h
dwarf.o: dwarf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h bucomm.h \
- $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
+ $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h
debug.o: debug.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- debug.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h debug.h
dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/dyn-string.h \
- dlltool.h $(INCDIR)/safe-ctype.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/dyn-string.h dlltool.h $(INCDIR)/safe-ctype.h
dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/dyn-string.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h
emul_aix.o: emul_aix.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
- $(INCDIR)/coff/xcoff.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h \
- $(BFDDIR)/libxcoff.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h \
+ $(INCDIR)/coff/internal.h $(INCDIR)/coff/xcoff.h $(BFDDIR)/libcoff.h \
+ $(INCDIR)/bfdlink.h $(BFDDIR)/libxcoff.h
emul_vanilla.o: emul_vanilla.c binemul.h ../bfd/bfd.h \
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h \
- config.h $(INCDIR)/fopen-same.h
+ ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h
filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h
ieee.o: ieee.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
- $(INCDIR)/ieee.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- debug.h budbg.h $(INCDIR)/filenames.h
+ $(INCDIR)/ieee.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h debug.h budbg.h $(INCDIR)/filenames.h
is-ranlib.o: is-ranlib.c
is-strip.o: is-strip.c
maybe-ranlib.o: maybe-ranlib.c
maybe-strip.o: maybe-strip.c
nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/safe-ctype.h $(BFDDIR)/libnlm.h $(INCDIR)/nlm/common.h \
- $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h nlmconv.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h $(BFDDIR)/libnlm.h \
+ $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h $(INCDIR)/nlm/external.h \
+ nlmconv.h
nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
$(INCDIR)/progress.h bucomm.h $(INCDIR)/ansidecl.h \
- config.h $(INCDIR)/fopen-same.h budemang.h $(INCDIR)/aout/stab_gnu.h \
+ ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/aout/stab_gnu.h \
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h \
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
@@ -522,31 +520,32 @@ not-ranlib.o: not-ranlib.c
not-strip.o: not-strip.c
objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h $(INCDIR)/ansidecl.h \
- config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
$(INCDIR)/ansidecl.h budbg.h $(INCDIR)/filenames.h \
$(INCDIR)/fnmatch.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
$(BFDDIR)/libbfd.h $(INCDIR)/hashtab.h
objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h ../bfd/bfdver.h $(INCDIR)/progress.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- dwarf.h $(INCDIR)/elf/dwarf2.h budemang.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/dis-asm.h ../bfd/bfd.h $(INCDIR)/libiberty.h \
- $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
- debug.h budbg.h $(INCDIR)/aout/aout64.h
+ $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h $(INCDIR)/ansidecl.h \
+ ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h dwarf.h \
+ $(INCDIR)/elf/dwarf2.h $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h \
+ ../bfd/bfd.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h debug.h \
+ budbg.h $(INCDIR)/aout/aout64.h
prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
debug.h budbg.h
rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/coff/internal.h bucomm.h \
- $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
+ $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h debug.h \
budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
rddbg.o: rddbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- debug.h budbg.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h debug.h budbg.h
readelf.o: readelf.c dwarf.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/common.h \
$(INCDIR)/elf/external.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/h8.h \
@@ -566,89 +565,95 @@ readelf.o: readelf.c dwarf.h ../bfd/bfd.
$(INCDIR)/elf/score.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/sparc.h \
$(INCDIR)/elf/spu.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/vax.h \
$(INCDIR)/elf/x86-64.h $(INCDIR)/elf/xstormy16.h $(INCDIR)/elf/xtensa.h \
- $(INCDIR)/aout/ar.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- unwind-ia64.h
+ $(INCDIR)/aout/ar.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h unwind-ia64.h
rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h
resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- windres.h winduni.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h windres.h winduni.h
rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- windres.h winduni.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
- $(INCDIR)/bfdlink.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h windres.h winduni.h $(INCDIR)/coff/internal.h \
+ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h
resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/safe-ctype.h windres.h winduni.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h windres.h \
+ winduni.h
resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- windres.h winduni.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h windres.h winduni.h
size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h
srconv.o: srconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h sysroff.h coffgrok.h $(INCDIR)/libiberty.h \
- $(INCDIR)/ansidecl.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \
- $(INCDIR)/bfdlink.h sysroff.c
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h sysroff.h coffgrok.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/coff/internal.h \
+ $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h sysroff.c
stabs.o: stabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/safe-ctype.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \
- debug.h budbg.h $(INCDIR)/filenames.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h $(INCDIR)/demangle.h \
+ $(INCDIR)/libiberty.h debug.h budbg.h $(INCDIR)/filenames.h \
+ $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
strings.o: strings.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h $(INCDIR)/ansidecl.h \
- config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ ../bfd/bfdver.h config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
$(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h
sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h $(INCDIR)/libiberty.h \
- $(INCDIR)/ansidecl.h sysroff.h sysroff.c $(INCDIR)/ansidecl.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \
+ $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h sysroff.h \
+ sysroff.c $(INCDIR)/ansidecl.h
version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h ../bfd/bfdver.h bucomm.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
config.h $(INCDIR)/fopen-same.h
windres.o: windres.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
- $(INCDIR)/obstack.h windres.h winduni.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \
+ winduni.h
winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h
wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/safe-ctype.h debug.h budbg.h $(INCDIR)/aout/aout64.h \
- $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h debug.h \
+ budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
+ $(INCDIR)/aout/stab.def
arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h arsup.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h arsup.h
arlex.o: arlex.c $(INCDIR)/ansidecl.h $(INCDIR)/libiberty.h \
$(INCDIR)/ansidecl.h arparse.h
sysroff.o: sysroff.c
sysinfo.o: sysinfo.c
syslex.o: syslex.c config.h sysinfo.h
defparse.o: defparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h dlltool.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h dlltool.h
deflex.o: deflex.c $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
defparse.h dlltool.h $(INCDIR)/ansidecl.h
nlmheader.o: nlmheader.c $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
- bucomm.h $(INCDIR)/ansidecl.h config.h $(INCDIR)/fopen-same.h \
- $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h nlmconv.h
+ bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h config.h \
+ $(INCDIR)/fopen-same.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
+ nlmconv.h
rcparse.o: rcparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- windres.h winduni.h $(INCDIR)/safe-ctype.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h windres.h winduni.h $(INCDIR)/safe-ctype.h
rclex.o: rclex.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h config.h \
- $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/safe-ctype.h windres.h winduni.h rcparse.h
+ $(INCDIR)/symcat.h bucomm.h $(INCDIR)/ansidecl.h ../bfd/bfdver.h \
+ config.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \
+ $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h windres.h \
+ winduni.h rcparse.h
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
Index: binutils/addr2line.c
===================================================================
RCS file: /cvs/src/src/binutils/addr2line.c,v
retrieving revision 1.29
diff -u -p -r1.29 addr2line.c
--- binutils/addr2line.c 17 Feb 2007 13:33:53 -0000 1.29
+++ binutils/addr2line.c 19 Apr 2007 05:41:02 -0000
@@ -37,7 +37,6 @@
#include "libiberty.h"
#include "demangle.h"
#include "bucomm.h"
-#include "budemang.h"
static bfd_boolean unwind_inlines; /* -i, unwind inlined functions. */
static bfd_boolean with_functions; /* -f, show function names. */
@@ -224,8 +223,9 @@ translate_addresses (bfd *abfd, asection
name = "??";
else if (do_demangle)
{
- alloc = demangle (abfd, name);
- name = alloc;
+ alloc = bfd_demangle (abfd, name, DMGL_ANSI | DMGL_PARAMS);
+ if (alloc != NULL)
+ name = alloc;
}
printf ("%s\n", name);
Index: binutils/nm.c
===================================================================
RCS file: /cvs/src/src/binutils/nm.c,v
retrieving revision 1.51
diff -u -p -r1.51 nm.c
--- binutils/nm.c 5 Apr 2007 06:36:35 -0000 1.51
+++ binutils/nm.c 19 Apr 2007 05:41:04 -0000
@@ -23,7 +23,6 @@
#include "bfd.h"
#include "progress.h"
#include "bucomm.h"
-#include "budemang.h"
#include "getopt.h"
#include "aout/stab_gnu.h"
#include "aout/ranlib.h"
@@ -335,11 +334,14 @@ print_symname (const char *format, const
{
if (do_demangle && *name)
{
- char *res = demangle (abfd, name);
+ char *res = bfd_demangle (abfd, name, DMGL_ANSI | DMGL_PARAMS);
- printf (format, res);
- free (res);
- return;
+ if (res != NULL)
+ {
+ printf (format, res);
+ free (res);
+ return;
+ }
}
printf (format, name);
Index: binutils/objdump.c
===================================================================
RCS file: /cvs/src/src/binutils/objdump.c,v
retrieving revision 1.123
diff -u -p -r1.123 objdump.c
--- binutils/objdump.c 15 Mar 2007 14:17:16 -0000 1.123
+++ binutils/objdump.c 19 Apr 2007 05:41:06 -0000
@@ -52,7 +52,6 @@
#include "progress.h"
#include "bucomm.h"
#include "dwarf.h"
-#include "budemang.h"
#include "getopt.h"
#include "safe-ctype.h"
#include "dis-asm.h"
@@ -649,8 +648,9 @@ objdump_print_symname (bfd *abfd, struct
if (do_demangle && name[0] != '\0')
{
/* Demangle the name. */
- alloc = demangle (abfd, name);
- name = alloc;
+ alloc = bfd_demangle (abfd, name, DMGL_ANSI | DMGL_PARAMS);
+ if (alloc != NULL)
+ name = alloc;
}
if (info != NULL)
@@ -2514,12 +2514,16 @@ dump_symbols (bfd *abfd ATTRIBUTE_UNUSED
/* If we want to demangle the name, we demangle it
here, and temporarily clobber it while calling
bfd_print_symbol. FIXME: This is a gross hack. */
- alloc = demangle (cur_bfd, name);
- (*current)->name = alloc;
+ alloc = bfd_demangle (cur_bfd, name, DMGL_ANSI | DMGL_PARAMS);
+ if (alloc != NULL)
+ (*current)->name = alloc;
bfd_print_symbol (cur_bfd, stdout, *current,
bfd_print_symbol_all);
- (*current)->name = name;
- free (alloc);
+ if (alloc != NULL)
+ {
+ (*current)->name = name;
+ free (alloc);
+ }
}
else
bfd_print_symbol (cur_bfd, stdout, *current,
@@ -2825,8 +2829,9 @@ dump_bfd (bfd *abfd)
dhandle = read_debugging_info (abfd, syms, symcount);
if (dhandle != NULL)
{
- if (! print_debugging_info (stdout, dhandle, abfd, syms, demangle,
- dump_debugging_tags ? TRUE : FALSE))
+ if (!print_debugging_info (stdout, dhandle, abfd, syms,
+ bfd_demangle,
+ dump_debugging_tags ? TRUE : FALSE))
{
non_fatal (_("%s: printing debugging information failed"),
bfd_get_filename (abfd));
Index: binutils/prdbg.c
===================================================================
RCS file: /cvs/src/src/binutils/prdbg.c,v
retrieving revision 1.15
diff -u -p -r1.15 prdbg.c
--- binutils/prdbg.c 28 Sep 2006 12:59:25 -0000 1.15
+++ binutils/prdbg.c 19 Apr 2007 05:41:06 -0000
@@ -30,6 +30,7 @@
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
+#include "demangle.h"
#include "debug.h"
#include "budbg.h"
@@ -53,7 +54,7 @@ struct pr_handle
/* The symbols table for this BFD. */
asymbol **syms;
/* Pointer to a function to demangle symbols. */
- char *(*demangler) (bfd *, const char *);
+ char *(*demangler) (bfd *, const char *, int);
};
/* The type stack. */
@@ -2536,7 +2537,7 @@ tg_variable (void *p, const char *name,
dname = name;
if (info->demangler)
{
- dname = info->demangler (info->abfd, name);
+ dname = info->demangler (info->abfd, name, DMGL_ANSI | DMGL_PARAMS);
if (strcmp (name, dname) == 0)
{
free ((char *) dname);
@@ -2608,7 +2609,7 @@ tg_start_function (void *p, const char *
dname = name;
if (info->demangler)
{
- dname = info->demangler (info->abfd, name);
+ dname = info->demangler (info->abfd, name, DMGL_ANSI | DMGL_PARAMS);
if (strcmp (name, dname) == 0)
{
free ((char *) dname);
Index: binutils/po/POTFILES.in
===================================================================
RCS file: /cvs/src/src/binutils/po/POTFILES.in,v
retrieving revision 1.8
diff -u -p -r1.8 POTFILES.in
--- binutils/po/POTFILES.in 27 Feb 2007 08:31:46 -0000 1.8
+++ binutils/po/POTFILES.in 19 Apr 2007 05:41:07 -0000
@@ -8,8 +8,6 @@ binemul.h
bucomm.c
bucomm.h
budbg.h
-budemang.c
-budemang.h
coffdump.c
coffgrok.c
coffgrok.h
Index: gas/Makefile.am
===================================================================
RCS file: /cvs/src/src/gas/Makefile.am,v
retrieving revision 1.146
diff -u -p -r1.146 Makefile.am
--- gas/Makefile.am 14 Apr 2007 20:40:25 -0000 1.146
+++ gas/Makefile.am 19 Apr 2007 05:41:12 -0000
@@ -1369,10 +1369,9 @@ DEPTC_sparc_elf = $(srcdir)/config/obj-e
dwarf2dbg.h
DEPTC_spu_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/config/tc-spu.h dwarf2dbg.h \
- $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
- $(INCDIR)/opcode/spu.h $(INCDIR)/opcode/spu-insns.h \
- dwarf2dbg.h $(INCDIR)/opcode/spu-insns.h
+ $(INCDIR)/bfdlink.h $(srcdir)/config/tc-spu.h $(INCDIR)/opcode/spu.h \
+ $(INCDIR)/opcode/spu-insns.h dwarf2dbg.h $(INCDIR)/safe-ctype.h \
+ subsegs.h $(INCDIR)/obstack.h dwarf2dbg.h $(INCDIR)/opcode/spu-insns.h
DEPTC_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/opcode/tic30.h
@@ -1745,9 +1744,10 @@ DEPOBJ_sparc_elf = $(srcdir)/config/obj-
$(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h
DEPOBJ_spu_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/config/tc-spu.h dwarf2dbg.h \
- $(INCDIR)/safe-ctype.h subsegs.h $(INCDIR)/obstack.h \
- $(INCDIR)/obstack.h struc-symbol.h dwarf2dbg.h $(INCDIR)/aout/aout64.h
+ $(INCDIR)/bfdlink.h $(srcdir)/config/tc-spu.h $(INCDIR)/opcode/spu.h \
+ $(INCDIR)/opcode/spu-insns.h dwarf2dbg.h $(INCDIR)/safe-ctype.h \
+ subsegs.h $(INCDIR)/obstack.h $(INCDIR)/obstack.h struc-symbol.h \
+ dwarf2dbg.h $(INCDIR)/aout/aout64.h
DEPOBJ_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h $(INCDIR)/aout/aout64.h \
$(INCDIR)/obstack.h
@@ -2061,9 +2061,9 @@ DEP_sparc_elf = $(srcdir)/config/obj-elf
$(INCDIR)/coff/sparc.h $(INCDIR)/coff/external.h $(BFDDIR)/libcoff.h
DEP_spu_elf = $(srcdir)/config/obj-elf.h $(BFDDIR)/elf-bfd.h \
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
- $(INCDIR)/bfdlink.h $(srcdir)/config/tc-spu.h dwarf2dbg.h \
- $(srcdir)/config/obj-coff.h $(INCDIR)/coff/internal.h \
- $(BFDDIR)/libcoff.h
+ $(INCDIR)/bfdlink.h $(srcdir)/config/tc-spu.h $(INCDIR)/opcode/spu.h \
+ $(INCDIR)/opcode/spu-insns.h dwarf2dbg.h $(srcdir)/config/obj-coff.h \
+ $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h
DEP_tic30_aout = $(srcdir)/config/obj-aout.h $(srcdir)/config/tc-tic30.h \
$(BFDDIR)/libaout.h $(INCDIR)/bfdlink.h
DEP_tic30_coff = $(srcdir)/config/obj-coff.h $(srcdir)/config/tc-tic30.h \
Index: gprof/Makefile.am
===================================================================
RCS file: /cvs/src/src/gprof/Makefile.am,v
retrieving revision 1.35
diff -u -p -r1.35 Makefile.am
--- gprof/Makefile.am 14 Apr 2007 20:43:28 -0000 1.35
+++ gprof/Makefile.am 19 Apr 2007 07:08:35 -0000
@@ -226,7 +226,7 @@ corefile.o: corefile.c $(INCDIR)/libiber
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
../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: gprof/corefile.c
===================================================================
RCS file: /cvs/src/src/gprof/corefile.c,v
retrieving revision 1.26
diff -u -p -r1.26 corefile.c
--- gprof/corefile.c 10 Apr 2007 07:57:31 -0000 1.26
+++ gprof/corefile.c 19 Apr 2007 07:08:37 -0000
@@ -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: gprof/gprof.c
===================================================================
RCS file: /cvs/src/src/gprof/gprof.c,v
retrieving revision 1.30
diff -u -p -r1.30 gprof.c
--- gprof/gprof.c 1 Mar 2007 15:48:36 -0000 1.30
+++ gprof/gprof.c 19 Apr 2007 07:08:37 -0000
@@ -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: gprof/gprof.h
===================================================================
RCS file: /cvs/src/src/gprof/gprof.h,v
retrieving revision 1.12
diff -u -p -r1.12 gprof.h
--- gprof/gprof.h 17 Feb 2007 13:33:57 -0000 1.12
+++ gprof/gprof.h 19 Apr 2007 07:08:37 -0000
@@ -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: gprof/sym_ids.c
===================================================================
RCS file: /cvs/src/src/gprof/sym_ids.c,v
retrieving revision 1.16
diff -u -p -r1.16 sym_ids.c
--- gprof/sym_ids.c 9 May 2005 06:55:25 -0000 1.16
+++ gprof/sym_ids.c 19 Apr 2007 07:08:37 -0000
@@ -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: gprof/utils.c
===================================================================
RCS file: /cvs/src/src/gprof/utils.c,v
retrieving revision 1.7
diff -u -p -r1.7 utils.c
--- gprof/utils.c 26 May 2004 04:55:55 -0000 1.7
+++ gprof/utils.c 19 Apr 2007 07:08:37 -0000
@@ -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);
Index: ld/Makefile.am
===================================================================
RCS file: /cvs/src/src/ld/Makefile.am,v
retrieving revision 1.236
diff -u -p -r1.236 Makefile.am
--- ld/Makefile.am 14 Apr 2007 20:44:31 -0000 1.236
+++ ld/Makefile.am 19 Apr 2007 05:41:34 -0000
@@ -1960,7 +1960,7 @@ ldemul.o: ldemul.c config.h ../bfd/bfd.h
ldexp.o: ldexp.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
- ldgram.h ldlang.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
+ ldlex.h ldgram.h ldlang.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
$(INCDIR)/safe-ctype.h
ldfile.o: ldfile.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
@@ -1998,7 +1998,7 @@ ldwrite.o: ldwrite.c ../bfd/bfd.h $(INCD
$(INCDIR)/safe-ctype.h ld.h ldexp.h ldlang.h ldwrite.h \
ldmisc.h ldgram.h ldmain.h
lexsup.o: lexsup.c config.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/symcat.h sysdep.h $(INCDIR)/fopen-same.h \
+ $(INCDIR)/symcat.h ../bfd/bfdver.h sysdep.h $(INCDIR)/fopen-same.h \
$(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h $(INCDIR)/safe-ctype.h \
$(INCDIR)/bfdlink.h ld.h ldmain.h ldmisc.h ldexp.h \
ldlang.h ldgram.h ldlex.h ldfile.h ldver.h ldemul.h \
@@ -2010,8 +2010,8 @@ mri.o: mri.c ../bfd/bfd.h $(INCDIR)/ansi
ldcref.o: ldcref.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
- $(INCDIR)/objalloc.h ld.h ldmain.h ldmisc.h ldexp.h \
- ldlang.h
+ $(INCDIR)/demangle.h $(INCDIR)/libiberty.h $(INCDIR)/objalloc.h \
+ ld.h ldmain.h ldmisc.h ldexp.h ldlang.h
pe-dll.o: pe-dll.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \
$(INCDIR)/symcat.h sysdep.h config.h $(INCDIR)/fopen-same.h \
$(INCDIR)/bfdlink.h $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h \
Index: ld/ldcref.c
===================================================================
RCS file: /cvs/src/src/ld/ldcref.c,v
retrieving revision 1.16
diff -u -p -r1.16 ldcref.c
--- ld/ldcref.c 17 Feb 2007 00:24:00 -0000 1.16
+++ ld/ldcref.c 19 Apr 2007 05:41:36 -0000
@@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street - F
#include "sysdep.h"
#include "bfdlink.h"
#include "libiberty.h"
+#include "demangle.h"
#include "objalloc.h"
#include "ld.h"
@@ -324,7 +325,8 @@ cref_fill_array (struct cref_hash_entry
struct cref_hash_entry ***pph = data;
ASSERT (h->demangled == NULL);
- h->demangled = demangle (h->root.string);
+ h->demangled = bfd_demangle (output_bfd, h->root.string,
+ DMGL_ANSI | DMGL_PARAMS);
**pph = h;
Index: ld/ldlang.c
===================================================================
RCS file: /cvs/src/src/ld/ldlang.c,v
retrieving revision 1.258
diff -u -p -r1.258 ldlang.c
--- ld/ldlang.c 18 Apr 2007 03:55:10 -0000 1.258
+++ ld/ldlang.c 19 Apr 2007 05:41:40 -0000
@@ -5267,7 +5267,8 @@ lang_one_common (struct bfd_link_hash_en
header_printed = TRUE;
}
- name = demangle (h->root.string);
+ name = bfd_demangle (output_bfd, h->root.string,
+ DMGL_ANSI | DMGL_PARAMS);
minfo ("%s", name);
len = strlen (name);
free (name);
Index: ld/ldmisc.c
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.c,v
retrieving revision 1.29
diff -u -p -r1.29 ldmisc.c
--- ld/ldmisc.c 31 Mar 2006 11:23:55 -0000 1.29
+++ ld/ldmisc.c 19 Apr 2007 05:41:42 -0000
@@ -144,17 +144,24 @@ vfinfo (FILE *fp, const char *fmt, va_li
const char *name = va_arg (arg, const char *);
if (name == NULL || *name == 0)
- fprintf (fp, _("no symbol"));
- else if (! demangling)
- fprintf (fp, "%s", name);
- else
+ {
+ fprintf (fp, _("no symbol"));
+ break;
+ }
+ else if (demangling)
{
char *demangled;
- demangled = demangle (name);
- fprintf (fp, "%s", demangled);
- free (demangled);
+ demangled = bfd_demangle (output_bfd, name,
+ DMGL_ANSI | DMGL_PARAMS);
+ if (demangled != NULL)
+ {
+ fprintf (fp, "%s", demangled);
+ free (demangled);
+ break;
+ }
}
+ fprintf (fp, "%s", name);
}
break;
@@ -432,48 +439,6 @@ vfinfo (FILE *fp, const char *fmt, va_li
xexit (1);
}
-/* Wrapper around cplus_demangle. Strips leading underscores and
- other such chars that would otherwise confuse the demangler. */
-
-char *
-demangle (const char *name)
-{
- char *res;
- const char *p;
-
- if (output_bfd != NULL
- && bfd_get_symbol_leading_char (output_bfd) == name[0])
- ++name;
-
- /* This is a hack for better error reporting on 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);
-
- memcpy (add_dots, name, dots);
- memcpy (add_dots + dots, res, len);
- free (res);
- res = add_dots;
- }
- return res;
- }
- return xstrdup (name);
-}
-
/* Format info message and print on stdout. */
/* (You would think this should be called just "info", but then you
Index: ld/ldmisc.h
===================================================================
RCS file: /cvs/src/src/ld/ldmisc.h,v
retrieving revision 1.8
diff -u -p -r1.8 ldmisc.h
--- ld/ldmisc.h 12 May 2005 07:32:03 -0000 1.8
+++ ld/ldmisc.h 19 Apr 2007 05:41:42 -0000
@@ -40,6 +40,5 @@ do { info_assert(__FILE__,__LINE__); } w
extern void print_space (void);
extern void print_nl (void);
-extern char *demangle (const char *);
#endif
Index: opcodes/Makefile.am
===================================================================
RCS file: /cvs/src/src/opcodes/Makefile.am,v
retrieving revision 1.108
diff -u -p -r1.108 Makefile.am
--- opcodes/Makefile.am 18 Apr 2007 12:14:50 -0000 1.108
+++ opcodes/Makefile.am 19 Apr 2007 05:41:49 -0000
@@ -782,7 +782,8 @@ i386-dis.lo: i386-dis.c $(INCDIR)/dis-as
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h sysdep.h config.h \
$(INCDIR)/ansidecl.h opintl.h $(INCDIR)/opcode/i386.h
i386-opc.lo: i386-opc.c sysdep.h config.h $(INCDIR)/ansidecl.h \
- i386-opc.h $(INCDIR)/opcode/i386.h
+ $(INCDIR)/libiberty.h $(INCDIR)/ansidecl.h i386-opc.h \
+ $(INCDIR)/opcode/i386.h
i860-dis.lo: i860-dis.c $(INCDIR)/dis-asm.h $(BFD_H) \
$(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/opcode/i860.h
i960-dis.lo: i960-dis.c sysdep.h config.h $(INCDIR)/ansidecl.h \
Index: opcodes/po/POTFILES.in
===================================================================
RCS file: /cvs/src/src/opcodes/po/POTFILES.in,v
retrieving revision 1.39
diff -u -p -r1.39 POTFILES.in
--- opcodes/po/POTFILES.in 8 Mar 2007 05:35:54 -0000 1.39
+++ opcodes/po/POTFILES.in 19 Apr 2007 05:41:51 -0000
@@ -45,6 +45,7 @@ hppa-dis.c
i370-dis.c
i370-opc.c
i386-dis.c
+i386-opc.c
i860-dis.c
i960-dis.c
ia64-asmtab.c
--
Alan Modra
IBM OzLabs - Linux Technology Centre