2009-11-12 Daniel Jacobowitz <dan@codesourcery.com>

Paul Brook  <paul@codesourcery.com>

	* c-typeprint.c (c_type_print_base): Skip artificial fields.
	Use get_vptr_fieldno to skip the vtable pointer.
	* dwarf2read.c (dwarf2_add_field): Set FIELD_ARTIFICIAL on artificial
	fields.
	(dwarf2_add_member_fn): Complain about virtual member functions
	without DW_AT_vtable_elem_location and force TYPE_CPLUS_DYNAMIC.
	* gdbtypes.c (get_vptr_fieldno): Update comment.
	* gdbtypes.h (struct cplus_struct_type): Add is_dynamic.
	(TYPE_CPLUS_DYNAMIC): New macro.
	* gnu-v3-abi.c (gnuv3_dynamic_class): New.
	(gnuv3_get_vtable): Rewrite to use gnuv3_dynamic_class.  Move higher.
	(gnuv3_rtti_type, gnuv3_get_virtual_fn, gnuv3_baseclass_offset): Use
	gnuv3_get_vtable.
	* varobj.c (cplus_class_num_children, cplus_describe_child): Skip
	artificial fields.  Use get_vptr_fieldno to skip the vtable pointer.
This commit is contained in:
Daniel Jacobowitz
2009-11-12 19:47:25 +00:00
parent 87728fa060
commit d48cc9dd6f
7 changed files with 157 additions and 103 deletions

View File

@@ -761,6 +761,9 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
}
else if (show > 0 || TYPE_TAG_NAME (type) == NULL)
{
struct type *basetype;
int vptr_fieldno;
cp_type_print_derivation_info (stream, type);
fprintf_filtered (stream, "{\n");
@@ -848,12 +851,16 @@ c_type_print_base (struct type *type, struct ui_file *stream, int show,
do not print the field that it occupies. */
len = TYPE_NFIELDS (type);
vptr_fieldno = get_vptr_fieldno (type, &basetype);
for (i = TYPE_N_BASECLASSES (type); i < len; i++)
{
QUIT;
/* Don't print out virtual function table. */
if (strncmp (TYPE_FIELD_NAME (type, i), "_vptr", 5) == 0
&& is_cplus_marker ((TYPE_FIELD_NAME (type, i))[5]))
/* If we have a virtual table pointer, omit it. Even if
virtual table pointers are not specifically marked in
the debug info, they should be artificial. */
if ((type == basetype && i == vptr_fieldno)
|| TYPE_FIELD_ARTIFICIAL (type, i))
continue;
/* If this is a C++ class we can print the various C++ section