X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fcp-valprint.c;h=a02fee6b5524f7ace301787dff0922e67bd6c6cb;hb=60db1b8565060f4bd2287b060ea9724c93289982;hp=5625a58ee750d0e3051b3c35dd5082a40f8e3dc7;hpb=426a9c18dddcdd5f640b702734dd8f9c108b7372;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 5625a58ee7..a02fee6b55 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -61,7 +61,7 @@ const char vtbl_ptr_name[] = "__vtbl_ptr_type"; int cp_is_vtbl_ptr_type (struct type *type) { - const char *type_name = TYPE_NAME (type); + const char *type_name = type->name (); return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name)); } @@ -74,25 +74,25 @@ cp_is_vtbl_member (struct type *type) { /* With older versions of g++, the vtbl field pointed to an array of structures. Nowadays it points directly to the structure. */ - if (TYPE_CODE (type) == TYPE_CODE_PTR) + if (type->code () == TYPE_CODE_PTR) { type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_ARRAY) + if (type->code () == TYPE_CODE_ARRAY) { type = TYPE_TARGET_TYPE (type); - if (TYPE_CODE (type) == TYPE_CODE_STRUCT /* if not using thunks */ - || TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */ + if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */ + || type->code () == TYPE_CODE_PTR) /* if using thunks */ { /* Virtual functions tables are full of pointers to virtual functions. */ return cp_is_vtbl_ptr_type (type); } } - else if (TYPE_CODE (type) == TYPE_CODE_STRUCT) /* if not using thunks */ + else if (type->code () == TYPE_CODE_STRUCT) /* if not using thunks */ { return cp_is_vtbl_ptr_type (type); } - else if (TYPE_CODE (type) == TYPE_CODE_PTR) /* if using thunks */ + else if (type->code () == TYPE_CODE_PTR) /* if using thunks */ { /* The type name of the thunk pointer is NULL when using dwarf2. We could test for a pointer to a function, but @@ -149,7 +149,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, } fprintf_filtered (stream, "{"); - len = TYPE_NFIELDS (type); + len = type->num_fields (); n_baseclasses = TYPE_N_BASECLASSES (type); /* First, print out baseclasses such that we don't print @@ -191,7 +191,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, /* If requested, skip printing of static fields. */ if (!options->static_field_print - && field_is_static (&TYPE_FIELD (type, i))) + && field_is_static (&type->field (i))) continue; if (fields_seen) @@ -207,7 +207,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, fprintf_filtered (stream, "\n"); print_spaces_filtered (2 + 2 * recurse, stream); fputs_filtered ("members of ", stream); - fputs_filtered (TYPE_NAME (type), stream); + fputs_filtered (type->name (), stream); fputs_filtered (":", stream); } } @@ -223,9 +223,9 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, wrap_here (n_spaces (2 + 2 * recurse)); } - annotate_field_begin (TYPE_FIELD_TYPE (type, i)); + annotate_field_begin (type->field (i).type ()); - if (field_is_static (&TYPE_FIELD (type, i))) + if (field_is_static (&type->field (i))) { fputs_filtered ("static ", stream); fprintf_symbol_filtered (stream, @@ -256,7 +256,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, } annotate_field_value (); - if (!field_is_static (&TYPE_FIELD (type, i)) + if (!field_is_static (&type->field (i)) && TYPE_FIELD_PACKED (type, i)) { struct value *v; @@ -295,13 +295,13 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, fputs_styled ("", metadata_style.style (), stream); } - else if (field_is_static (&TYPE_FIELD (type, i))) + else if (field_is_static (&type->field (i))) { try { struct value *v = value_static_field (type, i); - cp_print_static_field (TYPE_FIELD_TYPE (type, i), + cp_print_static_field (type->field (i).type (), v, stream, recurse + 1, opts); } @@ -315,7 +315,7 @@ cp_print_value_fields (struct value *val, struct ui_file *stream, else if (i == vptr_fieldno && type == vptr_basetype) { int i_offset = TYPE_FIELD_BITPOS (type, i) / 8; - struct type *i_type = TYPE_FIELD_TYPE (type, i); + struct type *i_type = type->field (i).type (); if (valprint_check_validity (stream, i_type, i_offset, val)) { @@ -411,7 +411,7 @@ cp_print_value (struct value *val, struct ui_file *stream, LONGEST boffset = 0; int skip = 0; struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i)); - const char *basename = TYPE_NAME (baseclass); + const char *basename = baseclass->name (); struct value *base_val = NULL; if (BASETYPE_VIA_VIRTUAL (type, i)) @@ -563,7 +563,7 @@ cp_print_static_field (struct type *type, } struct type *real_type = check_typedef (type); - if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT) + if (real_type->code () == TYPE_CODE_STRUCT) { CORE_ADDR *first_dont_print; CORE_ADDR addr = value_address (val); @@ -591,7 +591,7 @@ cp_print_static_field (struct type *type, return; } - if (TYPE_CODE (real_type) == TYPE_CODE_ARRAY) + if (real_type->code () == TYPE_CODE_ARRAY) { struct type **first_dont_print; int i; @@ -638,7 +638,7 @@ cp_find_class_member (struct type **self_p, int *fieldno, *self_p = check_typedef (*self_p); self = *self_p; - len = TYPE_NFIELDS (self); + len = self->num_fields (); for (i = TYPE_N_BASECLASSES (self); i < len; i++) { @@ -655,11 +655,11 @@ cp_find_class_member (struct type **self_p, int *fieldno, for (i = 0; i < TYPE_N_BASECLASSES (self); i++) { LONGEST bitpos = TYPE_FIELD_BITPOS (self, i); - LONGEST bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (self, i)); + LONGEST bitsize = 8 * TYPE_LENGTH (self->field (i).type ()); if (offset >= bitpos && offset < bitpos + bitsize) { - *self_p = TYPE_FIELD_TYPE (self, i); + *self_p = self->field (i).type (); cp_find_class_member (self_p, fieldno, offset - bitpos); return; } @@ -708,7 +708,7 @@ cp_print_class_member (const gdb_byte *valaddr, struct type *type, const char *name; fputs_filtered (prefix, stream); - name = TYPE_NAME (self_type); + name = self_type->name (); if (name) fputs_filtered (name, stream); else