From 81afee37d0a016cd3e671693c165916893ac3e60 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Fri, 16 Feb 1996 06:14:15 +0000 Subject: * 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. --- gdb/demangle.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'gdb/demangle.c') 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_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 () { -- cgit v1.1