to create new blank types, instead of handcrafting them.
* defs.h (printfi_filtered): Add prototype.
* utils.c (printfi_filtered): New function.
* gdbtypes.c (recursive_dump_type): Use printfi_filtered to
to simplify the code. Other cleanups.
* gdbtypes.c (check_stub_method): Demangle using DMGL_ANSI.
* gdbtypes.h (struct cplus_struct_type): Add comments describing
use of various fields.
* gdbtypes.c (print_bit_vector, print_cplus_stuff): New functions.
* c-exp.y (%token): Add CLASS as a token for C++, add grammar
production that currently treats it exactly the same as STRUCT.
* c-exp.y (yylex): Recognize "class" as token CLASS.
* symtab.c (gdb_mangle_name): Rewrite to match current g++ stabs.
* symtab.c (decode_line_1): Fix to pass quoted args on down to
general symbol handling code. Call cplus_mangle_opname with
DMGL_ANSI.
* symtab.c (decode_line_2): Print demangled function names in
breakpoint menus, instead of just file and line number.
* symtab.c (name_match): Call cplus_demangle with DMGL_ANSI.
* valprint.c (type_print_base): Print "class" for C++ classes,
rather than "struct". Print section labels for public, protected
and private members of C++ classes.
* values.c: Include demangle.h.
* values.c (value_headof): Call cplus_demangle with DMGL_ANSI.
+Wed Jul 8 21:34:30 1992 Fred Fish (fnf@cygnus.com)
+
+ * dwarfread.c (alloc_utype, decode_subscr_data): Call alloc_type
+ to create new blank types, instead of handcrafting them.
+ * defs.h (printfi_filtered): Add prototype.
+ * utils.c (printfi_filtered): New function.
+ * gdbtypes.c (recursive_dump_type): Use printfi_filtered to
+ to simplify the code. Other cleanups.
+ * gdbtypes.c (check_stub_method): Demangle using DMGL_ANSI.
+ * gdbtypes.h (struct cplus_struct_type): Add comments describing
+ use of various fields.
+ * gdbtypes.c (print_bit_vector, print_cplus_stuff): New functions.
+ * c-exp.y (%token): Add CLASS as a token for C++, add grammar
+ production that currently treats it exactly the same as STRUCT.
+ * c-exp.y (yylex): Recognize "class" as token CLASS.
+ * symtab.c (gdb_mangle_name): Rewrite to match current g++ stabs.
+ * symtab.c (decode_line_1): Fix to pass quoted args on down to
+ general symbol handling code. Call cplus_mangle_opname with
+ DMGL_ANSI.
+ * symtab.c (decode_line_2): Print demangled function names in
+ breakpoint menus, instead of just file and line number.
+ * symtab.c (name_match): Call cplus_demangle with DMGL_ANSI.
+ * valprint.c (type_print_base): Print "class" for C++ classes,
+ rather than "struct". Print section labels for public, protected
+ and private members of C++ classes.
+ * values.c: Include demangle.h.
+ * values.c (value_headof): Call cplus_demangle with DMGL_ANSI.
+
Wed Jul 8 17:23:07 1992 Stu Grossman (grossman at cygnus.com)
* Makefile.in (VERSION): Update to 4.5.8.
}
else for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); --i)
if (! strncmp (TYPE_FIELD_NAME (t, i), vptr_name,
- sizeof (vptr_name) -1))
+ sizeof (vptr_name) - 1))
{
TYPE_VPTR_FIELDNO (type) = i;
break;
%token <ssym> NAME_OR_INT NAME_OR_UINT
-%token STRUCT UNION ENUM SIZEOF UNSIGNED COLONCOLON
+%token STRUCT CLASS UNION ENUM SIZEOF UNSIGNED COLONCOLON
%token TEMPLATE
%token ERROR
| STRUCT name
{ $$ = lookup_struct (copy_name ($2),
expression_context_block); }
+ | CLASS name
+ { $$ = lookup_struct (copy_name ($2),
+ expression_context_block); }
| UNION name
{ $$ = lookup_union (copy_name ($2),
expression_context_block); }
return SIZEOF;
break;
case 5:
+ if (!strncmp (tokstart, "class", 5))
+ return CLASS;
if (!strncmp (tokstart, "union", 5))
return UNION;
if (!strncmp (tokstart, "short", 5))
{
if (utypep == NULL)
{
- utypep = (struct type *)
- obstack_alloc (¤t_objfile -> type_obstack,
- sizeof (struct type));
- memset (utypep, 0, sizeof (struct type));
- TYPE_OBJFILE (utypep) = current_objfile;
+ utypep = alloc_type (current_objfile);
}
*typep = utypep;
}
nexttype = decode_subscr_data (scan, end);
if (nexttype != NULL)
{
- typep = (struct type *)
- obstack_alloc (¤t_objfile -> type_obstack,
- sizeof (struct type));
- memset (typep, 0, sizeof (struct type));
- TYPE_OBJFILE (typep) = current_objfile;
+ typep = alloc_type (current_objfile);
TYPE_CODE (typep) = TYPE_CODE_ARRAY;
TYPE_LENGTH (typep) = TYPE_LENGTH (nexttype);
TYPE_LENGTH (typep) *= (highbound - lowbound) + 1;
TYPE_FIELD_TYPE (range_type, 0) = builtin_type_int; /* FIXME */
TYPE_FIELD_TYPE (range_type, 1) = builtin_type_int; /* FIXME */
}
- TYPE_FIELD_TYPE(result_type,0)=range_type;
+ TYPE_FIELD_TYPE (result_type, 0) = range_type;
TYPE_VPTR_FIELDNO (result_type) = -1;
return (result_type);
{
struct fn_field *f;
char *mangled_name = gdb_mangle_name (type, i, j);
- char *demangled_name = cplus_demangle (mangled_name, DMGL_PARAMS);
+ char *demangled_name = cplus_demangle (mangled_name,
+ DMGL_PARAMS | DMGL_ANSI);
char *argtypetext, *p;
int depth = 0, argcount = 1;
struct type **argtypes;
#if MAINTENANCE_CMDS
-void recursive_dump_type (type, spaces)
- struct type *type;
- int spaces;
+static void
+print_bit_vector (bits, nbits)
+ B_TYPE *bits;
+ int nbits;
{
- int idx;
- struct field *fldp;
-
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("type node @ 0x%x\n", type);
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("name: 0x%x '%s'\n", type -> name,
- type -> name ? type -> name : "<NULL>");
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("code: 0x%x ", type -> code);
- switch (type -> code)
+ int bitno;
+
+ for (bitno = 0; bitno < nbits; bitno++)
{
- case TYPE_CODE_UNDEF: printf_filtered ("TYPE_CODE_UNDEF"); break;
- case TYPE_CODE_PTR: printf_filtered ("TYPE_CODE_PTR"); break;
- case TYPE_CODE_ARRAY: printf_filtered ("TYPE_CODE_ARRAY"); break;
- case TYPE_CODE_STRUCT: printf_filtered ("TYPE_CODE_STRUCT"); break;
- case TYPE_CODE_UNION: printf_filtered ("TYPE_CODE_UNION"); break;
- case TYPE_CODE_ENUM: printf_filtered ("TYPE_CODE_ENUM"); break;
- case TYPE_CODE_FUNC: printf_filtered ("TYPE_CODE_FUNC"); break;
- case TYPE_CODE_INT: printf_filtered ("TYPE_CODE_INT"); break;
- case TYPE_CODE_FLT: printf_filtered ("TYPE_CODE_FLT"); break;
- case TYPE_CODE_VOID: printf_filtered ("TYPE_CODE_VOID"); break;
- case TYPE_CODE_SET: printf_filtered ("TYPE_CODE_SET"); break;
- case TYPE_CODE_RANGE: printf_filtered ("TYPE_CODE_RANGE"); break;
- case TYPE_CODE_PASCAL_ARRAY: printf_filtered ("TYPE_CODE_PASCAL_ARRAY"); break;
- case TYPE_CODE_ERROR: printf_filtered ("TYPE_CODE_ERROR"); break;
- case TYPE_CODE_MEMBER: printf_filtered ("TYPE_CODE_MEMBER"); break;
- case TYPE_CODE_METHOD: printf_filtered ("TYPE_CODE_METHOD"); break;
- case TYPE_CODE_REF: printf_filtered ("TYPE_CODE_REF"); break;
- case TYPE_CODE_CHAR: printf_filtered ("TYPE_CODE_CHAR"); break;
- case TYPE_CODE_BOOL: printf_filtered ("TYPE_CODE_BOOL"); break;
- default: printf_filtered ("<UNKNOWN TYPE CODE>"); break;
+ if ((bitno % 8) == 0)
+ {
+ puts_filtered (" ");
+ }
+ if (B_TST (bits, bitno))
+ {
+ printf_filtered ("1");
+ }
+ else
+ {
+ printf_filtered ("0");
+ }
}
- printf_filtered ("\n");
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("length: %d\n", type -> length);
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("objfile: 0x%x\n", type -> objfile);
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("target_type: 0x%x\n", type -> target_type);
- if (type -> target_type != NULL)
+}
+
+static void
+print_cplus_stuff (type, spaces)
+ struct type *type;
+ int spaces;
+{
+ int bitno;
+
+ printfi_filtered (spaces, "cplus_stuff: @ 0x%x\n",
+ TYPE_CPLUS_SPECIFIC (type));
+ printfi_filtered (spaces, "n_baseclasses: %d\n",
+ TYPE_N_BASECLASSES (type));
+ if (TYPE_N_BASECLASSES (type) > 0)
{
- recursive_dump_type (type -> target_type, spaces + 2);
+ printfi_filtered (spaces, "virtual_field_bits: %d @ 0x%x:",
+ TYPE_N_BASECLASSES (type),
+ TYPE_FIELD_VIRTUAL_BITS (type));
+ print_bit_vector (TYPE_FIELD_VIRTUAL_BITS (type),
+ TYPE_N_BASECLASSES (type));
+ puts_filtered ("\n");
}
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("pointer_type: 0x%x\n", type -> pointer_type);
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("reference_type: 0x%x\n", type -> reference_type);
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("function_type: 0x%x\n", type -> function_type);
-
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("flags: 0x%x", type -> flags);
- if (type -> flags & TYPE_FLAG_UNSIGNED)
- printf_filtered (" TYPE_FLAG_UNSIGNED");
- if (type -> flags & TYPE_FLAG_SIGNED)
- printf_filtered (" TYPE_FLAG_SIGNED");
- if (type -> flags & TYPE_FLAG_STUB)
- printf_filtered (" TYPE_FLAG_STUB");
- printf_filtered ("\n");
-
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("nfields: %d at 0x%x\n", type -> nfields, type -> fields);
- for (idx = 0; idx < type -> nfields; idx++)
+ if (TYPE_NFIELDS (type) > 0)
{
- fldp = &(type -> fields[idx]);
- print_spaces_filtered (spaces + 2, stdout);
- printf_filtered ("[%d] bitpos %d bitsize %d type 0x%x name 0x%x '%s'\n",
- idx, fldp -> bitpos, fldp -> bitsize, fldp -> type,
- fldp -> name, fldp -> name ? fldp -> name : "<NULL>");
- if (fldp -> type != NULL)
+ if (TYPE_FIELD_PRIVATE_BITS (type) != NULL)
+ {
+ printfi_filtered (spaces, "private_field_bits: %d @ 0x%x:",
+ TYPE_NFIELDS (type),
+ TYPE_FIELD_PRIVATE_BITS (type));
+ print_bit_vector (TYPE_FIELD_PRIVATE_BITS (type),
+ TYPE_NFIELDS (type));
+ puts_filtered ("\n");
+ }
+ if (TYPE_FIELD_PROTECTED_BITS (type) != NULL)
{
- recursive_dump_type (fldp -> type, spaces + 4);
+ printfi_filtered (spaces, "protected_field_bits: %d @ 0x%x:",
+ TYPE_NFIELDS (type),
+ TYPE_FIELD_PROTECTED_BITS (type));
+ print_bit_vector (TYPE_FIELD_PROTECTED_BITS (type),
+ TYPE_NFIELDS (type));
+ puts_filtered ("\n");
}
}
+}
+
+void
+recursive_dump_type (type, spaces)
+ struct type *type;
+ int spaces;
+{
+ int idx;
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("vptr_basetype: 0x%x\n", type -> vptr_basetype);
- if (type -> vptr_basetype != NULL)
+ printfi_filtered (spaces, "type node @ 0x%x\n", type);
+ printfi_filtered (spaces, "name: @ 0x%x '%s'\n", TYPE_NAME (type),
+ TYPE_NAME (type) ? TYPE_NAME (type) : "<NULL>");
+ printfi_filtered (spaces, "code: 0x%x ", TYPE_CODE (type));
+ switch (TYPE_CODE (type))
{
- recursive_dump_type (type -> vptr_basetype, spaces + 2);
+ case TYPE_CODE_UNDEF:
+ printf_filtered ("TYPE_CODE_UNDEF");
+ break;
+ case TYPE_CODE_PTR:
+ printf_filtered ("TYPE_CODE_PTR");
+ break;
+ case TYPE_CODE_ARRAY:
+ printf_filtered ("TYPE_CODE_ARRAY");
+ break;
+ case TYPE_CODE_STRUCT:
+ printf_filtered ("TYPE_CODE_STRUCT");
+ break;
+ case TYPE_CODE_UNION:
+ printf_filtered ("TYPE_CODE_UNION");
+ break;
+ case TYPE_CODE_ENUM:
+ printf_filtered ("TYPE_CODE_ENUM");
+ break;
+ case TYPE_CODE_FUNC:
+ printf_filtered ("TYPE_CODE_FUNC");
+ break;
+ case TYPE_CODE_INT:
+ printf_filtered ("TYPE_CODE_INT");
+ break;
+ case TYPE_CODE_FLT:
+ printf_filtered ("TYPE_CODE_FLT");
+ break;
+ case TYPE_CODE_VOID:
+ printf_filtered ("TYPE_CODE_VOID");
+ break;
+ case TYPE_CODE_SET:
+ printf_filtered ("TYPE_CODE_SET");
+ break;
+ case TYPE_CODE_RANGE:
+ printf_filtered ("TYPE_CODE_RANGE");
+ break;
+ case TYPE_CODE_PASCAL_ARRAY:
+ printf_filtered ("TYPE_CODE_PASCAL_ARRAY");
+ break;
+ case TYPE_CODE_ERROR:
+ printf_filtered ("TYPE_CODE_ERROR");
+ break;
+ case TYPE_CODE_MEMBER:
+ printf_filtered ("TYPE_CODE_MEMBER");
+ break;
+ case TYPE_CODE_METHOD:
+ printf_filtered ("TYPE_CODE_METHOD");
+ break;
+ case TYPE_CODE_REF:
+ printf_filtered ("TYPE_CODE_REF");
+ break;
+ case TYPE_CODE_CHAR:
+ printf_filtered ("TYPE_CODE_CHAR");
+ break;
+ case TYPE_CODE_BOOL:
+ printf_filtered ("TYPE_CODE_BOOL");
+ break;
+ default:
+ printf_filtered ("<UNKNOWN TYPE CODE>");
+ break;
}
-
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("vptr_fieldno: %d\n", type -> vptr_fieldno);
-
- switch (type -> code)
+ puts_filtered ("\n");
+ printfi_filtered (spaces, "length: %d\n", TYPE_LENGTH (type));
+ printfi_filtered (spaces, "objfile: @ 0x%x\n", TYPE_OBJFILE (type));
+ printfi_filtered (spaces, "target_type: @ 0x%x\n", TYPE_TARGET_TYPE (type));
+ if (TYPE_TARGET_TYPE (type) != NULL)
+ {
+ recursive_dump_type (TYPE_TARGET_TYPE (type), spaces + 2);
+ }
+ printfi_filtered (spaces, "pointer_type: @ 0x%x\n",
+ TYPE_POINTER_TYPE (type));
+ printfi_filtered (spaces, "reference_type: @ 0x%x\n",
+ TYPE_REFERENCE_TYPE (type));
+ printfi_filtered (spaces, "function_type: @ 0x%x\n",
+ TYPE_FUNCTION_TYPE (type));
+ printfi_filtered (spaces, "flags: 0x%x", TYPE_FLAGS (type));
+ if (TYPE_FLAGS (type) & TYPE_FLAG_UNSIGNED)
+ {
+ puts_filtered (" TYPE_FLAG_UNSIGNED");
+ }
+ if (TYPE_FLAGS (type) & TYPE_FLAG_SIGNED)
+ {
+ puts_filtered (" TYPE_FLAG_SIGNED");
+ }
+ if (TYPE_FLAGS (type) & TYPE_FLAG_STUB)
+ {
+ puts_filtered (" TYPE_FLAG_STUB");
+ }
+ puts_filtered ("\n");
+ printfi_filtered (spaces, "nfields: %d @ 0x%x\n", TYPE_NFIELDS (type),
+ TYPE_FIELDS (type));
+ for (idx = 0; idx < TYPE_NFIELDS (type); idx++)
+ {
+ printfi_filtered (spaces + 2,
+ "[%d] bitpos %d bitsize %d type 0x%x name 0x%x '%s'\n",
+ idx, TYPE_FIELD_BITPOS (type, idx),
+ TYPE_FIELD_BITSIZE (type, idx),
+ TYPE_FIELD_TYPE (type, idx),
+ TYPE_FIELD_NAME (type, idx),
+ TYPE_FIELD_NAME (type, idx) != NULL
+ ? TYPE_FIELD_NAME (type, idx)
+ : "<NULL>");
+ if (TYPE_FIELD_TYPE (type, idx) != NULL)
+ {
+ recursive_dump_type (TYPE_FIELD_TYPE (type, idx), spaces + 4);
+ }
+ }
+ printfi_filtered (spaces, "vptr_basetype: @ 0x%x\n",
+ TYPE_VPTR_BASETYPE (type));
+ if (TYPE_VPTR_BASETYPE (type) != NULL)
+ {
+ recursive_dump_type (TYPE_VPTR_BASETYPE (type), spaces + 2);
+ }
+ printfi_filtered (spaces, "vptr_fieldno: %d\n", TYPE_VPTR_FIELDNO (type));
+ switch (TYPE_CODE (type))
{
case TYPE_CODE_METHOD:
case TYPE_CODE_FUNC:
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("arg_types: 0x%x\n",
- type -> type_specific.arg_types);
+ printfi_filtered (spaces, "arg_types: @ 0x%x\n",
+ TYPE_ARG_TYPES (type));
break;
case TYPE_CODE_STRUCT:
- print_spaces_filtered (spaces, stdout);
- printf_filtered ("cplus_stuff: 0x%x\n",
- type -> type_specific.cplus_stuff);
+ print_cplus_stuff (type, spaces);
break;
}
}
struct type **arg_types;
- /* CPLUS_STUFF is for TYPE_CODE_STRUCT. */
+ /* CPLUS_STUFF is for TYPE_CODE_STRUCT. It is initialized to point to
+ cplus_struct_default, a default static instance of a struct
+ cplus_struct_type. */
struct cplus_struct_type *cplus_stuff;
struct cplus_struct_type
{
+ /* For derived classes, the number of base classes is given by
+ n_baseclasses and virtual_field_bits is a bit vector containing one bit
+ per base class.
+ If the base class is virtual, the corresponding bit will be set. */
- B_TYPE *virtual_field_bits; /* if base class is virtual */
+ B_TYPE *virtual_field_bits;
+
+ /* For classes with private fields, the number of fields is given by
+ nfields and private_field_bits is a bit vector containing one bit
+ per field.
+ If the field is private, the corresponding bit will be set. */
B_TYPE *private_field_bits;
+ /* For classes with protected fields, the number of fields is given by
+ nfields and protected_field_bits is a bit vector containing one bit
+ per field.
+ If the field is private, the corresponding bit will be set. */
+
B_TYPE *protected_field_bits;
/* Number of methods described for this type */
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
struct fn_field *method = &f[j];
char *field_name = TYPE_FN_FIELDLIST_NAME (type, i);
- int is_constructor = strcmp(field_name, TYPE_NAME (type)) == 0;
+ char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
+ char *opname;
+ int is_constructor = strcmp (field_name, type_name_no_tag (type)) == 0;
/* Need a new type prefix. */
char *const_prefix = method->is_const ? "C" : "";
char *volatile_prefix = method->is_volatile ? "V" : "";
- char *newname = type_name_no_tag (type);
char buf[20];
- int len = strlen (newname);
- sprintf (buf, "__%s%s%d", const_prefix, volatile_prefix, len);
+ if (is_constructor)
+ {
+ buf[0] = '\0';
+ }
+ else
+ {
+ sprintf (buf, "__%s%s", const_prefix, volatile_prefix);
+ }
+
mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
- + strlen (buf) + len
- + strlen (TYPE_FN_FIELD_PHYSNAME (f, j))
- + 1);
+ + strlen (buf) + strlen (physname) + 1);
/* Only needed for GNU-mangled names. ANSI-mangled names
work with the normal mechanisms. */
if (OPNAME_PREFIX_P (field_name))
{
- char *opname = cplus_mangle_opname (field_name + 3, 0);
+ opname = cplus_mangle_opname (field_name + 3, 0);
if (opname == NULL)
- error ("No mangling for \"%s\"", field_name);
+ {
+ error ("No mangling for \"%s\"", field_name);
+ }
mangled_name_len += strlen (opname);
- mangled_name = (char *)xmalloc (mangled_name_len);
+ mangled_name = (char *) xmalloc (mangled_name_len);
strncpy (mangled_name, field_name, 3);
- mangled_name[3] = '\0';
- strcat (mangled_name, opname);
+ strcpy (mangled_name + 3, opname);
}
else
{
- mangled_name = (char *)xmalloc (mangled_name_len);
+ mangled_name = (char *) xmalloc (mangled_name_len);
if (is_constructor)
- mangled_name[0] = '\0';
+ {
+ mangled_name[0] = '\0';
+ }
else
- strcpy (mangled_name, field_name);
+ {
+ strcpy (mangled_name, field_name);
+ }
}
strcat (mangled_name, buf);
- strcat (mangled_name, newname);
- strcat (mangled_name, TYPE_FN_FIELD_PHYSNAME (f, j));
+ strcat (mangled_name, physname);
- return mangled_name;
+ return (mangled_name);
}
\f
char *copy;
struct symbol *sym_class;
int i1;
+ int is_quoted;
struct symbol **sym_arr;
struct type *t;
char **physnames;
default_line = current_source_line;
}
+ /* See if arg is *PC */
- /* Check to see if *ARGPTR points to a string that has been quoted with
- gdb_completer_quote_characters. If so, P will be left pointing at
- someplace other than *ARGPTR */
-
- if (((p = skip_quoted (*argptr)) != *argptr) &&
- ((*(p - 1) != **argptr) ||
- (strchr (gdb_completer_quote_characters, **argptr) == NULL)))
- {
- /* Not quoted symbol string specification, reset P */
- p = *argptr;
- }
-
- /* See if arg is *PC or '<some symbol specifier string>' */
-
- if ((**argptr == '*') || (p != *argptr))
+ if (**argptr == '*')
{
if (**argptr == '*')
{
/* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
- s = 0;
+ s = NULL;
+ is_quoted = (strchr (gdb_completer_quote_characters, **argptr) != NULL);
for (p = *argptr; *p; p++)
{
}
while (p[0] == ' ' || p[0] == '\t') p++;
- if (p[0] == ':')
+ if ((p[0] == ':') && !is_quoted)
{
/* C++ */
char *tmp = alloca (q1 - q + 1);
memcpy (tmp, q, q1 - q);
tmp[q1 - q] = '\0';
- opname = cplus_mangle_opname (tmp, 1);
+ opname = cplus_mangle_opname (tmp, DMGL_ANSI);
if (opname == NULL)
{
warning ("no mangling for \"%s\"", tmp);
char *args, *arg1;
int i;
char *prompt;
+ char *demangled;
values.sals = (struct symtab_and_line *) alloca (nelts * sizeof(struct symtab_and_line));
return_values.sals = (struct symtab_and_line *) xmalloc (nelts * sizeof(struct symtab_and_line));
values.sals[i] = find_pc_line (pc, 0);
values.sals[i].pc = (values.sals[i].end && values.sals[i].pc != pc) ?
values.sals[i].end : pc;
- printf("[%d] file:%s; line number:%d\n",
- (i+2), values.sals[i].symtab->filename, values.sals[i].line);
+ demangled = cplus_demangle (SYMBOL_NAME (sym_arr[i]),
+ DMGL_PARAMS | DMGL_ANSI);
+ printf("[%d] %s at %s:%d\n", (i+2),
+ demangled ? demangled : SYMBOL_NAME (sym_arr[i]),
+ values.sals[i].symtab->filename, values.sals[i].line);
+ if (demangled != NULL)
+ {
+ free (demangled);
+ }
}
else printf ("?HERE\n");
i++;
name_match (name)
char *name;
{
- char *demangled = cplus_demangle (name, 0);
+ char *demangled = cplus_demangle (name, DMGL_ANSI);
if (demangled != NULL)
{
int cond = re_exec (demangled);
register int lastval;
char *mangled_name;
char *demangled_name;
-
+ enum {s_none, s_public, s_private, s_protected} section_type;
QUIT;
wrap_here (" ");
break;
case TYPE_CODE_STRUCT:
- fprintf_filtered (stream, "struct ");
+ fprintf_filtered (stream,
+ HAVE_CPLUS_STRUCT (type) ? "class " : "struct ");
goto struct_union;
case TYPE_CODE_UNION:
/* If there is a base class for this type,
do not print the field that it occupies. */
+
+ section_type = s_none;
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
QUIT;
!strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
continue;
+ /* If this is a C++ class we can print the various C++ section
+ labels. */
+
+ if (HAVE_CPLUS_STRUCT (type))
+ {
+ if (TYPE_FIELD_PROTECTED (type, i))
+ {
+ if (section_type != s_protected)
+ {
+ section_type = s_protected;
+ print_spaces_filtered (level + 4, stream);
+ fprintf_filtered (stream, "protected:\n");
+ }
+ }
+ else if (TYPE_FIELD_PRIVATE (type, i))
+ {
+ if (section_type != s_private)
+ {
+ section_type = s_private;
+ print_spaces_filtered (level + 4, stream);
+ fprintf_filtered (stream, "private:\n");
+ }
+ }
+ else
+ {
+ if (section_type != s_public)
+ {
+ section_type = s_public;
+ print_spaces_filtered (level + 4, stream);
+ fprintf_filtered (stream, "public:\n");
+ }
+ }
+ }
+
print_spaces_filtered (level + 4, stream);
if (TYPE_FIELD_STATIC (type, i))
{
#include "command.h"
#include "gdbcmd.h"
#include "target.h"
+#include "demangle.h"
/* Local function prototypes. */
{
pc_for_sym = value_as_pointer (value_field (best_entry, 2));
sym = find_pc_function (pc_for_sym);
- demangled_name = cplus_demangle (SYMBOL_NAME (sym), 0);
+ demangled_name = cplus_demangle (SYMBOL_NAME (sym), DMGL_ANSI);
*(strchr (demangled_name, ':')) = '\0';
}
sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);