]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* defs.h (is_cplus_marker, set_demangling_style): Moved to ...
authorDoug Evans <dje@google.com>
Thu, 10 Nov 2011 20:21:29 +0000 (20:21 +0000)
committerDoug Evans <dje@google.com>
Thu, 10 Nov 2011 20:21:29 +0000 (20:21 +0000)
* 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".

15 files changed:
gdb/ChangeLog
gdb/breakpoint.c
gdb/defs.h
gdb/demangle.c
gdb/dwarf2read.c
gdb/gdb-demangle.h [new file with mode: 0644]
gdb/gnu-v2-abi.c
gdb/jv-typeprint.c
gdb/mdebugread.c
gdb/p-typeprint.c
gdb/printcmd.c
gdb/stabsread.c
gdb/symtab.h
gdb/tui/tui-stack.c
gdb/utils.c

index 577e9b0c1768f9dea8d34fb4e8c9d4a59588a06a..4cdc9ede831195f2b3a8539d26c167922e95481a 100644 (file)
 
 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>
index 8c98bef3bc25c40d7885eb605d448852c2f2f29f..b78b01155c620ce3ec0b0e66094dbcb99f9248ce 100644 (file)
@@ -38,7 +38,7 @@
 #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"
index d0b6813e2a97439ef753ff9c93ef745da51ad9e3..b5bc6c5fd4de2f785a2e212993763af94451e3bb 100644 (file)
@@ -149,9 +149,6 @@ typedef bfd_vma CORE_ADDR;
 
 #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;
 
@@ -442,10 +439,6 @@ extern struct cleanup *make_bpstat_clear_actions_cleanup (void);
 
 extern int producer_is_gcc_ge_4 (const char *producer);
 
-/* From demangle.c */
-
-extern void set_demangling_style (char *);
-
 \f
 /* Annotation stuff.  */
 
index 5600692aabb8163f5e90af5f9ef1c712b26f820f..bf4d9376dc533d29a522dbc8b1c4b9e112a0efb3 100644 (file)
@@ -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",
 #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
index 84eb589b42daa2abd0bbabcd727ff5424f27fb75..5a3e4692e86767b2b7c7af6a048ced0f38d74380 100644 (file)
@@ -34,6 +34,7 @@
 #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"
diff --git a/gdb/gdb-demangle.h b/gdb/gdb-demangle.h
new file mode 100644 (file)
index 0000000..2b8c6ac
--- /dev/null
@@ -0,0 +1,37 @@
+/* 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 */
index 3d49a06645d1b2245d1f3fde6d985cd03aa4b165..a0d4830ed0a1f70862cc7d5fd3e9f5cdd2a89bf6 100644 (file)
@@ -26,6 +26,7 @@
 #include "gdbtypes.h"
 #include "value.h"
 #include "demangle.h"
+#include "gdb-demangle.h"
 #include "cp-abi.h"
 #include "cp-support.h"
 #include "exceptions.h"
index 8d9ebfd9ccd70cfb9f2871bbac77947cd36a0536..b1e6aba6de8078182c7665517ef8c008cce6b8b4 100644 (file)
@@ -23,6 +23,7 @@
 #include "gdbtypes.h"
 #include "value.h"
 #include "demangle.h"
+#include "gdb-demangle.h"
 #include "jv-lang.h"
 #include "gdb_string.h"
 #include "typeprint.h"
index 29fe97b8aa5a0a30e0a59977aadd240b90bdbcfe..0eab988aaa2f3c2377ee54cda908ca2efdbd1471 100644 (file)
@@ -52,6 +52,7 @@
 #include "stabsread.h"
 #include "complaints.h"
 #include "demangle.h"
+#include "gdb-demangle.h"
 #include "gdb_assert.h"
 #include "block.h"
 #include "dictionary.h"
index 5ac3bc5431a9c7aee0a74cb339c8be75a0047ae9..04e3025a069fc5ab5b7ad295ea3f442475f90f07 100644 (file)
@@ -31,7 +31,7 @@
 #include "language.h"
 #include "p-lang.h"
 #include "typeprint.h"
-
+#include "gdb-demangle.h"
 #include "gdb_string.h"
 #include <errno.h>
 #include <ctype.h>
index ad6993e5ad08ad1d23b71b9806077090c9755d2b..5a522f42cbeb6b37c4b4662734251c898872e248 100644 (file)
@@ -32,6 +32,7 @@
 #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 */
@@ -62,9 +63,6 @@
 # define USE_PRINTF_I64 0
 #endif
 
-extern int asm_demangle;       /* Whether to demangle syms in asm
-                                  printouts.  */
-
 struct format_data
   {
     int count;
index 3ff3f5e9e6d827050c7a8db6c514f6838def38b8..bb5180881a4f1612649e5bcf092221290fa2ff50 100644 (file)
@@ -41,6 +41,7 @@
 #include "buildsym.h"
 #include "complaints.h"
 #include "demangle.h"
+#include "gdb-demangle.h"
 #include "language.h"
 #include "doublest.h"
 #include "cp-abi.h"
index 90a6fe46e14d21e893f70ce98f1ca3dd67181772..e5bf155b34bc9dbf2c863a139805da5e293ae468 100644 (file)
@@ -244,11 +244,14 @@ extern char *symbol_demangled_name (const struct general_symbol_info *symbol);
    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
@@ -866,10 +869,6 @@ struct symtab
 
 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[];
index 1ec9bcce653f61c098a519c4d69b68968ea34ac4..10d52e8026554c362f7bc6c8e2b893528246392c 100644 (file)
@@ -28,6 +28,7 @@
 #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"
index 008baac20c74838c0d7e01a9c2ee3561d5c32853..82a0f458989c0ccfea001ef65019a195da0c5a22 100644 (file)
@@ -50,7 +50,7 @@
 #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"
@@ -138,35 +138,6 @@ int quit_flag;
 
 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.)  */
@@ -2864,13 +2835,6 @@ Show number of lines gdb thinks are in a page."), NULL,
 
   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."), _("\
@@ -2895,13 +2859,6 @@ Show printing of 8-bit characters in strings as \\nnn."), NULL,
                           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."), _("\