From a6637ec0ed383a4658dfddbf625dee74af000f06 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Tue, 2 Jul 2002 04:21:25 +0000 Subject: [PATCH] * 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. --- binutils/ChangeLog | 17 ++++ binutils/Makefile.am | 155 +++++++++++++++++++----------------- binutils/Makefile.in | 169 +++++++++++++++++++++------------------- binutils/addr2line.c | 30 +++---- binutils/budemang.c | 69 ++++++++++++++++ binutils/budemang.h | 25 ++++++ binutils/nm.c | 41 ++-------- binutils/objdump.c | 34 +++----- binutils/po/POTFILES.in | 3 + binutils/rdcoff.c | 1 - 10 files changed, 318 insertions(+), 226 deletions(-) create mode 100644 binutils/budemang.c create mode 100644 binutils/budemang.h diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 3290c768be8..d6d0f76bff6 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,20 @@ +2002-07-02 Alan Modra + + * 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. + 2002-07-01 Matt Thomas * readelf.c: Include "elf/vax.h". diff --git a/binutils/Makefile.am b/binutils/Makefile.am index e43fe297442..b0dce8e6927 100644 --- a/binutils/Makefile.am +++ b/binutils/Makefile.am @@ -78,18 +78,24 @@ INCLUDES = -D_GNU_SOURCE \ -DLOCALEDIR="\"$(prefix)/share/locale\"" \ -Dbin_dummy_emulation=$(EMULATION_VECTOR) -HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \ - windres.h winduni.h binemul.h +HFILES = \ + arsup.h binemul.h bucomm.h budbg.h budemang.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 bucomm.c coffdump.c coffgrok.c debug.c \ - dlltool.c filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \ - maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \ - objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \ - stabs.c strings.c sysdump.c version.c wrstabs.c \ - windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \ - resres.c dllwrap.c rename.c binemul.c emul_$(EMULATION).c +CFILES = \ + addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \ + coffdump.c coffgrok.c debug.c dlltool.c dllwrap.c \ + emul_aix.c emul_vanilla.c filemode.c \ + ieee.c is-ranlib.c is-strip.c maybe-ranlib.c maybe-strip.c \ + nlmconv.c nm.c not-ranlib.c not-strip.c \ + objcopy.c objdump.c prdbg.c \ + rdcoff.c rddbg.c readelf.c rename.c \ + resbin.c rescoff.c resrc.c resres.c \ + size.c srconv.c stabs.c strings.c sysdump.c version.c \ + windres.c winduni.c wrstabs.c GENERATED_CFILES = \ underscore.c arparse.c arlex.c sysroff.c sysinfo.c syslex.c \ @@ -167,9 +173,9 @@ readelf_LDADD = $(INTLLIBS) $(LIBIBERTY) strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) -nm_new_SOURCES = nm.c $(BULIBS) +nm_new_SOURCES = nm.c budemang.c $(BULIBS) -objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS) +objdump_SOURCES = objdump.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS) objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS) objdump.o:objdump.c @@ -197,7 +203,7 @@ ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c \ binemul.c emul_$(EMULATION).c $(BULIBS) ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) -addr2line_SOURCES = addr2line.c $(BULIBS) +addr2line_SOURCES = addr2line.c budemang.c $(BULIBS) # The following is commented out for the conversion to automake. # This rule creates a single binary that switches between ar and ranlib @@ -373,7 +379,7 @@ install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS) addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ $(INCDIR)/demangle.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h + $(INCDIR)/fopen-same.h budemang.h ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ @@ -383,9 +389,15 @@ arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h +binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h +budemang.o: budemang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ + budemang.h coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h coffgrok.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h @@ -400,6 +412,16 @@ dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/demangle.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 bucomm.h config.h \ + $(INCDIR)/bin-bugs.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 config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h $(BFDDIR)/libcoff.h $(BFDDIR)/libxcoff.h +emul_vanilla.o: emul_vanilla.c binemul.h ../bfd/bfd.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h @@ -418,10 +440,10 @@ nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.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 config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h + $(INCDIR)/fopen-same.h budemang.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h \ + $(INCDIR)/libiberty.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h not-ranlib.o: not-ranlib.c not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ @@ -430,9 +452,9 @@ objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ budbg.h $(INCDIR)/filenames.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ - debug.h budbg.h $(INCDIR)/aout/aout64.h + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h budemang.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ @@ -440,12 +462,48 @@ prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/libiberty.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 config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ budbg.h +readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/alpha.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/avr.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/d10v.h \ + $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/fr30.h \ + $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/i386.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/m68k.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/mips.h \ + $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h $(INCDIR)/elf/mn10300.h \ + $(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/sparc.h \ + $(INCDIR)/elf/v850.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/x86-64.h \ + $(INCDIR)/elf/xstormy16.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h unwind-ia64.h +rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h +resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h +rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.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 config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + windres.h winduni.h +resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h @@ -470,64 +528,19 @@ sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h -wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ - debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \ winduni.h -resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ - windres.h winduni.h -rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ - winduni.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h -resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ - winduni.h winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h -readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/alpha.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \ - $(INCDIR)/elf/avr.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/d10v.h \ - $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/fr30.h \ - $(INCDIR)/elf/frv.h \ - $(INCDIR)/elf/h8.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/i386.h \ - $(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/m32r.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/mcore.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h \ - $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h \ - $(INCDIR)/elf/ppc.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/x86-64.h \ - $(INCDIR)/elf/xstormy16.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h unwind-ia64.h -resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ - winduni.h -dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h -rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h -binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ +wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h -emul_vanilla.o: emul_vanilla.c binemul.h ../bfd/bfd.h \ - $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def underscore.o: underscore.c arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 39a5de6a51c..f5c738013f6 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -190,19 +190,25 @@ INCLUDES = -D_GNU_SOURCE \ -Dbin_dummy_emulation=$(EMULATION_VECTOR) -HFILES = arsup.h bucomm.h budbg.h coffgrok.h debug.h nlmconv.h dlltool.h \ - windres.h winduni.h binemul.h +HFILES = \ + arsup.h binemul.h bucomm.h budbg.h budemang.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 bucomm.c coffdump.c coffgrok.c debug.c \ - dlltool.c filemode.c ieee.c is-ranlib.c is-strip.c maybe-ranlib.c \ - maybe-strip.c nlmconv.c nm.c not-ranlib.c not-strip.c \ - objcopy.c objdump.c prdbg.c rdcoff.c rddbg.c size.c srconv.c \ - stabs.c strings.c sysdump.c version.c wrstabs.c \ - windres.c resrc.c rescoff.c resbin.c winduni.c readelf.c \ - resres.c dllwrap.c rename.c binemul.c emul_$(EMULATION).c +CFILES = \ + addr2line.c ar.c arsup.c binemul.c bucomm.c budemang.c \ + coffdump.c coffgrok.c debug.c dlltool.c dllwrap.c \ + emul_aix.c emul_vanilla.c filemode.c \ + ieee.c is-ranlib.c is-strip.c maybe-ranlib.c maybe-strip.c \ + nlmconv.c nm.c not-ranlib.c not-strip.c \ + objcopy.c objdump.c prdbg.c \ + rdcoff.c rddbg.c readelf.c rename.c \ + resbin.c rescoff.c resrc.c resres.c \ + size.c srconv.c stabs.c strings.c sysdump.c version.c \ + windres.c winduni.c wrstabs.c GENERATED_CFILES = \ @@ -262,9 +268,9 @@ readelf_LDADD = $(INTLLIBS) $(LIBIBERTY) strip_new_SOURCES = objcopy.c is-strip.c rename.c $(WRITE_DEBUG_SRCS) $(BULIBS) -nm_new_SOURCES = nm.c $(BULIBS) +nm_new_SOURCES = nm.c budemang.c $(BULIBS) -objdump_SOURCES = objdump.c prdbg.c $(DEBUG_SRCS) $(BULIBS) +objdump_SOURCES = objdump.c budemang.c prdbg.c $(DEBUG_SRCS) $(BULIBS) objdump_LDADD = $(OPCODES) $(BFDLIB) $(LIBIBERTY) $(INTLLIBS) cxxfilt_SOURCES = @@ -280,7 +286,7 @@ ranlib_SOURCES = ar.c is-ranlib.c arparse.y arlex.l arsup.c rename.c \ ranlib_LDADD = $(BFDLIB) $(LIBIBERTY) @LEXLIB@ $(INTLLIBS) -addr2line_SOURCES = addr2line.c $(BULIBS) +addr2line_SOURCES = addr2line.c budemang.c $(BULIBS) srconv_SOURCES = srconv.c coffgrok.c $(BULIBS) @@ -367,9 +373,9 @@ filemode.$(OBJEXT) size_LDADD = $(LDADD) size_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a size_LDFLAGS = -objdump_OBJECTS = objdump.$(OBJEXT) prdbg.$(OBJEXT) rddbg.$(OBJEXT) \ -debug.$(OBJEXT) stabs.$(OBJEXT) ieee.$(OBJEXT) rdcoff.$(OBJEXT) \ -bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) +objdump_OBJECTS = objdump.$(OBJEXT) budemang.$(OBJEXT) prdbg.$(OBJEXT) \ +rddbg.$(OBJEXT) debug.$(OBJEXT) stabs.$(OBJEXT) ieee.$(OBJEXT) \ +rdcoff.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) objdump_DEPENDENCIES = ../opcodes/libopcodes.la ../bfd/libbfd.la \ ../libiberty/libiberty.a objdump_LDFLAGS = @@ -397,8 +403,8 @@ version.$(OBJEXT) filemode.$(OBJEXT) objcopy_LDADD = $(LDADD) objcopy_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a objcopy_LDFLAGS = -addr2line_OBJECTS = addr2line.$(OBJEXT) bucomm.$(OBJEXT) \ -version.$(OBJEXT) filemode.$(OBJEXT) +addr2line_OBJECTS = addr2line.$(OBJEXT) budemang.$(OBJEXT) \ +bucomm.$(OBJEXT) version.$(OBJEXT) filemode.$(OBJEXT) addr2line_LDADD = $(LDADD) addr2line_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a addr2line_LDFLAGS = @@ -406,8 +412,8 @@ readelf_OBJECTS = readelf.$(OBJEXT) version.$(OBJEXT) \ unwind-ia64.$(OBJEXT) readelf_DEPENDENCIES = ../libiberty/libiberty.a readelf_LDFLAGS = -nm_new_OBJECTS = nm.$(OBJEXT) bucomm.$(OBJEXT) version.$(OBJEXT) \ -filemode.$(OBJEXT) +nm_new_OBJECTS = nm.$(OBJEXT) budemang.$(OBJEXT) bucomm.$(OBJEXT) \ +version.$(OBJEXT) filemode.$(OBJEXT) nm_new_LDADD = $(LDADD) nm_new_DEPENDENCIES = ../bfd/libbfd.la ../libiberty/libiberty.a nm_new_LDFLAGS = @@ -1101,7 +1107,7 @@ install-exec-local: install-binPROGRAMS $(bin_PROGRAMS) $(noinst_PROGRAMS) addr2line.o: addr2line.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/getopt.h $(INCDIR)/libiberty.h \ $(INCDIR)/demangle.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h + $(INCDIR)/fopen-same.h budemang.h ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ $(INCDIR)/libiberty.h $(INCDIR)/progress.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ @@ -1111,9 +1117,15 @@ arsup.o: arsup.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h arsup.h $(INCDIR)/libiberty.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/filenames.h +binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h bucomm.o: bucomm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/filenames.h +budemang.o: budemang.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ + budemang.h coffdump.o: coffdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h coffgrok.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h @@ -1128,6 +1140,16 @@ dlltool.o: dlltool.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/demangle.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 bucomm.h config.h \ + $(INCDIR)/bin-bugs.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 config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \ + $(INCDIR)/coff/xcoff.h $(BFDDIR)/libcoff.h $(BFDDIR)/libxcoff.h +emul_vanilla.o: emul_vanilla.c binemul.h ../bfd/bfd.h \ + $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bucomm.h config.h \ + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h filemode.o: filemode.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h @@ -1146,10 +1168,10 @@ nlmconv.o: nlmconv.c ../bfd/bfd.h $(INCDIR)/ansidecl.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 config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h $(INCDIR)/libiberty.h \ - $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \ - $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h + $(INCDIR)/fopen-same.h budemang.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h \ + $(INCDIR)/libiberty.h $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/common.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h not-ranlib.o: not-ranlib.c not-strip.o: not-strip.c objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ @@ -1158,9 +1180,9 @@ objcopy.o: objcopy.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ budbg.h $(INCDIR)/filenames.h objdump.o: objdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/progress.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/safe-ctype.h \ - $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h $(INCDIR)/demangle.h \ - debug.h budbg.h $(INCDIR)/aout/aout64.h + $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h budemang.h \ + $(INCDIR)/safe-ctype.h $(INCDIR)/dis-asm.h $(INCDIR)/libiberty.h \ + $(INCDIR)/demangle.h debug.h budbg.h $(INCDIR)/aout/aout64.h prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ @@ -1168,12 +1190,48 @@ prdbg.o: prdbg.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ rdcoff.o: rdcoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/coff/internal.h bucomm.h \ config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ - $(INCDIR)/libiberty.h $(INCDIR)/demangle.h debug.h \ - budbg.h $(BFDDIR)/libcoff.h $(INCDIR)/bfdlink.h + $(INCDIR)/libiberty.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 config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h debug.h \ budbg.h +readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ + $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/alpha.h \ + $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \ + $(INCDIR)/elf/avr.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/d10v.h \ + $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/fr30.h \ + $(INCDIR)/elf/frv.h $(INCDIR)/elf/h8.h $(INCDIR)/elf/hppa.h \ + $(INCDIR)/elf/i386.h $(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h \ + $(INCDIR)/elf/ia64.h $(INCDIR)/elf/m32r.h $(INCDIR)/elf/m68k.h \ + $(INCDIR)/elf/m68hc11.h $(INCDIR)/elf/mcore.h $(INCDIR)/elf/mips.h \ + $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h $(INCDIR)/elf/mn10300.h \ + $(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h $(INCDIR)/elf/ppc.h \ + $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h $(INCDIR)/elf/sparc.h \ + $(INCDIR)/elf/v850.h $(INCDIR)/elf/vax.h $(INCDIR)/elf/x86-64.h \ + $(INCDIR)/elf/xstormy16.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h unwind-ia64.h +rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h +resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h +rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.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 config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + windres.h winduni.h +resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ + $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ + winduni.h size.o: size.c ../bfd/bfd.h $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \ bucomm.h config.h $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h \ $(INCDIR)/libiberty.h @@ -1198,64 +1256,19 @@ sysdump.o: sysdump.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ version.o: version.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h -wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ - debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ - $(INCDIR)/aout/stab.def windres.o: windres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h $(INCDIR)/getopt.h bucomm.h config.h \ $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h \ $(INCDIR)/safe-ctype.h $(INCDIR)/obstack.h windres.h \ winduni.h -resrc.o: resrc.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ - windres.h winduni.h -rescoff.o: rescoff.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ - winduni.h $(INCDIR)/coff/internal.h $(BFDDIR)/libcoff.h \ - $(INCDIR)/bfdlink.h -resbin.o: resbin.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ - winduni.h winduni.o: winduni.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ $(INCDIR)/fopen-same.h winduni.h $(INCDIR)/safe-ctype.h -readelf.o: readelf.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/elf/common.h $(INCDIR)/elf/external.h \ - $(INCDIR)/elf/internal.h $(INCDIR)/elf/dwarf2.h $(INCDIR)/elf/alpha.h \ - $(INCDIR)/elf/reloc-macros.h $(INCDIR)/elf/arc.h $(INCDIR)/elf/arm.h \ - $(INCDIR)/elf/avr.h $(INCDIR)/elf/cris.h $(INCDIR)/elf/d10v.h \ - $(INCDIR)/elf/d30v.h $(INCDIR)/elf/dlx.h $(INCDIR)/elf/fr30.h \ - $(INCDIR)/elf/frv.h \ - $(INCDIR)/elf/h8.h $(INCDIR)/elf/hppa.h $(INCDIR)/elf/i386.h \ - $(INCDIR)/elf/i860.h $(INCDIR)/elf/i960.h $(INCDIR)/elf/ia64.h \ - $(INCDIR)/elf/m32r.h $(INCDIR)/elf/m68k.h $(INCDIR)/elf/mcore.h \ - $(INCDIR)/elf/mips.h $(INCDIR)/elf/mmix.h $(INCDIR)/elf/mn10200.h \ - $(INCDIR)/elf/mn10300.h $(INCDIR)/elf/or32.h $(INCDIR)/elf/pj.h \ - $(INCDIR)/elf/ppc.h $(INCDIR)/elf/s390.h $(INCDIR)/elf/sh.h \ - $(INCDIR)/elf/sparc.h $(INCDIR)/elf/v850.h $(INCDIR)/elf/x86-64.h \ - $(INCDIR)/elf/xstormy16.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h unwind-ia64.h -resres.o: resres.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h windres.h \ - winduni.h -dllwrap.o: dllwrap.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h $(INCDIR)/libiberty.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h $(INCDIR)/dyn-string.h -rename.o: rename.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ - $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h -binemul.o: binemul.c binemul.h ../bfd/bfd.h $(INCDIR)/ansidecl.h \ +wrstabs.o: wrstabs.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ - $(INCDIR)/fopen-same.h -emul_vanilla.o: emul_vanilla.c binemul.h ../bfd/bfd.h \ - $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h bucomm.h config.h \ - $(INCDIR)/bin-bugs.h $(INCDIR)/fopen-same.h + $(INCDIR)/fopen-same.h $(INCDIR)/libiberty.h $(INCDIR)/safe-ctype.h \ + debug.h budbg.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \ + $(INCDIR)/aout/stab.def underscore.o: underscore.c arparse.o: arparse.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/symcat.h bucomm.h config.h $(INCDIR)/bin-bugs.h \ diff --git a/binutils/addr2line.c b/binutils/addr2line.c index fae7eddebb6..2d9dc90015c 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) diff --git a/binutils/budemang.c b/binutils/budemang.c new file mode 100644 index 00000000000..7e0b6124129 --- /dev/null +++ b/binutils/budemang.c @@ -0,0 +1,69 @@ +/* demangle.c -- A wrapper calling libiberty cplus_demangle + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#include +#include "bfd.h" +#include "libiberty.h" +#include "demangle.h" +#include "budemang.h" + +/* Wrapper around cplus_demangle. Strips leading underscores and + other such chars that would otherwise confuse the demangler. */ + +char * +demangle (abfd, name) + bfd *abfd; + const char *name; +{ + char *res; + const char *p; + + if (abfd != NULL && bfd_get_symbol_leading_char (abfd) == 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); +} diff --git a/binutils/budemang.h b/binutils/budemang.h new file mode 100644 index 00000000000..60a3c2d733f --- /dev/null +++ b/binutils/budemang.h @@ -0,0 +1,25 @@ +/* demangle.h -- A wrapper calling libiberty cplus_demangle + Copyright 2002 Free Software Foundation, Inc. + + This file is part of GNU Binutils. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ +#ifndef BUDEMANG_H +#define BUDEMANG_H + +char *demangle PARAMS ((bfd *, const char *)); + +#endif diff --git a/binutils/nm.c b/binutils/nm.c index f97732e0e23..b9689b16e72 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); diff --git a/binutils/objdump.c b/binutils/objdump.c index 4dbb1236dad..2687b6e74a7 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -22,6 +22,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "bfd.h" #include "progress.h" #include "bucomm.h" +#include "budemang.h" #include "getopt.h" #include "safe-ctype.h" #include "dis-asm.h" @@ -630,29 +631,20 @@ objdump_print_symname (abfd, info, sym) { char *alloc; const char *name; - const char *print; alloc = NULL; name = bfd_asymbol_name (sym); - if (! do_demangle || name[0] == '\0') - print = name; - else + if (do_demangle && name[0] != '\0') { /* Demangle the name. */ - if (bfd_get_symbol_leading_char (abfd) == name[0]) - ++name; - - alloc = cplus_demangle (name, DMGL_ANSI | DMGL_PARAMS); - if (alloc == NULL) - print = name; - else - print = alloc; + alloc = demangle (abfd, name); + name = alloc; } if (info != NULL) - (*info->fprintf_func) (info->stream, "%s", print); + (*info->fprintf_func) (info->stream, "%s", name); else - printf ("%s", print); + printf ("%s", name); if (alloc != NULL) free (alloc); @@ -2316,24 +2308,16 @@ dump_symbols (abfd, dynamic) const char *name; char *alloc; - name = bfd_asymbol_name (*current); + name = (*current)->name; alloc = NULL; if (do_demangle && name != NULL && *name != '\0') { - const char *n; - /* 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. */ - n = name; - if (bfd_get_symbol_leading_char (cur_bfd) == *n) - ++n; - alloc = cplus_demangle (n, DMGL_ANSI | DMGL_PARAMS); - if (alloc != NULL) - (*current)->name = alloc; - else - (*current)->name = n; + alloc = demangle (cur_bfd, name); + (*current)->name = alloc; } bfd_print_symbol (cur_bfd, stdout, *current, diff --git a/binutils/po/POTFILES.in b/binutils/po/POTFILES.in index 0ff0fbd161a..1a3e5858dff 100644 --- a/binutils/po/POTFILES.in +++ b/binutils/po/POTFILES.in @@ -7,6 +7,8 @@ binemul.h bucomm.c bucomm.h budbg.h +budemang.c +budemang.h coffdump.c coffgrok.c coffgrok.h @@ -16,6 +18,7 @@ debug.h dlltool.c dlltool.h dllwrap.c +emul_aix.c emul_vanilla.c filemode.c ieee.c diff --git a/binutils/rdcoff.c b/binutils/rdcoff.c index 249cc8596f2..2091964e89b 100644 --- a/binutils/rdcoff.c +++ b/binutils/rdcoff.c @@ -25,7 +25,6 @@ #include "coff/internal.h" #include "bucomm.h" #include "libiberty.h" -#include "demangle.h" #include "debug.h" #include "budbg.h" -- 2.30.2