diff options
author | David MacKenzie <djm@cygnus> | 1993-08-13 00:02:25 +0000 |
---|---|---|
committer | David MacKenzie <djm@cygnus> | 1993-08-13 00:02:25 +0000 |
commit | d6a4c375697112e9f8d35e787e703464708fa052 (patch) | |
tree | 9adc2f8b3f2c5ac525358f8b6814a50fb57a8d78 | |
parent | 8b46d73404b9d7d8010975e68a1279f11dfc2671 (diff) | |
download | gdb-d6a4c375697112e9f8d35e787e703464708fa052.zip gdb-d6a4c375697112e9f8d35e787e703464708fa052.tar.gz gdb-d6a4c375697112e9f8d35e787e703464708fa052.tar.bz2 |
* Makefile.in ($(NM_PROG)): Depend on demangle.o.
(demangle.o): New target.
(cplus-dem.o): Depend on it, to force compilation order when doing
parallel compiles.
* nm.c (print_symbol_info_{bsd,sysv,posix}): Take a bfd arg.
(struct output_fns print_symbol_info): Ditto.
(long_options, usage, main): Add -C --demangle option.
(print_symname): New function, demangling if requested.
(print_symbols, print_symbol_info_{bsd,sysv,posix}): Use it.
-rw-r--r-- | binutils/Makefile.in | 13 | ||||
-rw-r--r-- | binutils/binutils.texi | 28 | ||||
-rw-r--r-- | binutils/nm.1 | 10 |
3 files changed, 35 insertions, 16 deletions
diff --git a/binutils/Makefile.in b/binutils/Makefile.in index 125ffa0..e1b3db4 100644 --- a/binutils/Makefile.in +++ b/binutils/Makefile.in @@ -197,8 +197,8 @@ $(STRINGS_PROG): $(ADDL_LIBS) strings.o $(BFD) $(STRIP_PROG): $(ADDL_LIBS) objcopy.o is-strip.o $(BFD) $(CC) $(LDFLAGS) -o $(STRIP_PROG) objcopy.o is-strip.o $(ADDL_LIBS) $(EXTRALIBS) -$(NM_PROG): $(ADDL_LIBS) nm.o $(BFD) - $(CC) $(LDFLAGS) -o $(NM_PROG) nm.o $(ADDL_LIBS) $(EXTRALIBS) +$(NM_PROG): $(ADDL_LIBS) nm.o demangle.o $(BFD) + $(CC) $(LDFLAGS) -o $(NM_PROG) nm.o demangle.o $(ADDL_LIBS) $(EXTRALIBS) $(OBJDUMP_PROG): $(ADDL_LIBS) objdump.o $(BFD) $(OPCODES) $(CC) $(LDFLAGS) -o $(OBJDUMP_PROG) objdump.o $(OPCODES) $(ADDL_LIBS) $(EXTRALIBS) @@ -220,7 +220,12 @@ underscore.c: version.o: version.c $(CC) $(INCLUDES) $(HDEFINES) $(TDEFINES) -DVERSION='"$(VERSION)"' $(CFLAGS) -c $(srcdir)/version.c -cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h +demangle.o: $(BASEDIR)/libiberty/cplus-dem.c + $(CC) -c $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CFLAGS) $(BASEDIR)/libiberty/cplus-dem.c + mv cplus-dem.o demangle.o + +# For parallel compiling, depend on demangle.o so that one gets done first. +cplus-dem.o: $(BASEDIR)/libiberty/cplus-dem.c $(INCDIR)/getopt.h demangle.o $(CC) -c -DMAIN $(INCLUDES) $(HDEFINES) $(TDEFINES) $(CFLAGS) $(BASEDIR)/libiberty/cplus-dem.c $(DEMANGLER_PROG): cplus-dem.o $(LIBIBERTY) underscore.o version.o @@ -292,7 +297,7 @@ nm.o: nm.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \ $(INCDIR)/fopen-same.h bucomm.h $(INCDIR)/getopt.h \ $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \ - $(INCDIR)/aout/ranlib.h + $(INCDIR)/aout/ranlib.h $(INCDIR)/demangle.h ar.o: ar.c ../bfd/bfd.h $(INCDIR)/ansidecl.h \ $(INCDIR)/obstack.h ../bfd/sysdep.h $(BFDDIR)/hosts/std-host.h \ $(INCDIR)/fopen-same.h bucomm.h $(INCDIR)/aout/ar.h \ diff --git a/binutils/binutils.texi b/binutils/binutils.texi index 383d6b2..ae4010a 100644 --- a/binutils/binutils.texi +++ b/binutils/binutils.texi @@ -639,7 +639,8 @@ The GNU linker @code{ld} is now described in a separate manual. @kindex nm @smallexample -nm [ -a | --debug-syms ] [ -g | --extern-only ] [ -B ] +nm [ -a | --debug-syms ] [ -g | --extern-only ] + [ -B ] [ -C | --demangle ] [ -s | --print-armap ] [ -A | -o | --print-file-name ] [ -n | -v | --numeric-sort ] [ -p | --no-sort ] [ -r | --reverse-sort ] [ -u | --undefined-only ] @@ -716,7 +717,15 @@ listed. @item -B @cindex @code{nm} format @cindex @code{nm} compatibility -The same as @samp{--format=bsd}. +The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}). + +@item -C +@itemx --demangle +@cindex demangling C++ symbols +Decode (@dfn{demangle}) low-level symbol names into user-level names. +Besides removing any initial underscore prepended by the system, this +makes C++ function names readable. @xref{c++filt}, for more information +on demangling. @item -f @var{format} @itemx --format=@var{format} @@ -1188,7 +1197,7 @@ archives, @samp{strip -v} lists all members of the archive. @smallexample c++filt [ -_ | --strip-underscores ] [ -s @var{format} | --format=@var{format} ] - [ --help ] [ --version ] [ @var{arg}@dots{} ] + [ --help ] [ --version ] [ @var{symbol}@dots{} ] @end smallexample The C++ language provides function overloading, which means that you can @@ -1204,20 +1213,15 @@ dollars, or periods) seen in the input is a potential label. If the label decodes into a C++ name, the C++ name replaces the low-level name in the output. -A typical use of @code{c++filt} is to pipe the output of @code{nm} -though it, using @code{c++filt} as a filter: - -@example -nm @var{objfile} | c++filt -@end example - -You can also use @code{c++filt} to decipher individual symbols: +You can use @code{c++filt} to decipher individual symbols: @example c++filt @var{symbol} @end example -All results are printed on the standard output. +If no @var{symbol} arguments are given, @code{c++filt} reads symbol +names from the standard input and writes the demangled names to the +standard output. All results are printed on the standard output. @table @code @item -_ diff --git a/binutils/nm.1 b/binutils/nm.1 index e62586b..0840799 100644 --- a/binutils/nm.1 +++ b/binutils/nm.1 @@ -17,6 +17,8 @@ nm\(em\&list symbols from object files. .B nm .RB "[\|" \-a | \-\-debug\-syms "\|]" .RB "[\|" \-g | \-\-extern\-only "\|]" +.RB "[\|" \-B "\|]" +.RB "[\|" \-C | \-\-demangle "\|]" .RB "[\|" \-s | \-\-print\-armap "\|]" .RB "[\|" \-o | \-\-print\-file\-name "\|]" .RB "[\|" \-n | \-\-numeric\-sort "\|]" @@ -72,6 +74,14 @@ The same as (for compatibility with the MIPS \fBnm\fP). .TP +.B \-C +.TP +.B \-\-demangle +Decode (\fIdemangle\fP) low-level symbol names into user-level names. +Besides removing any initial underscore prepended by the system, this +makes C++ function names readable. + +.TP .B "\-f \fIformat" Use the output format \fIformat\fP, which can be ``bsd'', ``sysv'', or ``posix''. The default is `bsd''. |