This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
(patch) hpjyg04: c-typeprint.c c-valprint.c
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: (patch) hpjyg04: c-typeprint.c c-valprint.c
- From: Jimmy Guo <guo at cup dot hp dot com>
- Date: Mon, 1 Nov 1999 12:15:24 -0800 (PST)
Small patch for c-typeprint.c and c-typeprint.c -- see ChangeLog.
- Jimmy Guo, guo@cup.hp.com
Index: gdb/ChangeLog
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/ChangeLog gdb/ChangeLog
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/ChangeLog Mon Nov 1 11:30:10 1999
--- gdb/ChangeLog Mon Nov 1 12:10:23 1999
***************
*** 1,4 ****
--- 1,12 ----
1999-11-01 Jimmy Guo <guo@cup.hp.com>
+ * c-typeprint.c
+ (c_type_print_varspec_prefix,c_type_print_varpsec_suffix): Add
+ TYPE_CODE_TEMPLATE case and default case.
+ (c_type_print_base): Revise how demangled_no_class is found;
+ print '}' before printing local file:line info.
+ * c-valprint.c (c_value_print): print reference type to class.
+
+ 1999-11-01 Jimmy Guo <guo@cup.hp.com>
* buildsym.h (add_free_pendings): Declare.
Index: gdb/c-typeprint.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/c-typeprint.c gdb/c-typeprint.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/c-typeprint.c Fri Oct 29 16:09:22 1999
--- gdb/c-typeprint.c Fri Oct 29 16:25:52 1999
***************
*** 338,346 ****
--- 338,350 ----
case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
+ case TYPE_CODE_TEMPLATE:
/* These types need no prefix. They are listed here so that
gcc -Wall will reveal any types that haven't been handled. */
break;
+ default:
+ error ("type not handled in c_type_print_varspec_prefix()");
+ break;
}
}
***************
*** 530,538 ****
--- 534,546 ----
case TYPE_CODE_BITSTRING:
case TYPE_CODE_COMPLEX:
case TYPE_CODE_TYPEDEF:
+ case TYPE_CODE_TEMPLATE:
/* These types do not need a suffix. They are listed so that
gcc -Wall will report types that may not have been considered. */
break;
+ default:
+ error ("type not handled in c_type_print_varspec_suffix()");
+ break;
}
}
***************
*** 766,772 ****
if (TYPE_HAS_VTABLE (type) && (STREQN (TYPE_FIELD_NAME (type, i), "__vfp", 5)))
continue;
/* Other compilers */
- /* pai:: FIXME : check for has_vtable < 0 */
if (STREQN (TYPE_FIELD_NAME (type, i), "_vptr", 5)
&& is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
continue;
--- 774,779 ----
***************
*** 924,936 ****
else
{
char *p;
! char *demangled_no_class = demangled_name;
! while ((p = strchr (demangled_no_class, ':')))
! {
! demangled_no_class = p;
! if (*++demangled_no_class == ':')
! ++demangled_no_class;
}
/* get rid of the static word appended by the demangler */
p = strstr (demangled_no_class, " static");
--- 931,943 ----
else
{
char *p;
! char *demangled_no_class = strrchr (demangled_name, ':');
! if (demangled_no_class == NULL)
! demangled_no_class = demangled_name;
! else
! {
! ++demangled_no_class; /* skip over last ':' */
}
/* get rid of the static word appended by the demangler */
p = strstr (demangled_no_class, " static");
***************
*** 955,966 ****
}
}
if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
fprintfi_filtered (level, stream, " (Local at %s:%d)\n",
TYPE_LOCALTYPE_FILE (type),
TYPE_LOCALTYPE_LINE (type));
-
- fprintfi_filtered (level, stream, "}");
}
if (TYPE_CODE (type) == TYPE_CODE_TEMPLATE)
goto go_back;
--- 962,973 ----
}
}
+ fprintfi_filtered (level, stream, "}");
+
if (TYPE_LOCALTYPE_PTR (type) && show >= 0)
fprintfi_filtered (level, stream, " (Local at %s:%d)\n",
TYPE_LOCALTYPE_FILE (type),
TYPE_LOCALTYPE_LINE (type));
}
if (TYPE_CODE (type) == TYPE_CODE_TEMPLATE)
goto go_back;
Index: gdb/c-valprint.c
/opt/gnu/bin/diff -r -c -N /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/c-valprint.c gdb/c-valprint.c
*** /view/guo.wdb.c//CLO/Components/WDB/Src/gnu/gdb/c-valprint.c Fri Oct 29 15:49:26 1999
--- gdb/c-valprint.c Mon Nov 1 12:05:17 1999
***************
*** 483,502 ****
{
/* Pointer to class, check real type of object */
fprintf_filtered (stream, "(");
! type = value_rtti_target_type (val, &full, &top, &using_enc);
! if (type)
{
/* RTTI entry found */
! type = lookup_pointer_type (type);
! type_print (type, "", stream, -1);
! }
! else
! {
! /* No RTTI fields, do whatever we can */
! type = VALUE_ENCLOSING_TYPE (val);
! type_print (type, "", stream, -1);
! fprintf_filtered (stream, " ?");
! }
fprintf_filtered (stream, ") ");
}
else
--- 483,506 ----
{
/* Pointer to class, check real type of object */
fprintf_filtered (stream, "(");
! real_type = value_rtti_target_type (val, &full, &top, &using_enc);
! if (real_type)
{
/* RTTI entry found */
! if (TYPE_CODE (type) == TYPE_CODE_PTR)
! {
! /* create a pointer type pointing to the real type */
! type = lookup_pointer_type (real_type);
! }
! else
! {
! /* create a reference type referencing the real type */
! type = lookup_reference_type (real_type);
! }
! /* Note: When we look up RTTI entries, we don't get any
! information on const or volatile attributes */
! }
! type_print (type, "", stream, -1);
fprintf_filtered (stream, ") ");
}
else
***************
*** 521,526 ****
--- 525,532 ----
/* Print out object: enclosing type is same as real_type if full */
return val_print (VALUE_ENCLOSING_TYPE (val), VALUE_CONTENTS_ALL (val), 0,
VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+ /* Note: When we look up RTTI entries, we don't get any information on
+ const or volatile attributes */
}
else if (type != VALUE_ENCLOSING_TYPE (val))
{