aboutsummaryrefslogtreecommitdiff
path: root/gdb/demangle.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1996-02-16 06:14:15 +0000
committerFred Fish <fnf@specifix.com>1996-02-16 06:14:15 +0000
commit81afee37d0a016cd3e671693c165916893ac3e60 (patch)
tree43af22fde990502fd3478fc11b354c1f2daaee04 /gdb/demangle.c
parent14b22711be24b3832e3282347207467471cb42ab (diff)
downloadfsf-binutils-gdb-81afee37d0a016cd3e671693c165916893ac3e60.zip
fsf-binutils-gdb-81afee37d0a016cd3e671693c165916893ac3e60.tar.gz
fsf-binutils-gdb-81afee37d0a016cd3e671693c165916893ac3e60.tar.bz2
* demangle.c (is_cplus_marker): New function, checks if a
character is one of the commonly used C++ marker characters. * defs.h (is_cplus_marker): Add prototype. * c-typeprint.c (c_type_print_base), ch-lang.c (chill_demangle), cp-valprint.c (cp_print_class_method), mdebugread.c (parse_symbol), stabsread.c (define_symbol, read_member_functions, read_struct_fields), symtab.h (OPNAME_PREFIX_P, VTBL_PREFIX_P, DESTRUCTOR_PREFIX_P), values.c (vb_match): Use is_cplus_marker instead of comparison with CPLUS_MARKER.
Diffstat (limited to 'gdb/demangle.c')
-rw-r--r--gdb/demangle.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/gdb/demangle.c b/gdb/demangle.c
index 4abc84c..bb3f092 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -1,5 +1,5 @@
/* Basic C++ demangling support for GDB.
- Copyright 1991, 1992 Free Software Foundation, Inc.
+ Copyright 1991, 1992, 1996 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
This file is part of GDB.
@@ -162,6 +162,31 @@ set_demangling_style (style)
set_demangling_command ((char *) NULL, 0);
}
+/* In order to allow a single demangler executable to demangle strings
+ using various common values of CPLUS_MARKER, as well as any specific
+ one set at compile time, we maintain a string containing all the
+ commonly used ones, and check to see if the marker we are looking for
+ is in that string. CPLUS_MARKER is usually '$' on systems where the
+ assembler can deal with that. Where the assembler can't, it's usually
+ '.' (but on many systems '.' is used for other things). We put the
+ current defined CPLUS_MARKER first (which defaults to '$'), followed
+ by the next most common value, followed by an explicit '$' in case
+ the value of CPLUS_MARKER is not '$'.
+
+ We could avoid this if we could just get g++ to tell us what the actual
+ cplus marker character is as part of the debug information, perhaps by
+ ensuring that it is the character that terminates the gcc<n>_compiled
+ marker symbol (FIXME). */
+
+static char cplus_markers[] = { CPLUS_MARKER, '.', '$', '\0' };
+
+int
+is_cplus_marker (c)
+ int c;
+{
+ return c && strchr (cplus_markers, c) != NULL;
+}
+
void
_initialize_demangler ()
{