diff options
author | Doug Evans <dje@google.com> | 2011-11-10 20:21:29 +0000 |
---|---|---|
committer | Doug Evans <dje@google.com> | 2011-11-10 20:21:29 +0000 |
commit | 50f182aa6671dea0fdcf063d5974c623332f3e63 (patch) | |
tree | 305e9bf4cddbeadeaa410ab4ad250ded684a83b8 /gdb/demangle.c | |
parent | 6953d2240a9e4d4f5d6b8369c2367377b7d2ef47 (diff) | |
download | gdb-50f182aa6671dea0fdcf063d5974c623332f3e63.zip gdb-50f182aa6671dea0fdcf063d5974c623332f3e63.tar.gz gdb-50f182aa6671dea0fdcf063d5974c623332f3e63.tar.bz2 |
* defs.h (is_cplus_marker, set_demangling_style): Moved to ...
* gdb-demangle.h: ... here. New file.
* demangle.c: #include "gdb-demangle.h".
(_initialize_demangler): Use initialize_file_ftype for prototype.
Move "set demangle" and "set asm-demangle" parameters here from utils.c
(demangle, show_demangle, asm_demangle, show_asm_demangle): Move here
from utils.c
* utils.c: Update. #include "gdb-demangle.h".
* symtab.h (asm_demangle): Delete.
(demangle): Move declaration next to use.
* breakpoint.c: #include "gdb-demangle.h" instead of "demangle.h".
* dwarf2read.c: #include "gdb-demangle.h".
* gnu-v2-abi.c: Ditto.
* jv-typeprint.c: Ditto.
* mdebugread.c: Ditto.
* p-typeprint.c: Ditto.
* stabsread.c: Ditto.
* printcmd.c: Ditto.
(asm_demangle): Delete declaration.
* tui/tui-stack.c: #include "gdb-demangle.h".
Diffstat (limited to 'gdb/demangle.c')
-rw-r--r-- | gdb/demangle.c | 50 |
1 files changed, 45 insertions, 5 deletions
diff --git a/gdb/demangle.c b/gdb/demangle.c index 5600692..bf4d937 100644 --- a/gdb/demangle.c +++ b/gdb/demangle.c @@ -28,6 +28,7 @@ #include "command.h" #include "gdbcmd.h" #include "demangle.h" +#include "gdb-demangle.h" #include "gdb_string.h" /* Select the default C++ demangling style to use. The default is "auto", @@ -42,7 +43,31 @@ #define DEFAULT_DEMANGLING_STYLE AUTO_DEMANGLING_STYLE_STRING #endif -extern void _initialize_demangler (void); +/* See documentation in gdb-demangle.h. */ +int demangle = 1; + +static void +show_demangle (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, + _("Demangling of encoded C++/ObjC names " + "when displaying symbols is %s.\n"), + value); +} + +/* See documentation in gdb-demangle.h. */ +int asm_demangle = 0; + +static void +show_asm_demangle (struct ui_file *file, int from_tty, + struct cmd_list_element *c, const char *value) +{ + fprintf_filtered (file, + _("Demangling of C++/ObjC names in " + "disassembly listings is %s.\n"), + value); +} /* String name for the current demangling style. Set by the "set demangle-style" command, printed as part of the output by the @@ -62,9 +87,6 @@ show_demangling_style_names(struct ui_file *file, int from_tty, value); } - -static void set_demangling_command (char *, int, struct cmd_list_element *); - /* Set current demangling style. Called by the "set demangle-style" command after it has updated the current_demangling_style_string to match what the user has entered. @@ -142,7 +164,7 @@ set_demangling_command (char *ignore, int from_tty, struct cmd_list_element *c) } } -/* Fake a "set demangle-style" command. */ +/* See documentation in gdb-demangle.h. */ void set_demangling_style (char *style) @@ -168,12 +190,16 @@ set_demangling_style (char *style) static char cplus_markers[] = {'$', '.', '\0'}; +/* See documentation in gdb-demangle.h. */ + int is_cplus_marker (int c) { return c && strchr (cplus_markers, c) != NULL; } +extern initialize_file_ftype _initialize_demangler; /* -Wmissing-prototypes */ + void _initialize_demangler (void) { @@ -191,6 +217,20 @@ _initialize_demangler (void) demangling_style_names[i] = xstrdup (libiberty_demanglers[i].demangling_style_name); + add_setshow_boolean_cmd ("demangle", class_support, &demangle, _("\ +Set demangling of encoded C++/ObjC names when displaying symbols."), _("\ +Show demangling of encoded C++/ObjC names when displaying symbols."), NULL, + NULL, + show_demangle, + &setprintlist, &showprintlist); + + add_setshow_boolean_cmd ("asm-demangle", class_support, &asm_demangle, _("\ +Set demangling of C++/ObjC names in disassembly listings."), _("\ +Show demangling of C++/ObjC names in disassembly listings."), NULL, + NULL, + show_asm_demangle, + &setprintlist, &showprintlist); + /* FIXME: cagney/2005-02-20: The code implementing this variable are malloc-ing and free-ing current_demangling_style_string when it should instead just point to an element of |