mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-16 20:32:21 +08:00
* 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.
This commit is contained in:
@ -1,3 +1,31 @@
|
|||||||
|
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)
|
Wed Jul 8 17:23:07 1992 Stu Grossman (grossman at cygnus.com)
|
||||||
|
|
||||||
* Makefile.in (VERSION): Update to 4.5.8.
|
* Makefile.in (VERSION): Update to 4.5.8.
|
||||||
|
@ -2770,7 +2770,7 @@ read_struct_type (pp, type, objfile)
|
|||||||
}
|
}
|
||||||
else for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); --i)
|
else for (i = TYPE_NFIELDS (t) - 1; i >= TYPE_N_BASECLASSES (t); --i)
|
||||||
if (! strncmp (TYPE_FIELD_NAME (t, i), vptr_name,
|
if (! strncmp (TYPE_FIELD_NAME (t, i), vptr_name,
|
||||||
sizeof (vptr_name) -1))
|
sizeof (vptr_name) - 1))
|
||||||
{
|
{
|
||||||
TYPE_VPTR_FIELDNO (type) = i;
|
TYPE_VPTR_FIELDNO (type) = i;
|
||||||
break;
|
break;
|
||||||
|
@ -155,7 +155,7 @@ parse_number PARAMS ((char *, int, int, YYSTYPE *));
|
|||||||
|
|
||||||
%token <ssym> NAME_OR_INT NAME_OR_UINT
|
%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 TEMPLATE
|
||||||
%token ERROR
|
%token ERROR
|
||||||
|
|
||||||
@ -864,6 +864,9 @@ typebase
|
|||||||
| STRUCT name
|
| STRUCT name
|
||||||
{ $$ = lookup_struct (copy_name ($2),
|
{ $$ = lookup_struct (copy_name ($2),
|
||||||
expression_context_block); }
|
expression_context_block); }
|
||||||
|
| CLASS name
|
||||||
|
{ $$ = lookup_struct (copy_name ($2),
|
||||||
|
expression_context_block); }
|
||||||
| UNION name
|
| UNION name
|
||||||
{ $$ = lookup_union (copy_name ($2),
|
{ $$ = lookup_union (copy_name ($2),
|
||||||
expression_context_block); }
|
expression_context_block); }
|
||||||
@ -1366,6 +1369,8 @@ yylex ()
|
|||||||
return SIZEOF;
|
return SIZEOF;
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
|
if (!strncmp (tokstart, "class", 5))
|
||||||
|
return CLASS;
|
||||||
if (!strncmp (tokstart, "union", 5))
|
if (!strncmp (tokstart, "union", 5))
|
||||||
return UNION;
|
return UNION;
|
||||||
if (!strncmp (tokstart, "short", 5))
|
if (!strncmp (tokstart, "short", 5))
|
||||||
|
@ -699,11 +699,7 @@ alloc_utype (die_ref, utypep)
|
|||||||
{
|
{
|
||||||
if (utypep == NULL)
|
if (utypep == NULL)
|
||||||
{
|
{
|
||||||
utypep = (struct type *)
|
utypep = alloc_type (current_objfile);
|
||||||
obstack_alloc (¤t_objfile -> type_obstack,
|
|
||||||
sizeof (struct type));
|
|
||||||
memset (utypep, 0, sizeof (struct type));
|
|
||||||
TYPE_OBJFILE (utypep) = current_objfile;
|
|
||||||
}
|
}
|
||||||
*typep = utypep;
|
*typep = utypep;
|
||||||
}
|
}
|
||||||
@ -1117,11 +1113,7 @@ decode_subscr_data (scan, end)
|
|||||||
nexttype = decode_subscr_data (scan, end);
|
nexttype = decode_subscr_data (scan, end);
|
||||||
if (nexttype != NULL)
|
if (nexttype != NULL)
|
||||||
{
|
{
|
||||||
typep = (struct type *)
|
typep = alloc_type (current_objfile);
|
||||||
obstack_alloc (¤t_objfile -> type_obstack,
|
|
||||||
sizeof (struct type));
|
|
||||||
memset (typep, 0, sizeof (struct type));
|
|
||||||
TYPE_OBJFILE (typep) = current_objfile;
|
|
||||||
TYPE_CODE (typep) = TYPE_CODE_ARRAY;
|
TYPE_CODE (typep) = TYPE_CODE_ARRAY;
|
||||||
TYPE_LENGTH (typep) = TYPE_LENGTH (nexttype);
|
TYPE_LENGTH (typep) = TYPE_LENGTH (nexttype);
|
||||||
TYPE_LENGTH (typep) *= (highbound - lowbound) + 1;
|
TYPE_LENGTH (typep) *= (highbound - lowbound) + 1;
|
||||||
|
278
gdb/gdbtypes.c
278
gdb/gdbtypes.c
@ -335,7 +335,7 @@ create_array_type (element_type, number)
|
|||||||
TYPE_FIELD_TYPE (range_type, 0) = builtin_type_int; /* FIXME */
|
TYPE_FIELD_TYPE (range_type, 0) = builtin_type_int; /* FIXME */
|
||||||
TYPE_FIELD_TYPE (range_type, 1) = 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;
|
TYPE_VPTR_FIELDNO (result_type) = -1;
|
||||||
|
|
||||||
return (result_type);
|
return (result_type);
|
||||||
@ -740,7 +740,8 @@ check_stub_method (type, i, j)
|
|||||||
{
|
{
|
||||||
struct fn_field *f;
|
struct fn_field *f;
|
||||||
char *mangled_name = gdb_mangle_name (type, i, j);
|
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;
|
char *argtypetext, *p;
|
||||||
int depth = 0, argcount = 1;
|
int depth = 0, argcount = 1;
|
||||||
struct type **argtypes;
|
struct type **argtypes;
|
||||||
@ -1107,109 +1108,210 @@ lookup_fundamental_type (objfile, typeid)
|
|||||||
|
|
||||||
#if MAINTENANCE_CMDS
|
#if MAINTENANCE_CMDS
|
||||||
|
|
||||||
void recursive_dump_type (type, spaces)
|
static void
|
||||||
struct type *type;
|
print_bit_vector (bits, nbits)
|
||||||
int spaces;
|
B_TYPE *bits;
|
||||||
|
int nbits;
|
||||||
{
|
{
|
||||||
int idx;
|
int bitno;
|
||||||
struct field *fldp;
|
|
||||||
|
|
||||||
print_spaces_filtered (spaces, stdout);
|
for (bitno = 0; bitno < nbits; bitno++)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
case TYPE_CODE_UNDEF: printf_filtered ("TYPE_CODE_UNDEF"); break;
|
if ((bitno % 8) == 0)
|
||||||
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;
|
|
||||||
}
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
recursive_dump_type (type -> target_type, spaces + 2);
|
|
||||||
}
|
|
||||||
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++)
|
|
||||||
{
|
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
recursive_dump_type (fldp -> type, spaces + 4);
|
puts_filtered (" ");
|
||||||
|
}
|
||||||
|
if (B_TST (bits, bitno))
|
||||||
|
{
|
||||||
|
printf_filtered ("1");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf_filtered ("0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_spaces_filtered (spaces, stdout);
|
static void
|
||||||
printf_filtered ("vptr_basetype: 0x%x\n", type -> vptr_basetype);
|
print_cplus_stuff (type, spaces)
|
||||||
if (type -> vptr_basetype != NULL)
|
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 -> vptr_basetype, 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");
|
||||||
}
|
}
|
||||||
|
if (TYPE_NFIELDS (type) > 0)
|
||||||
|
{
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
print_spaces_filtered (spaces, stdout);
|
void
|
||||||
printf_filtered ("vptr_fieldno: %d\n", type -> vptr_fieldno);
|
recursive_dump_type (type, spaces)
|
||||||
|
struct type *type;
|
||||||
|
int spaces;
|
||||||
|
{
|
||||||
|
int idx;
|
||||||
|
|
||||||
switch (type -> code)
|
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))
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
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_METHOD:
|
||||||
case TYPE_CODE_FUNC:
|
case TYPE_CODE_FUNC:
|
||||||
print_spaces_filtered (spaces, stdout);
|
printfi_filtered (spaces, "arg_types: @ 0x%x\n",
|
||||||
printf_filtered ("arg_types: 0x%x\n",
|
TYPE_ARG_TYPES (type));
|
||||||
type -> type_specific.arg_types);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
print_spaces_filtered (spaces, stdout);
|
print_cplus_stuff (type, spaces);
|
||||||
printf_filtered ("cplus_stuff: 0x%x\n",
|
|
||||||
type -> type_specific.cplus_stuff);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,9 @@ struct type
|
|||||||
|
|
||||||
struct type **arg_types;
|
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 *cplus_stuff;
|
||||||
|
|
||||||
@ -244,11 +246,25 @@ struct type
|
|||||||
|
|
||||||
struct cplus_struct_type
|
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;
|
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;
|
B_TYPE *protected_field_bits;
|
||||||
|
|
||||||
/* Number of methods described for this type */
|
/* Number of methods described for this type */
|
||||||
|
85
gdb/symtab.c
85
gdb/symtab.c
@ -261,48 +261,58 @@ gdb_mangle_name (type, i, j)
|
|||||||
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
|
||||||
struct fn_field *method = &f[j];
|
struct fn_field *method = &f[j];
|
||||||
char *field_name = TYPE_FN_FIELDLIST_NAME (type, i);
|
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. */
|
/* Need a new type prefix. */
|
||||||
char *const_prefix = method->is_const ? "C" : "";
|
char *const_prefix = method->is_const ? "C" : "";
|
||||||
char *volatile_prefix = method->is_volatile ? "V" : "";
|
char *volatile_prefix = method->is_volatile ? "V" : "";
|
||||||
char *newname = type_name_no_tag (type);
|
|
||||||
char buf[20];
|
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))
|
mangled_name_len = ((is_constructor ? 0 : strlen (field_name))
|
||||||
+ strlen (buf) + len
|
+ strlen (buf) + strlen (physname) + 1);
|
||||||
+ strlen (TYPE_FN_FIELD_PHYSNAME (f, j))
|
|
||||||
+ 1);
|
|
||||||
|
|
||||||
/* Only needed for GNU-mangled names. ANSI-mangled names
|
/* Only needed for GNU-mangled names. ANSI-mangled names
|
||||||
work with the normal mechanisms. */
|
work with the normal mechanisms. */
|
||||||
if (OPNAME_PREFIX_P (field_name))
|
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)
|
if (opname == NULL)
|
||||||
error ("No mangling for \"%s\"", field_name);
|
{
|
||||||
|
error ("No mangling for \"%s\"", field_name);
|
||||||
|
}
|
||||||
mangled_name_len += strlen (opname);
|
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);
|
strncpy (mangled_name, field_name, 3);
|
||||||
mangled_name[3] = '\0';
|
strcpy (mangled_name + 3, opname);
|
||||||
strcat (mangled_name, opname);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mangled_name = (char *)xmalloc (mangled_name_len);
|
mangled_name = (char *) xmalloc (mangled_name_len);
|
||||||
if (is_constructor)
|
if (is_constructor)
|
||||||
mangled_name[0] = '\0';
|
{
|
||||||
|
mangled_name[0] = '\0';
|
||||||
|
}
|
||||||
else
|
else
|
||||||
strcpy (mangled_name, field_name);
|
{
|
||||||
|
strcpy (mangled_name, field_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
strcat (mangled_name, buf);
|
strcat (mangled_name, buf);
|
||||||
strcat (mangled_name, newname);
|
strcat (mangled_name, physname);
|
||||||
strcat (mangled_name, TYPE_FN_FIELD_PHYSNAME (f, j));
|
|
||||||
|
|
||||||
return mangled_name;
|
return (mangled_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1440,6 +1450,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
char *copy;
|
char *copy;
|
||||||
struct symbol *sym_class;
|
struct symbol *sym_class;
|
||||||
int i1;
|
int i1;
|
||||||
|
int is_quoted;
|
||||||
struct symbol **sym_arr;
|
struct symbol **sym_arr;
|
||||||
struct type *t;
|
struct type *t;
|
||||||
char **physnames;
|
char **physnames;
|
||||||
@ -1454,22 +1465,9 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
default_line = current_source_line;
|
default_line = current_source_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* See if arg is *PC */
|
||||||
|
|
||||||
/* Check to see if *ARGPTR points to a string that has been quoted with
|
if (**argptr == '*')
|
||||||
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 == '*')
|
||||||
{
|
{
|
||||||
@ -1486,7 +1484,8 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
|
|
||||||
/* Maybe arg is FILE : LINENUM or FILE : FUNCTION */
|
/* 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++)
|
for (p = *argptr; *p; p++)
|
||||||
{
|
{
|
||||||
@ -1495,7 +1494,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
}
|
}
|
||||||
while (p[0] == ' ' || p[0] == '\t') p++;
|
while (p[0] == ' ' || p[0] == '\t') p++;
|
||||||
|
|
||||||
if (p[0] == ':')
|
if ((p[0] == ':') && !is_quoted)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* C++ */
|
/* C++ */
|
||||||
@ -1532,7 +1531,7 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line)
|
|||||||
char *tmp = alloca (q1 - q + 1);
|
char *tmp = alloca (q1 - q + 1);
|
||||||
memcpy (tmp, q, q1 - q);
|
memcpy (tmp, q, q1 - q);
|
||||||
tmp[q1 - q] = '\0';
|
tmp[q1 - q] = '\0';
|
||||||
opname = cplus_mangle_opname (tmp, 1);
|
opname = cplus_mangle_opname (tmp, DMGL_ANSI);
|
||||||
if (opname == NULL)
|
if (opname == NULL)
|
||||||
{
|
{
|
||||||
warning ("no mangling for \"%s\"", tmp);
|
warning ("no mangling for \"%s\"", tmp);
|
||||||
@ -1857,6 +1856,7 @@ decode_line_2 (sym_arr, nelts, funfirstline)
|
|||||||
char *args, *arg1;
|
char *args, *arg1;
|
||||||
int i;
|
int i;
|
||||||
char *prompt;
|
char *prompt;
|
||||||
|
char *demangled;
|
||||||
|
|
||||||
values.sals = (struct symtab_and_line *) alloca (nelts * sizeof(struct symtab_and_line));
|
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));
|
return_values.sals = (struct symtab_and_line *) xmalloc (nelts * sizeof(struct symtab_and_line));
|
||||||
@ -1875,8 +1875,15 @@ decode_line_2 (sym_arr, nelts, funfirstline)
|
|||||||
values.sals[i] = find_pc_line (pc, 0);
|
values.sals[i] = find_pc_line (pc, 0);
|
||||||
values.sals[i].pc = (values.sals[i].end && values.sals[i].pc != pc) ?
|
values.sals[i].pc = (values.sals[i].end && values.sals[i].pc != pc) ?
|
||||||
values.sals[i].end : pc;
|
values.sals[i].end : pc;
|
||||||
printf("[%d] file:%s; line number:%d\n",
|
demangled = cplus_demangle (SYMBOL_NAME (sym_arr[i]),
|
||||||
(i+2), values.sals[i].symtab->filename, values.sals[i].line);
|
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");
|
else printf ("?HERE\n");
|
||||||
i++;
|
i++;
|
||||||
@ -2042,7 +2049,7 @@ static int
|
|||||||
name_match (name)
|
name_match (name)
|
||||||
char *name;
|
char *name;
|
||||||
{
|
{
|
||||||
char *demangled = cplus_demangle (name, 0);
|
char *demangled = cplus_demangle (name, DMGL_ANSI);
|
||||||
if (demangled != NULL)
|
if (demangled != NULL)
|
||||||
{
|
{
|
||||||
int cond = re_exec (demangled);
|
int cond = re_exec (demangled);
|
||||||
|
@ -1700,7 +1700,7 @@ type_print_base (type, stream, show, level)
|
|||||||
register int lastval;
|
register int lastval;
|
||||||
char *mangled_name;
|
char *mangled_name;
|
||||||
char *demangled_name;
|
char *demangled_name;
|
||||||
|
enum {s_none, s_public, s_private, s_protected} section_type;
|
||||||
QUIT;
|
QUIT;
|
||||||
|
|
||||||
wrap_here (" ");
|
wrap_here (" ");
|
||||||
@ -1731,7 +1731,8 @@ type_print_base (type, stream, show, level)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
fprintf_filtered (stream, "struct ");
|
fprintf_filtered (stream,
|
||||||
|
HAVE_CPLUS_STRUCT (type) ? "class " : "struct ");
|
||||||
goto struct_union;
|
goto struct_union;
|
||||||
|
|
||||||
case TYPE_CODE_UNION:
|
case TYPE_CODE_UNION:
|
||||||
@ -1765,6 +1766,8 @@ type_print_base (type, stream, show, level)
|
|||||||
|
|
||||||
/* If there is a base class for this type,
|
/* If there is a base class for this type,
|
||||||
do not print the field that it occupies. */
|
do not print the field that it occupies. */
|
||||||
|
|
||||||
|
section_type = s_none;
|
||||||
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
|
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
|
||||||
{
|
{
|
||||||
QUIT;
|
QUIT;
|
||||||
@ -1773,6 +1776,40 @@ type_print_base (type, stream, show, level)
|
|||||||
!strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
|
!strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5))
|
||||||
continue;
|
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);
|
print_spaces_filtered (level + 4, stream);
|
||||||
if (TYPE_FIELD_STATIC (type, i))
|
if (TYPE_FIELD_STATIC (type, i))
|
||||||
{
|
{
|
||||||
|
@ -27,6 +27,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
#include "command.h"
|
#include "command.h"
|
||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
#include "target.h"
|
#include "target.h"
|
||||||
|
#include "demangle.h"
|
||||||
|
|
||||||
/* Local function prototypes. */
|
/* Local function prototypes. */
|
||||||
|
|
||||||
@ -1067,7 +1068,7 @@ value_headof (arg, btype, dtype)
|
|||||||
{
|
{
|
||||||
pc_for_sym = value_as_pointer (value_field (best_entry, 2));
|
pc_for_sym = value_as_pointer (value_field (best_entry, 2));
|
||||||
sym = find_pc_function (pc_for_sym);
|
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';
|
*(strchr (demangled_name, ':')) = '\0';
|
||||||
}
|
}
|
||||||
sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);
|
sym = lookup_symbol (demangled_name, 0, VAR_NAMESPACE, 0, 0);
|
||||||
|
Reference in New Issue
Block a user