* 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".
2011-11-10 Doug Evans <dje@google.com>
+ * 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".
+
* python/py-type.c (typy_fields_items): Call check_typedef.
2011-11-10 Joel Brobecker <brobecker@adacore.com>
#include "target.h"
#include "language.h"
#include "gdb_string.h"
-#include "demangle.h"
+#include "gdb-demangle.h"
#include "filenames.h"
#include "annotate.h"
#include "symfile.h"
#include "ptid.h"
-/* Check if a character is one of the commonly used C++ marker characters. */
-extern int is_cplus_marker (int);
-
/* Enable xdb commands if set. */
extern int xdb_commands;
extern int producer_is_gcc_ge_4 (const char *producer);
-/* From demangle.c */
-
-extern void set_demangling_style (char *);
-
\f
/* Annotation stuff. */
#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",
#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
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.
}
}
-/* Fake a "set demangle-style" command. */
+/* See documentation in gdb-demangle.h. */
void
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)
{
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
#include "dwarf2.h"
#include "buildsym.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "expression.h"
#include "filenames.h" /* for DOSish file names */
#include "macrotab.h"
--- /dev/null
+/* Basic C++ demangling support for GDB.
+ Copyright (c) 2011 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef GDB_DEMANGLE_H
+#define GDB_DEMANGLE_H
+
+/* Nonzero means that encoded C++/ObjC names should be printed out in their
+ C++/ObjC form rather than raw. */
+extern int demangle;
+
+/* Nonzero means that encoded C++/ObjC names should be printed out in their
+ C++/ObjC form even in assembler language displays. If this is set, but
+ DEMANGLE is zero, names are printed raw, i.e. DEMANGLE controls. */
+extern int asm_demangle;
+
+/* Fake a "set demangle-style" command. */
+extern void set_demangling_style (char *);
+
+/* Check if a character is one of the commonly used C++ marker characters. */
+extern int is_cplus_marker (int);
+
+#endif /* GDB_DEMANGLE_H */
#include "gdbtypes.h"
#include "value.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "cp-abi.h"
#include "cp-support.h"
#include "exceptions.h"
#include "gdbtypes.h"
#include "value.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "jv-lang.h"
#include "gdb_string.h"
#include "typeprint.h"
#include "stabsread.h"
#include "complaints.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "gdb_assert.h"
#include "block.h"
#include "dictionary.h"
#include "language.h"
#include "p-lang.h"
#include "typeprint.h"
-
+#include "gdb-demangle.h"
#include "gdb_string.h"
#include <errno.h>
#include <ctype.h>
#include "target.h"
#include "breakpoint.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "valprint.h"
#include "annotate.h"
#include "symfile.h" /* for overlay functions */
# define USE_PRINTF_I64 0
#endif
-extern int asm_demangle; /* Whether to demangle syms in asm
- printouts. */
-
struct format_data
{
int count;
#include "buildsym.h"
#include "complaints.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "language.h"
#include "doublest.h"
#include "cp-abi.h"
name if demangle is on and the "mangled" form of the name if
demangle is off. In other languages this is just the symbol name.
The result should never be NULL. Don't use this for internal
- purposes (e.g. storing in a hashtable): it's only suitable for
- output. */
+ purposes (e.g. storing in a hashtable): it's only suitable for output.
+
+ N.B. symbol may be anything with a ginfo member,
+ e.g., struct symbol or struct minimal_symbol. */
#define SYMBOL_PRINT_NAME(symbol) \
(demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol))
+extern int demangle;
/* Macro that tests a symbol for a match against a specified name string.
First test the unencoded name, then looks for and test a C++ encoded
extern int currently_reading_symtab;
-/* From utils.c. */
-extern int demangle;
-extern int asm_demangle;
-
/* symtab.c lookup functions */
extern const char multiple_symbols_ask[];
#include "inferior.h"
#include "target.h"
#include "top.h"
+#include "gdb-demangle.h"
#include "gdb_string.h"
#include "tui/tui.h"
#include "tui/tui-data.h"
#include "serial.h"
#include "bfd.h"
#include "target.h"
-#include "demangle.h"
+#include "gdb-demangle.h"
#include "expression.h"
#include "language.h"
#include "charset.h"
int immediate_quit;
-/* Nonzero means that encoded C++/ObjC names should be printed out in their
- C++/ObjC form rather than raw. */
-
-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);
-}
-
-/* Nonzero means that encoded C++/ObjC names should be printed out in their
- C++/ObjC form even in assembler language displays. If this is set, but
- DEMANGLE is zero, names are printed raw, i.e. DEMANGLE controls. */
-
-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);
-}
-
/* Nonzero means that strings with character values >0x7F should be printed
as octal escapes. Zero means just print the value (e.g. it's an
international character, and the terminal or window can cope.) */
init_page_info ();
- 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 ("pagination", class_support,
&pagination_enabled, _("\
Set state of pagination."), _("\
show_sevenbit_strings,
&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);
-
add_setshow_boolean_cmd ("timestamp", class_maintenance,
&debug_timestamp, _("\
Set timestamping of debugging messages."), _("\