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.
+Thu Feb 15 21:40:52 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
+
+ * 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.
+
Thu Feb 15 18:08:13 1996 Fred Fish <fnf@cygnus.com>
* symfile.h (INLINE_ADD_PSYMBOL): Default this to 0 and possibly
/* Support for printing C and C++ types for GDB, the GNU debugger.
- Copyright 1986, 1988, 1989, 1991, 1993, 1994
+ Copyright 1986, 1988, 1989, 1991, 1993, 1994, 1995, 1996
Free Software Foundation, Inc.
This file is part of GDB.
{
QUIT;
/* Don't print out virtual function table. */
- if ((TYPE_FIELD_NAME (type, i))[5] == CPLUS_MARKER &&
- !strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
+ if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5)
+ && is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
continue;
/* If this is a C++ class we can print the various C++ section
free (mangled_name);
}
else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
- && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
+ && is_cplus_marker (TYPE_FN_FIELD_PHYSNAME (f, j)[1]))
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1,
"~", method_name, 0, stream);
else
/* Chill language support routines for GDB, the GNU debugger.
- Copyright 1992 Free Software Foundation, Inc.
+ Copyright 1992, 1995, 1996 Free Software Foundation, Inc.
This file is part of GDB.
chill_demangle (mangled)
const char *mangled;
{
- char *joiner;
+ const char *joiner = NULL;
char *demangled;
+ const char *cp = mangled;
- joiner = strchr (mangled, CPLUS_MARKER);
- if (joiner != NULL && *(joiner + 1) == CPLUS_MARKER)
+ while (*cp)
+ {
+ if (is_cplus_marker (*cp))
+ {
+ joiner = cp;
+ break;
+ }
+ cp++;
+ }
+ if (joiner != NULL && *(joiner + 1) == *joiner)
{
demangled = savestring (mangled, joiner - mangled);
}
/* Support for printing C++ values for GDB, the GNU debugger.
- Copyright 1986, 1988, 1989, 1991, 1994, 1995
+ Copyright 1986, 1988, 1989, 1991, 1994, 1995, 1996
Free Software Foundation, Inc.
This file is part of GDB.
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f, j), stream, 0, 0);
fprintf_unfiltered (stream, kind);
if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
- && TYPE_FN_FIELD_PHYSNAME (f, j)[1] == CPLUS_MARKER)
+ && is_cplus_marker (TYPE_FN_FIELD_PHYSNAME (f, j)[1]))
{
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1, "~",
TYPE_FN_FIELDLIST_NAME (domain, i),
/* Basic, host-specific, and target-specific definitions for GDB.
- Copyright (C) 1986, 1989, 1991, 1992, 1993, 1994, 1995
+ Copyright (C) 1986, 1989, 1991, 1992, 1993, 1994, 1995, 1996
Free Software Foundation, Inc.
This file is part of GDB.
#define DEFS_H
#include <stdio.h>
+#include <errno.h> /* System call error return status */
+
+/* Just in case they're not defined in stdio.h. */
+
+#ifndef SEEK_SET
+#define SEEK_SET 0
+#endif
+#ifndef SEEK_CUR
+#define SEEK_CUR 1
+#endif
/* First include ansidecl.h so we can use the various macro definitions
here and in all subsequent file inclusions. */
the program's identifiers (such as $this and $$vptr). */
#define CPLUS_MARKER '$' /* May be overridden to '.' for SysV */
-#include <errno.h> /* System call error return status */
+/* Check if a character is one of the commonly used C++ marker characters. */
+extern int is_cplus_marker PARAMS ((int));
extern int quit_flag;
extern int immediate_quit;
extern int putchar_unfiltered PARAMS ((int c));
-extern void puts_filtered PARAMS ((char *));
+extern void puts_filtered PARAMS ((const char *));
-extern void puts_unfiltered PARAMS ((char *));
+extern void puts_unfiltered PARAMS ((const char *));
-extern void vprintf_filtered PARAMS ((char *, va_list))
+extern void vprintf_filtered PARAMS ((const char *, va_list))
ATTR_FORMAT(printf, 1, 0);
-extern void vfprintf_filtered PARAMS ((FILE *, char *, va_list))
+extern void vfprintf_filtered PARAMS ((FILE *, const char *, va_list))
ATTR_FORMAT(printf, 2, 0);
-extern void fprintf_filtered PARAMS ((FILE *, char *, ...))
+extern void fprintf_filtered PARAMS ((FILE *, const char *, ...))
ATTR_FORMAT(printf, 2, 3);
-extern void fprintfi_filtered PARAMS ((int, FILE *, char *, ...))
+extern void fprintfi_filtered PARAMS ((int, FILE *, const char *, ...))
ATTR_FORMAT(printf, 3, 4);
-extern void printf_filtered PARAMS ((char *, ...))
+extern void printf_filtered PARAMS ((const char *, ...))
ATTR_FORMAT(printf, 1, 2);
-extern void printfi_filtered PARAMS ((int, char *, ...))
+extern void printfi_filtered PARAMS ((int, const char *, ...))
ATTR_FORMAT(printf, 2, 3);
-extern void vprintf_unfiltered PARAMS ((char *, va_list))
+extern void vprintf_unfiltered PARAMS ((const char *, va_list))
ATTR_FORMAT(printf, 1, 0);
-extern void vfprintf_unfiltered PARAMS ((FILE *, char *, va_list))
+extern void vfprintf_unfiltered PARAMS ((FILE *, const char *, va_list))
ATTR_FORMAT(printf, 2, 0);
-extern void fprintf_unfiltered PARAMS ((FILE *, char *, ...))
+extern void fprintf_unfiltered PARAMS ((FILE *, const char *, ...))
ATTR_FORMAT(printf, 2, 3);
-extern void printf_unfiltered PARAMS ((char *, ...))
+extern void printf_unfiltered PARAMS ((const char *, ...))
ATTR_FORMAT(printf, 1, 2);
extern void print_spaces PARAMS ((int, GDB_FILE *));
#endif /* MALLOC_INCOMPATIBLE */
-#ifndef WIN32
+#ifndef __WIN32__
#ifndef strchr
extern char *strchr ();
extern char *strerror ();
#endif
-#endif /* !WIN32 */
+#endif /* !__WIN32__ */
/* Various possibilities for alloca. */
#ifndef alloca
#endif
#ifndef SLASH_P
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(__WIN32__)
#define SLASH_P(X) ((X)=='\\')
#else
#define SLASH_P(X) ((X)=='/')
#endif
#ifndef SLASH_CHAR
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(__WIN32__)
#define SLASH_CHAR '\\'
#else
#define SLASH_CHAR '/'
#endif
#ifndef SLASH_STRING
-#if defined(__GO32__)||defined(WIN32)
+#if defined(__GO32__)||defined(__WIN32__)
#define SLASH_STRING "\\"
#else
#define SLASH_STRING "/"
/* 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.
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 ()
{
top_stack->numargs++;
/* Special GNU C++ name. */
- if (name[0] == CPLUS_MARKER && name[1] == 't' && name[2] == 0)
+ if (is_cplus_marker (name[0]) && name[1] == 't' && name[2] == 0)
name = "this"; /* FIXME, not alloc'd in obstack */
s = new_symbol (name);
/* Support routines for decoding "stabs" debugging information format.
- Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995
+ Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
Free Software Foundation, Inc.
This file is part of GDB.
SYMBOL_LINE(sym) = 0; /* unknown */
}
- if (string[0] == CPLUS_MARKER)
+ if (is_cplus_marker (string[0]))
{
/* Special GNU C++ names. */
switch (string[1])
make_cleanup (free, new_fnlist);
memset (new_fnlist, 0, sizeof (struct next_fnfieldlist));
- if ((*pp)[0] == 'o' && (*pp)[1] == 'p' && (*pp)[2] == CPLUS_MARKER)
+ if ((*pp)[0] == 'o' && (*pp)[1] == 'p' && is_cplus_marker ((*pp)[2]))
{
/* This is a completely wierd case. In order to stuff in the
names that might contain colons (the usual name delimiter),
/* If is starts with CPLUS_MARKER it is a special abbreviation,
unless the CPLUS_MARKER is followed by an underscore, in
which case it is just the name of an anonymous type, which we
- should handle like any other type name. We accept either '$'
- or '.', because a field name can never contain one of these
- characters except as a CPLUS_MARKER (we probably should be
- doing that in most parts of GDB). */
+ should handle like any other type name. */
- if ((*p == '$' || *p == '.') && p[1] != '_')
+ if (is_cplus_marker (p[0]) && p[1] != '_')
{
if (!read_cpp_abbrev (fip, pp, type, objfile))
return 0;
Note that this macro is g++ specific (FIXME). */
#define OPNAME_PREFIX_P(NAME) \
- ((NAME)[0] == 'o' && (NAME)[1] == 'p' && (NAME)[2] == CPLUS_MARKER)
+ ((NAME)[0] == 'o' && (NAME)[1] == 'p' && is_cplus_marker ((NAME)[2]))
/* Macro that yields non-zero value iff NAME is the prefix for C++ vtbl
names. Note that this macro is g++ specific (FIXME).
style, using thunks (where '$' is really CPLUS_MARKER). */
#define VTBL_PREFIX_P(NAME) \
- ((NAME)[3] == CPLUS_MARKER && (NAME)[0] == '_' \
+ ((NAME)[0] == '_' \
&& (((NAME)[1] == 'V' && (NAME)[2] == 'T') \
- || ((NAME)[1] == 'v' && (NAME)[2] == 't')))
+ || ((NAME)[1] == 'v' && (NAME)[2] == 't')) \
+ && is_cplus_marker ((NAME)[3]))
/* Macro that yields non-zero value iff NAME is the prefix for C++ destructor
names. Note that this macro is g++ specific (FIXME). */
#define DESTRUCTOR_PREFIX_P(NAME) \
- ((NAME)[0] == '_' && (NAME)[1] == CPLUS_MARKER && (NAME)[2] == '_')
+ ((NAME)[0] == '_' && is_cplus_marker ((NAME)[1]) && (NAME)[2] == '_')
\f
/* External variables and functions for the objects described above. */
extern struct objfile *current_objfile;
+/* True if we are nested inside psymtab_to_symtab. */
+
+extern int currently_reading_symtab;
+
/* From utils.c. */
extern int demangle;
extern int asm_demangle;
/* Low level packing and unpacking of values for GDB, the GNU Debugger.
- Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1995
+ Copyright 1986, 1987, 1989, 1991, 1993, 1994, 1995, 1996
Free Software Foundation, Inc.
This file is part of GDB.
if (*name != '_')
return 0;
/* gcc 2.4 uses _vb$. */
- if (name[1] == 'v' && name[2] == 'b' && name[3] == CPLUS_MARKER)
+ if (name[1] == 'v' && name[2] == 'b' && is_cplus_marker (name[3]))
field_class_name = name + 4;
/* gcc 2.5 will use __vb_. */
if (name[1] == '_' && name[2] == 'v' && name[3] == 'b' && name[4] == '_')