summaryrefslogtreecommitdiff
path: root/gdb/demangle.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/demangle.c')
-rw-r--r--gdb/demangle.c50
1 files changed, 45 insertions, 5 deletions
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 5600692aabb..bf4d9376dc5 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