diff options
-rw-r--r-- | binutils/ChangeLog | 8 | ||||
-rw-r--r-- | binutils/addr2line.c | 15 | ||||
-rw-r--r-- | binutils/binutils.texi | 33 | ||||
-rw-r--r-- | binutils/nm.c | 20 | ||||
-rw-r--r-- | binutils/objdump.c | 17 | ||||
-rw-r--r-- | gprof/ChangeLog | 5 | ||||
-rw-r--r-- | gprof/gprof.c | 20 | ||||
-rw-r--r-- | gprof/gprof.texi | 8 | ||||
-rw-r--r-- | ld/ChangeLog | 5 | ||||
-rw-r--r-- | ld/ld.texinfo | 17 | ||||
-rw-r--r-- | ld/lexsup.c | 16 |
11 files changed, 132 insertions, 32 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index e24cabe..f4524c8 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,11 @@ +2000-07-05 Kenneth Block <krblock@computer.org> + + * binutils/nm.c: Add optional style to demangle switch. + * binutils/objdump.c: Add optional style to demangle switch. + * binutils/addr2line.c: Add optional style to demangle switch. + * binutils/binutils.texi: Document optional style to demangle + switch. + 2000-07-20 Hans-Peter Nilsson <hp@axis.com> * MAINTAINERS: Add self as CRIS port maintainer. diff --git a/binutils/addr2line.c b/binutils/addr2line.c index 20c7eef..9232a9e 100644 --- a/binutils/addr2line.c +++ b/binutils/addr2line.c @@ -51,7 +51,7 @@ static asymbol **syms; /* Symbol table. */ static struct option long_options[] = { {"basenames", no_argument, NULL, 's'}, - {"demangle", no_argument, NULL, 'C'}, + {"demangle", optional_argument, NULL, 'C'}, {"exe", required_argument, NULL, 'e'}, {"functions", no_argument, NULL, 'f'}, {"target", required_argument, NULL, 'b'}, @@ -75,7 +75,7 @@ usage (stream, status) { fprintf (stream, _("\ Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\ - [-e executable] [--exe=executable] [--demangle]\n\ + [-e executable] [--exe=executable] [--demangle[=style]]\n\ [--basenames] [--functions] [addr addr ...]\n"), program_name); list_supported_targets (program_name, stream); @@ -301,6 +301,17 @@ main (argc, argv) break; case 'C': do_demangle = true; + if (optarg != NULL) + { + enum demangling_styles style; + + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + fatal (_("unknown demangling style `%s'"), + optarg); + + cplus_demangle_set_style (style); + } break; case 'e': filename = optarg; diff --git a/binutils/binutils.texi b/binutils/binutils.texi index 437c843..6c2cfc8 100644 --- a/binutils/binutils.texi +++ b/binutils/binutils.texi @@ -630,7 +630,7 @@ The @sc{gnu} linker @code{ld} is now described in a separate manual. @smallexample nm [ -a | --debug-syms ] [ -g | --extern-only ] - [ -B ] [ -C | --demangle ] [ -D | --dynamic ] + [ -B ] [ -C | --demangle[=@var{style}] ] [ -D | --dynamic ] [ -s | --print-armap ] [ -A | -o | --print-file-name ] [ -n | -v | --numeric-sort ] [ -p | --no-sort ] [ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ] @@ -754,12 +754,14 @@ listed. The same as @samp{--format=bsd} (for compatibility with the MIPS @code{nm}). @item -C -@itemx --demangle +@itemx --demangle[=@var{style}] @cindex demangling in nm 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. +makes C++ function names readable. Different compilers have different +mangling styles. The optional demangling style argument can be used to +choose an appropriate demangling style for your compiler. @xref{c++filt}, +for more information on demangling. @item --no-demangle Do not demangle low-level symbol names. This is the default. @@ -1173,7 +1175,7 @@ Show a summary of the options to @code{objcopy}. @smallexample objdump [ -a | --archive-headers ] [ -b @var{bfdname} | --target=@var{bfdname} ] - [ -C | --demangle ] + [ -C | --demangle[=@var{style}] ] [ -d | --disassemble ] [ -D | --disassemble-all ] [ -z | --disassemble-zeroes ] @@ -1258,12 +1260,14 @@ formats available with the @samp{-i} option. @xref{Target Selection}, for more information. @item -C -@itemx --demangle +@itemx --demangle[=@var{style}] @cindex demangling in objdump 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. +makes C++ function names readable. Different compilers have different +mangling styles. The optional demangling style argument can be used to +choose an appropriate demangling style for your compiler. @xref{c++filt}, +for more information on demangling. @item -G @item --debugging @@ -1859,6 +1863,8 @@ the one specified by the C++ Annotated Reference Manual the one used by the HP compiler @item edg the one used by the EDG compiler +@item gnu-new-abi +the one used by the @sc{gnu} compiler with the new ABI. @end table @item --help @@ -1894,7 +1900,7 @@ c++filt @var{option} @var{symbol} @smallexample addr2line [ -b @var{bfdname} | --target=@var{bfdname} ] - [ -C | --demangle ] + [ -C | --demangle[=@var{style} ] [ -e @var{filename} | --exe=@var{filename} ] [ -f | --functions ] [ -s | --basename ] [ -H | --help ] [ -V | --version ] @@ -1941,12 +1947,14 @@ Specify that the object-code format for the object files is @var{bfdname}. @item -C -@itemx --demangle +@itemx --demangle[=@var{style}] @cindex demangling in objdump 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. +makes C++ function names readable. Different compilers have different +mangling styles. The optional demangling style argument can be used to +choose an appropriate demangling style for your compiler. @xref{c++filt}, +for more information on demangling. @item -e @var{filename} @itemx --exe=@var{filename} @@ -1960,7 +1968,6 @@ Display function names as well as file and line number information. @item -s @itemx --basenames Display only the base of each file name. -@end table @node nlmconv @chapter nlmconv diff --git a/binutils/nm.c b/binutils/nm.c index ad5a00d..fca510c 100644 --- a/binutils/nm.c +++ b/binutils/nm.c @@ -260,7 +260,7 @@ static bfd *lineno_cache_rel_bfd; static struct option long_options[] = { {"debug-syms", no_argument, &print_debug_syms, 1}, - {"demangle", no_argument, &do_demangle, 1}, + {"demangle", optional_argument, 0, 'C'}, {"dynamic", no_argument, &dynamic, 1}, {"extern-only", no_argument, &external_only, 1}, {"format", required_argument, 0, 'f'}, @@ -297,7 +297,9 @@ usage (stream, status) -a, --debug-syms Display debugger-only symbols\n\ -A, --print-file-name Print name of the input file before every symbol\n\ -B Same as --format=bsd\n\ - -C, --demangle Decode low-level symbol names into user-level names\n\ + -C, --demangle[=STYLE] Decode low-level symbol names into user-level names\n\ + The STYLE, if specified, can be `auto' (the default),\n\ + `gnu', 'lucid', 'arm', 'hp', 'edg' or 'gnu-new-abi'\n\ --no-demangle Do not demangle low-level symbol names\n\ -D, --dynamic Display dynamic symbols instead of normal symbols\n\ --defined-only Display only defined symbols\n\ @@ -407,7 +409,8 @@ main (argc, argv) bfd_init (); set_default_bfd_target (); - while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvV", long_options, (int *) 0)) != EOF) + while ((c = getopt_long (argc, argv, "aABCDef:glnopPrst:uvV", + long_options, (int *) 0)) != EOF) { switch (c) { @@ -423,6 +426,17 @@ main (argc, argv) break; case 'C': do_demangle = 1; + if (optarg != NULL) + { + enum demangling_styles style; + + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + fatal (_("unknown demangling style `%s'"), + optarg); + + cplus_demangle_set_style (style); + } break; case 'D': dynamic = 1; diff --git a/binutils/objdump.c b/binutils/objdump.c index 0d4a2c9..d71888a 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -255,7 +255,9 @@ usage (stream, status) -EL --endian=little Assume little endian format when disassembling\n\ --file-start-context Include context from start of file (with -S)\n\ -l, --line-numbers Include line numbers and filenames in output\n\ - -C, --demangle Decode mangled/processed symbol names\n\ + -C, --demangle[=STYLE] Decode mangled/processed symbol names\n\ + The STYLE, if specified, can be `auto', 'gnu',\n\ + 'lucid', 'arm', 'hp', 'edg', or 'gnu-new-abi'\n\ -w, --wide Format output for more than 80 columns\n\ -z, --disassemble-zeroes Do not skip blocks of zeroes when disassembling\n\ --start-address=ADDR Only process data whoes address is >= ADDR\n\ @@ -288,7 +290,7 @@ static struct option long_options[]= {"architecture", required_argument, NULL, 'm'}, {"archive-headers", no_argument, NULL, 'a'}, {"debugging", no_argument, NULL, 'g'}, - {"demangle", no_argument, NULL, 'C'}, + {"demangle", optional_argument, NULL, 'C'}, {"disassemble", no_argument, NULL, 'd'}, {"disassemble-all", no_argument, NULL, 'D'}, {"disassembler-options", required_argument, NULL, 'M'}, @@ -2833,6 +2835,17 @@ main (argc, argv) break; case 'C': do_demangle = true; + if (optarg != NULL) + { + enum demangling_styles style; + + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + fatal (_("unknown demangling style `%s'"), + optarg); + + cplus_demangle_set_style (style); + } break; case 'w': wide_output = true; diff --git a/gprof/ChangeLog b/gprof/ChangeLog index 7b51f9c..43653e5 100644 --- a/gprof/ChangeLog +++ b/gprof/ChangeLog @@ -1,3 +1,8 @@ +2000-07-05 Kenneth Block <krblock@computer.org> + + * gprof/gprof.c: Add optional style to demangle switch + * gprof/gprof.texi: Document optional style to demangle switch. + 2000-06-05 DJ Delorie <dj@redhat.com> * MAINTAINERS: new diff --git a/gprof/gprof.c b/gprof/gprof.c index 5e47a97..2ceafd5 100644 --- a/gprof/gprof.c +++ b/gprof/gprof.c @@ -29,6 +29,7 @@ #include "hist.h" #include "source.h" #include "sym_ids.h" +#include "demangle.h" const char *whoami; const char *function_mapping_file; @@ -104,7 +105,7 @@ static struct option long_options[] = /* various options to affect output: */ {"all-lines", no_argument, 0, 'x'}, - {"demangle", no_argument, 0, OPTION_DEMANGLE}, + {"demangle", optional_argument, 0, OPTION_DEMANGLE}, {"no-demangle", no_argument, 0, OPTION_NO_DEMANGLE}, {"directory-path", required_argument, 0, 'I'}, {"display-unused-functions", no_argument, 0, 'z'}, @@ -153,7 +154,7 @@ Usage: %s [-[abcDhilLsTvwxyz]] [-[ACeEfFJnNOpPqQZ][name]] [-I dirs]\n\ [--no-static] [--print-path] [--separate-files]\n\ [--static-call-graph] [--sum] [--table-length=len] [--traditional]\n\ [--version] [--width=n] [--ignore-non-functions]\n\ - [--demangle] [--no-demangle]\n\ + [--demangle[=STYLE]] [--no-demangle]\n\ [image-file] [profile-file...]\n"), whoami); if (status == 0) @@ -425,6 +426,21 @@ This program is free software. This program has absolutely no warranty.\n")); break; case OPTION_DEMANGLE: demangle = TRUE; + if (optarg != NULL) + { + enum demangling_styles style; + + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + { + fprintf (stderr, + _("%s: unknown demangling style `%s'\n"), + whoami, optarg); + xexit (1); + } + + cplus_demangle_set_style (style); + } break; case OPTION_NO_DEMANGLE: demangle = FALSE; diff --git a/gprof/gprof.texi b/gprof/gprof.texi index 6e1cfd0..4db07a1 100644 --- a/gprof/gprof.texi +++ b/gprof/gprof.texi @@ -478,12 +478,14 @@ are annotated. If this option is specified, every line in a basic-block is annotated by repeating the annotation for the first line. This behavior is similar to @code{tcov}'s @samp{-a}. -@item --demangle +@item --demangle[=@var{style}] @itemx --no-demangle These options control whether C++ symbol names should be demangled when printing output. The default is to demangle symbols. The -@code{--no-demangle} option may be used to turn off demangling. - +@code{--no-demangle} option may be used to turn off demangling. Different +compilers have different mangling styles. The optional demangling style +argument can be used to choose an appropriate demangling style for your +compiler. @end table @node Analysis Options,Miscellaneous Options,Output Options,Invoking diff --git a/ld/ChangeLog b/ld/ChangeLog index 7102bca..508b605 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,8 @@ +2000-07-05 Kenneth Block <krblock@computer.org> + + * ld/lexsup.c: Add optional style to demangle switch + * ld/ld.texinfo: Document optional style to demangle switch. + 2000-07-20 Hans-Peter Nilsson <hp@axis.com> * Makefile.am (ALL_EMULATIONS): Add ecrisaout.o, ecriself.o, diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 2bc54e4..6ca9432 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -852,17 +852,19 @@ space between @var{symbol}, the equals sign (``@key{=}''), and @var{expression}. @cindex demangling, from command line -@kindex --demangle +@kindex --demangle[=@var{style}] @kindex --no-demangle -@item --demangle +@item --demangle[=@var{style}] @itemx --no-demangle These options control whether to demangle symbol names in error messages and other output. When the linker is told to demangle, it tries to present symbol names in a readable fashion: it strips leading underscores if they are used by the object file format, and converts C++ -mangled symbol names into user readable names. The linker will demangle -by default unless the environment variable @samp{COLLECT_NO_DEMANGLE} is -set. These options may be used to override the default. +mangled symbol names into user readable names. Different compilers have +different mangling styles. The optional demangling style argument can be used +to choose an appropriate demangling style for your compiler. The linker will +demangle by default unless the environment variable @samp{COLLECT_NO_DEMANGLE} +is set. These options may be used to override the default. @cindex dynamic linker, from command line @kindex --dynamic-linker @var{file} @@ -1072,6 +1074,11 @@ specifies the first set of directories to search. The either by specifying a list of names separated by colons, or by appearing multiple times. +This option should be used with caution as it overrides the search path +that may have been hard compiled into a shared library. In such a case it +is possible to use unintentionally a different search path than the +runtime linker would do. + The linker uses the following search paths to locate required shared libraries. @enumerate diff --git a/ld/lexsup.c b/ld/lexsup.c index e2cd2d1..079cc06 100644 --- a/ld/lexsup.c +++ b/ld/lexsup.c @@ -37,6 +37,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include "ldfile.h" #include "ldver.h" #include "ldemul.h" +#include "demangle.h" #ifndef PATH_SEPARATOR #if defined (__MSDOS__) || (defined (_WIN32) && ! defined (__CYGWIN32__)) @@ -272,8 +273,8 @@ static const struct ld_option ld_options[] = '\0', NULL, N_("Output cross reference table"), TWO_DASHES }, { {"defsym", required_argument, NULL, OPTION_DEFSYM}, '\0', N_("SYMBOL=EXPRESSION"), N_("Define a symbol"), TWO_DASHES }, - { {"demangle", no_argument, NULL, OPTION_DEMANGLE}, - '\0', NULL, N_("Demangle symbol names"), TWO_DASHES }, + { {"demangle", optional_argument, NULL, OPTION_DEMANGLE}, + '\0', N_("[=STYLE]"), N_("Demangle symbol names [using STYLE]"), TWO_DASHES }, { {"dynamic-linker", required_argument, NULL, OPTION_DYNAMIC_LINKER}, '\0', N_("PROGRAM"), N_("Set the dynamic linker to use"), TWO_DASHES }, { {"embedded-relocs", no_argument, NULL, OPTION_EMBEDDED_RELOCS}, @@ -594,6 +595,17 @@ parse_args (argc, argv) break; case OPTION_DEMANGLE: demangling = true; + if (optarg != NULL) + { + enum demangling_styles style; + + style = cplus_demangle_name_to_style (optarg); + if (style == unknown_demangling) + einfo (_("%F%P: unknown demangling style `%s'"), + optarg); + + cplus_demangle_set_style (style); + } break; case OPTION_DYNAMIC_LINKER: command_line.interpreter = optarg; |