aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-07-09 04:40:39 +0000
committerFred Fish <fnf@specifix.com>1992-07-09 04:40:39 +0000
commit8050a57b2c1a8e7a54a81b540e6446d310a08b6b (patch)
tree94a82a32f7273ad3f341c172bf8ed44298ed10de /gdb/valprint.c
parente17e8e0e03750974d678548fae82ba44f038a1c9 (diff)
downloadgdb-8050a57b2c1a8e7a54a81b540e6446d310a08b6b.zip
gdb-8050a57b2c1a8e7a54a81b540e6446d310a08b6b.tar.gz
gdb-8050a57b2c1a8e7a54a81b540e6446d310a08b6b.tar.bz2
* 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.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index e8c99ec..0f4d276 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1700,7 +1700,7 @@ type_print_base (type, stream, show, level)
register int lastval;
char *mangled_name;
char *demangled_name;
-
+ enum {s_none, s_public, s_private, s_protected} section_type;
QUIT;
wrap_here (" ");
@@ -1731,7 +1731,8 @@ type_print_base (type, stream, show, level)
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:
@@ -1765,6 +1766,8 @@ type_print_base (type, stream, show, level)
/* 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;
@@ -1773,6 +1776,40 @@ type_print_base (type, stream, show, level)
!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))
{