This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
[PATCH]Add --style switch to binutils
- To: binutils at sourceware dot cygnus dot com
- Subject: [PATCH]Add --style switch to binutils
- From: Ken Block <block at zk3 dot dec dot com>
- Date: Tue, 20 Jun 2000 16:00:06 -0400
The --style switch allows tools to select which demangler is used. For
example --style=gnu-new-abi will use the new ABI demangler. The current
supported styles are: auto,gnu,lucid,arm,hp,edg,gnu-new-abi. All tools
that support demangling should support this switch. This includes: nm,
objdump, addr2line, ld, and gprof.
2000-06-20 Kenneth Block <krblock@computer.org>
* binutils/nm.c: Add --style switch
* binutils/objdump.c: Add --style switch
* binutils/addr2line.c: Add --style switch
* binutils/binutils.texi: Add --style switch
* ld/lexsup.c: Add --style switch
* ld/ld.texinfo: Add --style switch
* gprof/gprof.c: Add --style switch
* gprof/gprof.texi: Add --style switch
*** ./binutils/nm.c.orig Fri Apr 7 00:39:24 2000
--- ./binutils/nm.c Thu Jun 15 17:45:58 2000
***************
*** 256,261 ****
--- 256,262 ----
static bfd *lineno_cache_rel_bfd;
#define OPTION_TARGET 200
+ #define OPTION_STYLE (OPTION_TARGET + 1)
static struct option long_options[] =
{
***************
*** 277,282 ****
--- 278,284 ----
{"reverse-sort", no_argument, &reverse_sort, 1},
{"size-sort", no_argument, &sort_by_size, 1},
{"stats", no_argument, &show_stats, 1},
+ {"style", required_argument, 0, OPTION_STYLE},
{"target", required_argument, 0, OPTION_TARGET},
{"defined-only", no_argument, &defined_only, 1},
{"undefined-only", no_argument, &undefined_only, 1},
***************
*** 297,303 ****
[--numeric-sort] [--no-sort] [--reverse-sort] [--size-sort]\n\
[--undefined-only] [--portability] [-f {bsd,sysv,posix}]\n\
[--format={bsd,sysv,posix}] [--demangle] [--no-demangle] [--dynamic]\n\
! [--defined-only] [--line-numbers]\n\
[--version] [--help]\n\
[file...]\n"),
program_name);
--- 299,305 ----
[--numeric-sort] [--no-sort] [--reverse-sort] [--size-sort]\n\
[--undefined-only] [--portability] [-f {bsd,sysv,posix}]\n\
[--format={bsd,sysv,posix}] [--demangle] [--no-demangle] [--dynamic]\n\
! [--defined-only] [--line-numbers] [--style=style]\n\
[--version] [--help]\n\
[file...]\n"),
program_name);
***************
*** 450,455 ****
--- 452,471 ----
case OPTION_TARGET: /* --target */
target = optarg;
+ break;
+
+ case OPTION_STYLE: /* --style */
+ {
+ enum demangling_styles style;
+ style = cplus_demangle_name_to_style(optarg);
+ if (style == unknown_demangling) {
+ fprintf (stderr,
+ _("%s: unknown demangling style `%s'\n"),
+ program_name,optarg);
+ xexit (1);
+ }
+ cplus_demangle_set_style(style);
+ }
break;
case 0: /* A long option that just sets a flag. */
*** ./binutils/objdump.c.orig Thu Jun 15 17:51:53 2000
--- ./binutils/objdump.c Thu Jun 15 17:56:37 2000
***************
*** 255,260 ****
--- 255,261 ----
--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\
+ --style=style Specifies style for demangling\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\
***************
*** 278,283 ****
--- 279,285 ----
#define OPTION_START_ADDRESS (OPTION_ENDIAN + 1)
#define OPTION_STOP_ADDRESS (OPTION_START_ADDRESS + 1)
#define OPTION_ADJUST_VMA (OPTION_STOP_ADDRESS + 1)
+ #define OPTION_STYLE ( OPTION_ADJUST_VMA + 1)
static struct option long_options[]=
{
***************
*** 312,317 ****
--- 314,320 ----
{"stabs", no_argument, NULL, 'G'},
{"start-address", required_argument, NULL, OPTION_START_ADDRESS},
{"stop-address", required_argument, NULL, OPTION_STOP_ADDRESS},
+ {"style", required_argument, NULL, OPTION_STYLE},
{"syms", no_argument, NULL, 't'},
{"target", required_argument, NULL, 'b'},
{"version", no_argument, NULL, 'V'},
***************
*** 2843,2848 ****
--- 2846,2866 ----
case OPTION_STOP_ADDRESS:
stop_address = parse_vma (optarg, "--stop-address");
break;
+
+ case OPTION_STYLE: /* --style */
+ {
+ enum demangling_styles style;
+ style = cplus_demangle_name_to_style(optarg);
+ if (style == unknown_demangling) {
+ fprintf (stderr,
+ _("%s: unknown demangling style `%s'\n"),
+ program_name,optarg);
+ xexit (1);
+ }
+ cplus_demangle_set_style(style);
+ }
+ break;
+
case 'E':
if (strcmp (optarg, "B") == 0)
endian = BFD_ENDIAN_BIG;
*** ./binutils/addr2line.c.orig Thu Jun 15 17:59:14 2000
--- ./binutils/addr2line.c Thu Jun 15 18:02:13 2000
***************
*** 48,59 ****
--- 48,63 ----
static asymbol **syms; /* Symbol table. */
+ /* 150 isn't special; it's just an arbitrary non-ASCII char value. */
+ #define OPTION_STYLE (150)
+
static struct option long_options[] =
{
{"basenames", no_argument, NULL, 's'},
{"demangle", no_argument, NULL, 'C'},
{"exe", required_argument, NULL, 'e'},
{"functions", no_argument, NULL, 'f'},
+ {"style", required_argument, NULL, OPTION_STYLE},
{"target", required_argument, NULL, 'b'},
{"help", no_argument, NULL, 'H'},
{"version", no_argument, NULL, 'V'},
***************
*** 75,81 ****
{
fprintf (stream, _("\
Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\
! [-e executable] [--exe=executable] [--demangle]\n\
[--basenames] [--functions] [addr addr ...]\n"),
program_name);
list_supported_targets (program_name, stream);
--- 79,85 ----
{
fprintf (stream, _("\
Usage: %s [-CfsHV] [-b bfdname] [--target=bfdname]\n\
! [-e executable] [--exe=executable] [--demangle] [--style=language]\n\
[--basenames] [--functions] [addr addr ...]\n"),
program_name);
list_supported_targets (program_name, stream);
***************
*** 317,322 ****
--- 321,340 ----
case 'H':
usage (stdout, 0);
break;
+ case OPTION_STYLE: /* --style */
+ {
+ enum demangling_styles style;
+ style = cplus_demangle_name_to_style(optarg);
+ if (style == unknown_demangling) {
+ fprintf (stderr,
+ _("%s: unknown demangling style `%s'\n"),
+ program_name,optarg);
+ xexit (1);
+ }
+ cplus_demangle_set_style(style);
+ }
+ break;
+
default:
usage (stderr, 1);
break;
*** ./binutils/binutils.texi.orig Tue Jun 20 13:50:30 2000
--- ./binutils/binutils.texi Tue Jun 20 14:03:52 2000
***************
*** 636,642 ****
[ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ]
[ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
[ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
! [ --defined-only ] [-l | --line-numbers ]
[ --no-demangle ] [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ]
@end smallexample
--- 636,642 ----
[ -r | --reverse-sort ] [ --size-sort ] [ -u | --undefined-only ]
[ -t @var{radix} | --radix=@var{radix} ] [ -P | --portability ]
[ --target=@var{bfdname} ] [ -f @var{format} | --format=@var{format} ]
! [ --defined-only ] [-l | --line-numbers ] [ --style=@var{style}
[ --no-demangle ] [ -V | --version ] [ --help ] [ @var{objfile}@dots{} ]
@end smallexample
***************
*** 828,833 ****
--- 828,836 ----
the value of the symbol and the value of the symbol with the next higher
value. The size of the symbol is printed, rather than the value.
+ @item --style=@var{style}
+ Control the style of demangling.
+
@item -t @var{radix}
@itemx --radix=@var{radix}
Use @var{radix} as the radix for printing the symbol values. It must be
***************
*** 1189,1194 ****
--- 1192,1198 ----
[ -r | --reloc ]
[ -R | --dynamic-reloc ]
[ -s | --full-contents ]
+ [ --style=@var{style} ]
[ -G | --stabs ]
[ -t | --syms ]
[ -T | --dynamic-syms ]
***************
*** 1409,1414 ****
--- 1413,1422 ----
@cindex object file sections
Display the full contents of any sections requested.
+ @item --style=@var{style}
+ @cindex style of demangling
+ Control the style of demangling.
+
@item -S
@itemx --source
@cindex source disassembly
***************
*** 1856,1861 ****
--- 1864,1871 ----
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
***************
*** 1891,1897 ****
@smallexample
addr2line [ -b @var{bfdname} | --target=@var{bfdname} ]
! [ -C | --demangle ]
[ -e @var{filename} | --exe=@var{filename} ]
[ -f | --functions ] [ -s | --basename ]
[ -H | --help ] [ -V | --version ]
--- 1901,1907 ----
@smallexample
addr2line [ -b @var{bfdname} | --target=@var{bfdname} ]
! [ -C | --demangle ] [ --style=@var{style} ]
[ -e @var{filename} | --exe=@var{filename} ]
[ -f | --functions ] [ -s | --basename ]
[ -H | --help ] [ -V | --version ]
***************
*** 1957,1962 ****
--- 1967,1975 ----
@item -s
@itemx --basenames
Display only the base of each file name.
+
+ @item --style=@var{style}
+ Control the style of demangling.
@end table
@node nlmconv
*** ./ld/ld.texinfo.orig Mon Jun 19 12:28:43 2000
--- ./ld/ld.texinfo Tue Jun 20 15:26:32 2000
***************
*** 1118,1123 ****
--- 1118,1127 ----
Compute and display statistics about the operation of the linker, such
as execution time and memory usage.
+ @kindex --style
+ @item --style=@var{style}
+ Control the style of demangling.
+
@kindex --traditional-format
@cindex traditional format
@item --traditional-format
*** ./gprof/gprof.c.orig Tue Jun 20 14:07:47 2000
--- ./gprof/gprof.c Tue Jun 20 14:18:26 2000
***************
*** 29,34 ****
--- 29,35 ----
#include "hist.h"
#include "source.h"
#include "sym_ids.h"
+ #include "demangle.h"
const char *whoami;
const char *function_mapping_file;
***************
*** 79,84 ****
--- 80,86 ----
#define OPTION_DEMANGLE (150)
#define OPTION_NO_DEMANGLE (OPTION_DEMANGLE + 1)
+ #define OPTION_STYLE (OPTION_NO_DEMANGLE + 1)
static struct option long_options[] =
{
***************
*** 112,117 ****
--- 114,120 ----
{"print-path", no_argument, 0, 'L'},
{"separate-files", no_argument, 0, 'y'},
{"static-call-graph", no_argument, 0, 'c'},
+ {"style", required_argument, 0, OPTION_STYLE},
{"table-length", required_argument, 0, 't'},
{"time", required_argument, 0, 'n'},
{"no-time", required_argument, 0, 'N'},
***************
*** 153,159 ****
[--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\
[image-file] [profile-file...]\n"),
whoami);
if (status == 0)
--- 156,162 ----
[--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] [--style=language]\n\
[image-file] [profile-file...]\n"),
whoami);
if (status == 0)
***************
*** 428,433 ****
--- 431,449 ----
break;
case OPTION_NO_DEMANGLE:
demangle = FALSE;
+ break;
+ case OPTION_STYLE:
+ {
+ 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;
default:
usage (stderr, 1);
*** ./gprof/gprof.texi.orig Tue Jun 20 14:08:36 2000
--- ./gprof/gprof.texi Tue Jun 20 14:14:57 2000
***************
*** 484,489 ****
--- 484,492 ----
printing output. The default is to demangle symbols. The
@code{--no-demangle} option may be used to turn off demangling.
+ @item --style=@var{style}
+ Control the style of demangling.
+
@end table
@node Analysis Options,Miscellaneous Options,Output Options,Invoking