From: Tom Tromey Date: Sun, 24 Aug 2008 16:39:57 +0000 (+0000) Subject: gdb: X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=876cecd0ee02971f527439b3535cc012dc5717f5;p=binutils-gdb.git gdb: * xml-tdesc.c (tdesc_end_union): Update. * stabsread.c (define_symbol): Update. (read_type): Update. (read_struct_type): Update. (read_enum_type): Update. * spu-tdep.c (spu_builtin_type_vec128): Update. * sh-tdep.c (sh_push_dummy_call_fpu): Update. (sh_push_dummy_call_nofpu): Update. * mdebugread.c (parse_symbol): Update. (parse_symbol): Update. (parse_symbol): Update. (upgrade_type): Update. * jv-lang.c (java_lookup_class): Update. * iq2000-tdep.c (iq2000_pointer_to_address): Update. * i386-tdep.c (i386_mmx_type): Update. (i386_sse_type): Update. * gdbtypes.h (enum type_flag_value): New enum. (enum type_instance_flag_value): New enum. (TYPE_FLAG_UNSIGNED, TYPE_FLAG_NOSIGN, TYPE_FLAG_STUB, TYPE_FLAG_TARGET_STUB, TYPE_FLAG_STATIC, TYPE_FLAG_PROTOTYPED, TYPE_FLAG_INCOMPLETE, TYPE_FLAG_VARARGS, TYPE_FLAG_VECTOR, TYPE_FLAG_FIXED_INSTANCE, TYPE_FLAG_STUB_SUPPORTED, TYPE_FLAG_NOTTEXT): Now enum constants. (TYPE_FLAG_CONST, TYPE_FLAG_VOLATILE, TYPE_FLAG_CODE_SPACE, TYPE_FLAG_DATA_SPACE, TYPE_FLAG_ADDRESS_CLASS_1, TYPE_FLAG_ADDRESS_CLASS_2): Remove. (TYPE_INSTANCE_FLAG_CONST, TYPE_INSTANCE_FLAG_VOLATILE, TYPE_INSTANCE_FLAG_CODE_SPACE, TYPE_INSTANCE_FLAG_DATA_SPACE, TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1, TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2): New constants. (TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB, TYPE_TARGET_STUB, TYPE_STATIC, TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_VARARGS, TYPE_VECTOR, TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED, TYPE_NOTTEXT): Update. (TYPE_FLAG_ADDRESS_CLASS_ALL): Remove. (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): New define. (TYPE_VOLATILE, TYPE_CODE_SPACE, TYPE_DATA_SPACE, TYPE_ADDRESS_CLASS_1, TYPE_ADDRESS_CLASS_2, TYPE_ADDRESS_CLASS_ALL): Update. (struct main_type) : Remove. : New fields. : Move earlier. (TYPE_FLAGS): Remove. * gdbtypes.c (make_pointer_type): Update. (address_space_name_to_int): Update. (address_space_int_to_name): Update. (make_type_with_address_space): Update. (make_cv_type): Update. (create_range_type): Update. (get_discrete_bounds): Update. (create_set_type): Update. (make_vector_type): Update. (smash_to_method_type): Update. (check_typedef): Update. (check_stub_method): Update. (init_type): Individually assign flag fields. (recursive_dump_type): Don't print entire TYPE_FLAGS field. Do print TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED, and TYPE_NOTTEXT. (copy_type_recursive): Copy the entire main type. Don't use TYPE_FLAGS. * features/rs6000/powerpc-altivec64l.c (initialize_tdesc_powerpc_altivec64l): Update. * features/rs6000/powerpc-altivec64.c (initialize_tdesc_powerpc_altivec64): Update. * features/rs6000/powerpc-altivec32l.c (initialize_tdesc_powerpc_altivec32l): Update. * features/rs6000/powerpc-altivec32.c (initialize_tdesc_powerpc_altivec32): Update. * features/rs6000/powerpc-7400.c (initialize_tdesc_powerpc_7400): Update. * features/arm-with-iwmmxt.c (initialize_tdesc_arm_with_iwmmxt): Update. * dwarf2read.c (read_structure_type): Update. (read_enumeration_type): Likewise. (process_enumeration_scope): Likewise. (read_tag_pointer_type): Likewise. (read_subroutine_type): Likewise. (read_subroutine_type): Likewise. (read_base_type): Likewise. * coffread.c (coff_read_enum_type): Update. * ada-valprint.c (adjust_type_signedness): Update. * ada-typeprint.c (print_record_field_types): Update. * ada-lang.c (packed_array_type): Update. (empty_record): Don't reset TYPE_FLAGS. (ada_template_to_fixed_record_type_1): Update. (ada_template_to_fixed_record_type_1): Likewise. (template_to_static_fixed_type): Likewise. (to_record_with_fixed_variant_part): Likewise. (to_fixed_record_type): Likewise. (to_fixed_array_type): Likewise. (to_static_fixed_type): Likewise. gdb/testsuite: * gdb.base/maint.exp: Update "maint print type". --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7b1f0b807a5..935d159d0c0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,100 @@ +2008-08-24 Tom Tromey + + * xml-tdesc.c (tdesc_end_union): Update. + * stabsread.c (define_symbol): Update. + (read_type): Update. + (read_struct_type): Update. + (read_enum_type): Update. + * spu-tdep.c (spu_builtin_type_vec128): Update. + * sh-tdep.c (sh_push_dummy_call_fpu): Update. + (sh_push_dummy_call_nofpu): Update. + * mdebugread.c (parse_symbol): Update. + (parse_symbol): Update. + (parse_symbol): Update. + (upgrade_type): Update. + * jv-lang.c (java_lookup_class): Update. + * iq2000-tdep.c (iq2000_pointer_to_address): Update. + * i386-tdep.c (i386_mmx_type): Update. + (i386_sse_type): Update. + * gdbtypes.h (enum type_flag_value): New enum. + (enum type_instance_flag_value): New enum. + (TYPE_FLAG_UNSIGNED, TYPE_FLAG_NOSIGN, TYPE_FLAG_STUB, + TYPE_FLAG_TARGET_STUB, TYPE_FLAG_STATIC, TYPE_FLAG_PROTOTYPED, + TYPE_FLAG_INCOMPLETE, TYPE_FLAG_VARARGS, TYPE_FLAG_VECTOR, + TYPE_FLAG_FIXED_INSTANCE, TYPE_FLAG_STUB_SUPPORTED, + TYPE_FLAG_NOTTEXT): Now enum constants. + (TYPE_FLAG_CONST, TYPE_FLAG_VOLATILE, TYPE_FLAG_CODE_SPACE, + TYPE_FLAG_DATA_SPACE, TYPE_FLAG_ADDRESS_CLASS_1, + TYPE_FLAG_ADDRESS_CLASS_2): Remove. + (TYPE_INSTANCE_FLAG_CONST, TYPE_INSTANCE_FLAG_VOLATILE, + TYPE_INSTANCE_FLAG_CODE_SPACE, TYPE_INSTANCE_FLAG_DATA_SPACE, + TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1, + TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2): New constants. + (TYPE_UNSIGNED, TYPE_NOSIGN, TYPE_STUB, TYPE_TARGET_STUB, + TYPE_STATIC, TYPE_PROTOTYPED, TYPE_INCOMPLETE, TYPE_VARARGS, + TYPE_VECTOR, TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED, + TYPE_NOTTEXT): Update. + (TYPE_FLAG_ADDRESS_CLASS_ALL): Remove. + (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL): New define. + (TYPE_VOLATILE, TYPE_CODE_SPACE, TYPE_DATA_SPACE, + TYPE_ADDRESS_CLASS_1, TYPE_ADDRESS_CLASS_2, + TYPE_ADDRESS_CLASS_ALL): Update. + (struct main_type) : Remove. + : New fields. + : Move earlier. + (TYPE_FLAGS): Remove. + * gdbtypes.c (make_pointer_type): Update. + (address_space_name_to_int): Update. + (address_space_int_to_name): Update. + (make_type_with_address_space): Update. + (make_cv_type): Update. + (create_range_type): Update. + (get_discrete_bounds): Update. + (create_set_type): Update. + (make_vector_type): Update. + (smash_to_method_type): Update. + (check_typedef): Update. + (check_stub_method): Update. + (init_type): Individually assign flag fields. + (recursive_dump_type): Don't print entire TYPE_FLAGS field. Do + print TYPE_FIXED_INSTANCE, TYPE_STUB_SUPPORTED, and TYPE_NOTTEXT. + (copy_type_recursive): Copy the entire main type. Don't use + TYPE_FLAGS. + * features/rs6000/powerpc-altivec64l.c + (initialize_tdesc_powerpc_altivec64l): Update. + * features/rs6000/powerpc-altivec64.c + (initialize_tdesc_powerpc_altivec64): Update. + * features/rs6000/powerpc-altivec32l.c + (initialize_tdesc_powerpc_altivec32l): Update. + * features/rs6000/powerpc-altivec32.c + (initialize_tdesc_powerpc_altivec32): Update. + * features/rs6000/powerpc-7400.c (initialize_tdesc_powerpc_7400): + Update. + * features/arm-with-iwmmxt.c (initialize_tdesc_arm_with_iwmmxt): + Update. + * dwarf2read.c (read_structure_type): Update. + (read_enumeration_type): Likewise. + (process_enumeration_scope): Likewise. + (read_tag_pointer_type): Likewise. + (read_subroutine_type): Likewise. + (read_subroutine_type): Likewise. + (read_base_type): Likewise. + * coffread.c (coff_read_enum_type): Update. + * ada-valprint.c (adjust_type_signedness): Update. + * ada-typeprint.c (print_record_field_types): Update. + * ada-lang.c (packed_array_type): Update. + (empty_record): Don't reset TYPE_FLAGS. + (ada_template_to_fixed_record_type_1): Update. + (ada_template_to_fixed_record_type_1): Likewise. + (template_to_static_fixed_type): Likewise. + (to_record_with_fixed_variant_part): Likewise. + (to_fixed_record_type): Likewise. + (to_fixed_array_type): Likewise. + (to_static_fixed_type): Likewise. + 2008-08-23 Jim Blandy PR macros/607: diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index a725a063d56..2081a4de9bb 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1829,7 +1829,7 @@ packed_array_type (struct type *type, long *elt_bits) (*elt_bits + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT; } - TYPE_FLAGS (new_type) |= TYPE_FLAG_FIXED_INSTANCE; + TYPE_FIXED_INSTANCE (new_type) = 1; return new_type; } @@ -6902,7 +6902,6 @@ empty_record (struct objfile *objfile) TYPE_FIELDS (type) = NULL; TYPE_NAME (type) = ""; TYPE_TAG_NAME (type) = NULL; - TYPE_FLAGS (type) = 0; TYPE_LENGTH (type) = 0; return type; } @@ -6962,7 +6961,7 @@ ada_template_to_fixed_record_type_1 (struct type *type, memset (TYPE_FIELDS (rtype), 0, sizeof (struct field) * nfields); TYPE_NAME (rtype) = ada_type_name (type); TYPE_TAG_NAME (rtype) = NULL; - TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE; + TYPE_FIXED_INSTANCE (rtype) = 1; off = 0; bit_len = 0; @@ -7142,7 +7141,7 @@ template_to_static_fixed_type (struct type *type0) sizeof (struct field) * nfields); TYPE_NAME (type) = ada_type_name (type0); TYPE_TAG_NAME (type) = NULL; - TYPE_FLAGS (type) |= TYPE_FLAG_FIXED_INSTANCE; + TYPE_FIXED_INSTANCE (type) = 1; TYPE_LENGTH (type) = 0; } TYPE_FIELD_TYPE (type, f) = new_type; @@ -7187,7 +7186,7 @@ to_record_with_fixed_variant_part (struct type *type, const gdb_byte *valaddr, sizeof (struct field) * nfields); TYPE_NAME (rtype) = ada_type_name (type); TYPE_TAG_NAME (rtype) = NULL; - TYPE_FLAGS (rtype) |= TYPE_FLAG_FIXED_INSTANCE; + TYPE_FIXED_INSTANCE (rtype) = 1; TYPE_LENGTH (rtype) = TYPE_LENGTH (type); branch_type = to_fixed_variant_branch_type @@ -7242,7 +7241,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr, { struct type *templ_type; - if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE) + if (TYPE_FIXED_INSTANCE (type0)) return type0; templ_type = dynamic_template_type (type0); @@ -7258,7 +7257,7 @@ to_fixed_record_type (struct type *type0, const gdb_byte *valaddr, } else { - TYPE_FLAGS (type0) |= TYPE_FLAG_FIXED_INSTANCE; + TYPE_FIXED_INSTANCE (type0) = 1; return type0; } @@ -7323,7 +7322,7 @@ to_fixed_array_type (struct type *type0, struct value *dval, struct type *result; if (ada_is_packed_array_type (type0) /* revisit? */ - || (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE)) + || TYPE_FIXED_INSTANCE (type0)) return type0; index_type_desc = ada_find_parallel_type (type0, "___XA"); @@ -7383,7 +7382,7 @@ to_fixed_array_type (struct type *type0, struct value *dval, error (_("array type with dynamic size is larger than varsize-limit")); } - TYPE_FLAGS (result) |= TYPE_FLAG_FIXED_INSTANCE; + TYPE_FIXED_INSTANCE (result) = 1; return result; } @@ -7473,7 +7472,7 @@ to_static_fixed_type (struct type *type0) if (type0 == NULL) return NULL; - if (TYPE_FLAGS (type0) & TYPE_FLAG_FIXED_INSTANCE) + if (TYPE_FIXED_INSTANCE (type0)) return type0; type0 = ada_check_typedef (type0); diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index f4c3723d235..e46637f48b3 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -585,7 +585,7 @@ print_record_field_types (struct type *type, struct type *outer_type, flds = 0; len = TYPE_NFIELDS (type); - if (len == 0 && (TYPE_FLAGS (type) & TYPE_FLAG_STUB) != 0) + if (len == 0 && TYPE_STUB (type)) return -1; for (i = 0; i < len; i += 1) diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 277ea9c4bab..7ae8c0f633b 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -71,7 +71,7 @@ adjust_type_signedness (struct type *type) { if (type != NULL && TYPE_CODE (type) == TYPE_CODE_RANGE && TYPE_LOW_BOUND (type) >= 0) - TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (type) = 1; } /* Assuming TYPE is a simple array type, prints its lower bound on STREAM, diff --git a/gdb/coffread.c b/gdb/coffread.c index 3717d02e3c4..de81d47ec48 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -2091,7 +2091,7 @@ coff_read_enum_type (int index, int length, int lastsym, } if (unsigned_enum) - TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (type) = 1; return type; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index a8d0eca32b7..5cb444ebdf4 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -4048,9 +4048,9 @@ read_structure_type (struct die_info *die, struct dwarf2_cu *cu) TYPE_LENGTH (type) = 0; } - TYPE_FLAGS (type) |= TYPE_FLAG_STUB_SUPPORTED; + TYPE_STUB_SUPPORTED (type) = 1; if (die_is_declaration (die, cu)) - TYPE_FLAGS (type) |= TYPE_FLAG_STUB; + TYPE_STUB (type) = 1; /* We need to add the type field to the die immediately so we don't infinitely recurse when dealing with pointers to the structure @@ -4240,7 +4240,7 @@ read_enumeration_type (struct die_info *die, struct dwarf2_cu *cu) Types. When another package uses such a type, an incomplete DIE may be generated by the compiler. */ if (die_is_declaration (die, cu)) - TYPE_FLAGS (type) |= TYPE_FLAG_STUB; + TYPE_STUB (type) = 1; return set_die_type (die, type, cu); } @@ -4362,7 +4362,7 @@ process_enumeration_scope (struct die_info *die, struct dwarf2_cu *cu) xfree (fields); } if (unsigned_enum) - TYPE_FLAGS (this_type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (this_type) = 1; } new_symbol (die, this_type, cu); @@ -4700,7 +4700,8 @@ read_tag_pointer_type (struct die_info *die, struct dwarf2_cu *cu) type_flags = gdbarch_address_class_type_flags (gdbarch, byte_size, addr_class); - gdb_assert ((type_flags & ~TYPE_FLAG_ADDRESS_CLASS_ALL) == 0); + gdb_assert ((type_flags & ~TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) + == 0); type = make_type_with_address_space (type, type_flags); } else if (TYPE_LENGTH (type) != byte_size) @@ -4847,7 +4848,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) || cu->language == language_cplus || cu->language == language_java || cu->language == language_pascal) - TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED; + TYPE_PROTOTYPED (ftype) = 1; /* Store the calling convention in the type if it's available in the subroutine die. Otherwise set the calling convention to @@ -4870,7 +4871,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu) if (child_die->tag == DW_TAG_formal_parameter) nparams++; else if (child_die->tag == DW_TAG_unspecified_parameters) - TYPE_FLAGS (ftype) |= TYPE_FLAG_VARARGS; + TYPE_VARARGS (ftype) = 1; child_die = sibling_die (child_die); } @@ -5000,7 +5001,7 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu) TYPE_TARGET_TYPE (type) = target_type; if (name && strcmp (name, "char") == 0) - TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN; + TYPE_NOSIGN (type) = 1; return set_die_type (die, type, cu); } diff --git a/gdb/features/arm-with-iwmmxt.c b/gdb/features/arm-with-iwmmxt.c index 8255c7f06cc..d9c5221ec39 100644 --- a/gdb/features/arm-with-iwmmxt.c +++ b/gdb/features/arm-with-iwmmxt.c @@ -59,7 +59,7 @@ initialize_tdesc_arm_with_iwmmxt (void) append_composite_type_field (type, xstrdup ("u32"), field_type); field_type = tdesc_named_type (feature, "uint64"); append_composite_type_field (type, xstrdup ("u64"), field_type); - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (type) = 1; tdesc_record_type (feature, type); tdesc_create_reg (feature, "wR0", 26, 1, NULL, 64, "iwmmxt_vec64i"); diff --git a/gdb/features/rs6000/powerpc-7400.c b/gdb/features/rs6000/powerpc-7400.c index af0797e2919..4e9a5c55271 100644 --- a/gdb/features/rs6000/powerpc-7400.c +++ b/gdb/features/rs6000/powerpc-7400.c @@ -170,7 +170,7 @@ initialize_tdesc_powerpc_7400 (void) append_composite_type_field (type, xstrdup ("v8_int16"), field_type); field_type = tdesc_named_type (feature, "v16i8"); append_composite_type_field (type, xstrdup ("v16_int8"), field_type); - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (type) = 1; tdesc_record_type (feature, type); tdesc_create_reg (feature, "vr0", 119, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec32.c b/gdb/features/rs6000/powerpc-altivec32.c index ff2aefaa906..db910ea3bc3 100644 --- a/gdb/features/rs6000/powerpc-altivec32.c +++ b/gdb/features/rs6000/powerpc-altivec32.c @@ -122,7 +122,7 @@ initialize_tdesc_powerpc_altivec32 (void) append_composite_type_field (type, xstrdup ("v8_int16"), field_type); field_type = tdesc_named_type (feature, "v16i8"); append_composite_type_field (type, xstrdup ("v16_int8"), field_type); - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (type) = 1; tdesc_record_type (feature, type); tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec32l.c b/gdb/features/rs6000/powerpc-altivec32l.c index c139c600f0a..a08f09bec1e 100644 --- a/gdb/features/rs6000/powerpc-altivec32l.c +++ b/gdb/features/rs6000/powerpc-altivec32l.c @@ -126,7 +126,7 @@ initialize_tdesc_powerpc_altivec32l (void) append_composite_type_field (type, xstrdup ("v8_int16"), field_type); field_type = tdesc_named_type (feature, "v16i8"); append_composite_type_field (type, xstrdup ("v16_int8"), field_type); - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (type) = 1; tdesc_record_type (feature, type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec64.c b/gdb/features/rs6000/powerpc-altivec64.c index 404a92d954c..dd1df89d6ed 100644 --- a/gdb/features/rs6000/powerpc-altivec64.c +++ b/gdb/features/rs6000/powerpc-altivec64.c @@ -122,7 +122,7 @@ initialize_tdesc_powerpc_altivec64 (void) append_composite_type_field (type, xstrdup ("v8_int16"), field_type); field_type = tdesc_named_type (feature, "v16i8"); append_composite_type_field (type, xstrdup ("v16_int8"), field_type); - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (type) = 1; tdesc_record_type (feature, type); tdesc_create_reg (feature, "vr0", 71, 1, NULL, 128, "vec128"); diff --git a/gdb/features/rs6000/powerpc-altivec64l.c b/gdb/features/rs6000/powerpc-altivec64l.c index a5d4be7db64..892396dbeda 100644 --- a/gdb/features/rs6000/powerpc-altivec64l.c +++ b/gdb/features/rs6000/powerpc-altivec64l.c @@ -126,7 +126,7 @@ initialize_tdesc_powerpc_altivec64l (void) append_composite_type_field (type, xstrdup ("v8_int16"), field_type); field_type = tdesc_named_type (feature, "v16i8"); append_composite_type_field (type, xstrdup ("v16_int8"), field_type); - TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (type) = 1; tdesc_record_type (feature, type); tdesc_create_reg (feature, "vr0", 73, 1, NULL, 128, "vec128"); diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index bbacee5c688..12397230a87 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -277,7 +277,7 @@ make_pointer_type (struct type *type, struct type **typeptr) /* Mark pointers as unsigned. The target converts between pointers and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and gdbarch_address_to_pointer. */ - TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (ntype) = 1; if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */ TYPE_POINTER_TYPE (type) = ntype; @@ -429,9 +429,9 @@ address_space_name_to_int (char *space_identifier) int type_flags; /* Check for known address space delimiters. */ if (!strcmp (space_identifier, "code")) - return TYPE_FLAG_CODE_SPACE; + return TYPE_INSTANCE_FLAG_CODE_SPACE; else if (!strcmp (space_identifier, "data")) - return TYPE_FLAG_DATA_SPACE; + return TYPE_INSTANCE_FLAG_DATA_SPACE; else if (gdbarch_address_class_name_to_type_flags_p (gdbarch) && gdbarch_address_class_name_to_type_flags (gdbarch, space_identifier, @@ -448,11 +448,11 @@ const char * address_space_int_to_name (int space_flag) { struct gdbarch *gdbarch = current_gdbarch; - if (space_flag & TYPE_FLAG_CODE_SPACE) + if (space_flag & TYPE_INSTANCE_FLAG_CODE_SPACE) return "code"; - else if (space_flag & TYPE_FLAG_DATA_SPACE) + else if (space_flag & TYPE_INSTANCE_FLAG_DATA_SPACE) return "data"; - else if ((space_flag & TYPE_FLAG_ADDRESS_CLASS_ALL) + else if ((space_flag & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) && gdbarch_address_class_type_flags_to_name_p (gdbarch)) return gdbarch_address_class_type_flags_to_name (gdbarch, space_flag); else @@ -525,8 +525,9 @@ make_type_with_address_space (struct type *type, int space_flag) { struct type *ntype; int new_flags = ((TYPE_INSTANCE_FLAGS (type) - & ~(TYPE_FLAG_CODE_SPACE | TYPE_FLAG_DATA_SPACE - | TYPE_FLAG_ADDRESS_CLASS_ALL)) + & ~(TYPE_INSTANCE_FLAG_CODE_SPACE + | TYPE_INSTANCE_FLAG_DATA_SPACE + | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL)) | space_flag); return make_qualified_type (type, new_flags, NULL); @@ -553,13 +554,13 @@ make_cv_type (int cnst, int voltl, struct objfile *objfile; int new_flags = (TYPE_INSTANCE_FLAGS (type) - & ~(TYPE_FLAG_CONST | TYPE_FLAG_VOLATILE)); + & ~(TYPE_INSTANCE_FLAG_CONST | TYPE_INSTANCE_FLAG_VOLATILE)); if (cnst) - new_flags |= TYPE_FLAG_CONST; + new_flags |= TYPE_INSTANCE_FLAG_CONST; if (voltl) - new_flags |= TYPE_FLAG_VOLATILE; + new_flags |= TYPE_INSTANCE_FLAG_VOLATILE; if (typeptr && *typeptr != NULL) { @@ -699,7 +700,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_CODE (result_type) = TYPE_CODE_RANGE; TYPE_TARGET_TYPE (result_type) = index_type; if (TYPE_STUB (index_type)) - TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB; + TYPE_TARGET_STUB (result_type) = 1; else TYPE_LENGTH (result_type) = TYPE_LENGTH (check_typedef (index_type)); TYPE_NFIELDS (result_type) = 2; @@ -710,7 +711,7 @@ create_range_type (struct type *result_type, struct type *index_type, TYPE_FIELD_BITPOS (result_type, 1) = high_bound; if (low_bound >= 0) - TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (result_type) = 1; return (result_type); } @@ -748,7 +749,7 @@ get_discrete_bounds (struct type *type, LONGEST *lowp, LONGEST *highp) /* Set unsigned indicator if warranted. */ if (*lowp >= 0) { - TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (type) = 1; } } else @@ -828,7 +829,7 @@ create_array_type (struct type *result_type, /* TYPE_FLAG_TARGET_STUB will take care of zero length arrays */ if (TYPE_LENGTH (result_type) == 0) - TYPE_FLAGS (result_type) |= TYPE_FLAG_TARGET_STUB; + TYPE_TARGET_STUB (result_type) = 1; return (result_type); } @@ -882,7 +883,7 @@ create_set_type (struct type *result_type, struct type *domain_type) TYPE_LENGTH (result_type) = (bit_length + TARGET_CHAR_BIT - 1) / TARGET_CHAR_BIT; if (low_bound >= 0) - TYPE_FLAGS (result_type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (result_type) = 1; } TYPE_FIELD_TYPE (result_type, 0) = domain_type; @@ -947,7 +948,7 @@ make_vector_type (struct type *array_type) TYPE_TARGET_TYPE (inner_array) = elt_type; } - TYPE_FLAGS (array_type) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (array_type) = 1; } struct type * @@ -1015,7 +1016,7 @@ smash_to_method_type (struct type *type, struct type *domain, TYPE_FIELDS (type) = args; TYPE_NFIELDS (type) = nargs; if (varargs) - TYPE_FLAGS (type) |= TYPE_FLAG_VARARGS; + TYPE_VARARGS (type) = 1; TYPE_LENGTH (type) = 1; /* In practice, this is never needed. */ TYPE_CODE (type) = TYPE_CODE_METHOD; } @@ -1526,12 +1527,12 @@ check_typedef (struct type *type) nb_elements = high_bound - low_bound + 1; TYPE_LENGTH (type) = nb_elements * TYPE_LENGTH (target_type); - TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB; + TYPE_TARGET_STUB (type) = 0; } else if (TYPE_CODE (type) == TYPE_CODE_RANGE) { TYPE_LENGTH (type) = TYPE_LENGTH (target_type); - TYPE_FLAGS (type) &= ~TYPE_FLAG_TARGET_STUB; + TYPE_TARGET_STUB (type) = 0; } } /* Cache TYPE_LENGTH for future use. */ @@ -1675,10 +1676,10 @@ check_stub_method (struct type *type, int method_id, int signature_id) TYPE_DOMAIN_TYPE (mtype) = type; TYPE_FIELDS (mtype) = argtypes; TYPE_NFIELDS (mtype) = argcount; - TYPE_FLAGS (mtype) &= ~TYPE_FLAG_STUB; + TYPE_STUB (mtype) = 0; TYPE_FN_FIELD_STUB (f, signature_id) = 0; if (p[-2] == '.') - TYPE_FLAGS (mtype) |= TYPE_FLAG_VARARGS; + TYPE_VARARGS (mtype) = 1; xfree (demangled_name); } @@ -1760,7 +1761,33 @@ init_type (enum type_code code, int length, int flags, type = alloc_type (objfile); TYPE_CODE (type) = code; TYPE_LENGTH (type) = length; - TYPE_FLAGS (type) |= flags; + + gdb_assert (!(flags & (TYPE_FLAG_MIN - 1))); + if (flags & TYPE_FLAG_UNSIGNED) + TYPE_UNSIGNED (type) = 1; + if (flags & TYPE_FLAG_NOSIGN) + TYPE_NOSIGN (type) = 1; + if (flags & TYPE_FLAG_STUB) + TYPE_STUB (type) = 1; + if (flags & TYPE_FLAG_TARGET_STUB) + TYPE_TARGET_STUB (type) = 1; + if (flags & TYPE_FLAG_STATIC) + TYPE_STATIC (type) = 1; + if (flags & TYPE_FLAG_PROTOTYPED) + TYPE_PROTOTYPED (type) = 1; + if (flags & TYPE_FLAG_INCOMPLETE) + TYPE_INCOMPLETE (type) = 1; + if (flags & TYPE_FLAG_VARARGS) + TYPE_VARARGS (type) = 1; + if (flags & TYPE_FLAG_VECTOR) + TYPE_VECTOR (type) = 1; + if (flags & TYPE_FLAG_STUB_SUPPORTED) + TYPE_STUB_SUPPORTED (type) = 1; + if (flags & TYPE_FLAG_NOTTEXT) + TYPE_NOTTEXT (type) = 1; + if (flags & TYPE_FLAG_FIXED_INSTANCE) + TYPE_FIXED_INSTANCE (type) = 1; + if ((name != NULL) && (objfile != NULL)) { TYPE_NAME (type) = obsavestring (name, strlen (name), @@ -1774,7 +1801,7 @@ init_type (enum type_code code, int length, int flags, /* C++ fancies. */ if (name && strcmp (name, "char") == 0) - TYPE_FLAGS (type) |= TYPE_FLAG_NOSIGN; + TYPE_NOSIGN (type) = 1; if (code == TYPE_CODE_STRUCT || code == TYPE_CODE_UNION || code == TYPE_CODE_NAMESPACE) @@ -2739,7 +2766,8 @@ recursive_dump_type (struct type *type, int spaces) puts_filtered (" TYPE_FLAG_ADDRESS_CLASS_2"); } puts_filtered ("\n"); - printfi_filtered (spaces, "flags 0x%x", TYPE_FLAGS (type)); + + printfi_filtered (spaces, "flags"); if (TYPE_UNSIGNED (type)) { puts_filtered (" TYPE_FLAG_UNSIGNED"); @@ -2779,6 +2807,18 @@ recursive_dump_type (struct type *type, int spaces) { puts_filtered (" TYPE_FLAG_VECTOR"); } + if (TYPE_FIXED_INSTANCE (type)) + { + puts_filtered (" TYPE_FIXED_INSTANCE"); + } + if (TYPE_STUB_SUPPORTED (type)) + { + puts_filtered (" TYPE_STUB_SUPPORTED"); + } + if (TYPE_NOTTEXT (type)) + { + puts_filtered (" TYPE_NOTTEXT"); + } puts_filtered ("\n"); printfi_filtered (spaces, "nfields %d ", TYPE_NFIELDS (type)); gdb_print_host_address (TYPE_FIELDS (type), gdb_stdout); @@ -2933,24 +2973,20 @@ copy_type_recursive (struct objfile *objfile, stored->new = new_type; *slot = stored; - /* Copy the common fields of types. */ - TYPE_CODE (new_type) = TYPE_CODE (type); - TYPE_ARRAY_UPPER_BOUND_TYPE (new_type) = - TYPE_ARRAY_UPPER_BOUND_TYPE (type); - TYPE_ARRAY_LOWER_BOUND_TYPE (new_type) = - TYPE_ARRAY_LOWER_BOUND_TYPE (type); + /* Copy the common fields of types. For the main type, we simply + copy the entire thing and then update specific fields as needed. */ + *TYPE_MAIN_TYPE (new_type) = *TYPE_MAIN_TYPE (type); + TYPE_OBJFILE (new_type) = NULL; + if (TYPE_NAME (type)) TYPE_NAME (new_type) = xstrdup (TYPE_NAME (type)); if (TYPE_TAG_NAME (type)) TYPE_TAG_NAME (new_type) = xstrdup (TYPE_TAG_NAME (type)); - TYPE_FLAGS (new_type) = TYPE_FLAGS (type); - TYPE_VPTR_FIELDNO (new_type) = TYPE_VPTR_FIELDNO (type); TYPE_INSTANCE_FLAGS (new_type) = TYPE_INSTANCE_FLAGS (type); TYPE_LENGTH (new_type) = TYPE_LENGTH (type); /* Copy the fields. */ - TYPE_NFIELDS (new_type) = TYPE_NFIELDS (type); if (TYPE_NFIELDS (type)) { int i, nfields; diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 7ef7d679895..25b8c432f59 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -144,27 +144,61 @@ enum type_code #define TYPE_CODE_CLASS TYPE_CODE_STRUCT -/* Some bits for the type's flags word, and macros to test them. */ +/* Some constants representing each bit field in the main_type. See + the bit-field-specific macros, below, for documentation of each + constant in this enum. These enum values are only used with + init_type. Note that the values are chosen not to conflict with + type_instance_flag_value; this lets init_type error-check its + input. */ + +enum type_flag_value +{ + TYPE_FLAG_UNSIGNED = (1 << 6), + TYPE_FLAG_NOSIGN = (1 << 7), + TYPE_FLAG_STUB = (1 << 8), + TYPE_FLAG_TARGET_STUB = (1 << 9), + TYPE_FLAG_STATIC = (1 << 10), + TYPE_FLAG_PROTOTYPED = (1 << 11), + TYPE_FLAG_INCOMPLETE = (1 << 12), + TYPE_FLAG_VARARGS = (1 << 13), + TYPE_FLAG_VECTOR = (1 << 14), + TYPE_FLAG_FIXED_INSTANCE = (1 << 15), + TYPE_FLAG_STUB_SUPPORTED = (1 << 16), + TYPE_FLAG_NOTTEXT = (1 << 17), + + /* Used for error-checking. */ + TYPE_FLAG_MIN = TYPE_FLAG_UNSIGNED +}; + +/* Some bits for the type's instance_flags word. See the macros below + for documentation on each bit. Note that if you add a value here, + you must update the enum type_flag_value as well. */ +enum type_instance_flag_value +{ + TYPE_INSTANCE_FLAG_CONST = (1 << 0), + TYPE_INSTANCE_FLAG_VOLATILE = (1 << 1), + TYPE_INSTANCE_FLAG_CODE_SPACE = (1 << 2), + TYPE_INSTANCE_FLAG_DATA_SPACE = (1 << 3), + TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 = (1 << 4), + TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2 = (1 << 5) +}; /* Unsigned integer type. If this is not set for a TYPE_CODE_INT, the type is signed (unless TYPE_FLAG_NOSIGN (below) is set). */ -#define TYPE_FLAG_UNSIGNED (1 << 0) -#define TYPE_UNSIGNED(t) (TYPE_FLAGS (t) & TYPE_FLAG_UNSIGNED) +#define TYPE_UNSIGNED(t) (TYPE_MAIN_TYPE (t)->flag_unsigned) /* No sign for this type. In C++, "char", "signed char", and "unsigned char" are distinct types; so we need an extra flag to indicate the absence of a sign! */ -#define TYPE_FLAG_NOSIGN (1 << 1) -#define TYPE_NOSIGN(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOSIGN) +#define TYPE_NOSIGN(t) (TYPE_MAIN_TYPE (t)->flag_nosign) /* This appears in a type's flags word if it is a stub type (e.g., if someone referenced a type that wasn't defined in a source file via (struct sir_not_appearing_in_this_film *)). */ -#define TYPE_FLAG_STUB (1 << 2) -#define TYPE_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB) +#define TYPE_STUB(t) (TYPE_MAIN_TYPE (t)->flag_stub) /* The target type of this type is a stub type, and this type needs to be updated if it gets un-stubbed in check_typedef. @@ -172,8 +206,7 @@ enum type_code gets set based on the TYPE_LENGTH of the target type. Also, set for TYPE_CODE_TYPEDEF. */ -#define TYPE_FLAG_TARGET_STUB (1 << 3) -#define TYPE_TARGET_STUB(t) (TYPE_FLAGS (t) & TYPE_FLAG_TARGET_STUB) +#define TYPE_TARGET_STUB(t) (TYPE_MAIN_TYPE (t)->flag_target_stub) /* Static type. If this is set, the corresponding type had * a static modifier. @@ -181,30 +214,13 @@ enum type_code * are indicated by other means (bitpos == -1) */ -#define TYPE_FLAG_STATIC (1 << 4) -#define TYPE_STATIC(t) (TYPE_FLAGS (t) & TYPE_FLAG_STATIC) - -/* Constant type. If this is set, the corresponding type has a - * const modifier. - */ - -#define TYPE_FLAG_CONST (1 << 5) -#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CONST) - -/* Volatile type. If this is set, the corresponding type has a - * volatile modifier. - */ - -#define TYPE_FLAG_VOLATILE (1 << 6) -#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_VOLATILE) - +#define TYPE_STATIC(t) (TYPE_MAIN_TYPE (t)->flag_static) /* This is a function type which appears to have a prototype. We need this for function calls in order to tell us if it's necessary to coerce the args, or to just do the standard conversions. This is used with a short field. */ -#define TYPE_FLAG_PROTOTYPED (1 << 7) -#define TYPE_PROTOTYPED(t) (TYPE_FLAGS (t) & TYPE_FLAG_PROTOTYPED) +#define TYPE_PROTOTYPED(t) (TYPE_MAIN_TYPE (t)->flag_prototyped) /* This flag is used to indicate that processing for this type is incomplete. @@ -214,8 +230,52 @@ enum type_code info; the incomplete type has to be marked so that the class and the method can be assigned correct types.) */ -#define TYPE_FLAG_INCOMPLETE (1 << 8) -#define TYPE_INCOMPLETE(t) (TYPE_FLAGS (t) & TYPE_FLAG_INCOMPLETE) +#define TYPE_INCOMPLETE(t) (TYPE_MAIN_TYPE (t)->flag_incomplete) + +/* FIXME drow/2002-06-03: Only used for methods, but applies as well + to functions. */ + +#define TYPE_VARARGS(t) (TYPE_MAIN_TYPE (t)->flag_varargs) + +/* Identify a vector type. Gcc is handling this by adding an extra + attribute to the array type. We slurp that in as a new flag of a + type. This is used only in dwarf2read.c. */ +#define TYPE_VECTOR(t) (TYPE_MAIN_TYPE (t)->flag_vector) + +/* The debugging formats (especially STABS) do not contain enough information + to represent all Ada types---especially those whose size depends on + dynamic quantities. Therefore, the GNAT Ada compiler includes + extra information in the form of additional type definitions + connected by naming conventions. This flag indicates that the + type is an ordinary (unencoded) GDB type that has been created from + the necessary run-time information, and does not need further + interpretation. Optionally marks ordinary, fixed-size GDB type. */ + +#define TYPE_FIXED_INSTANCE(t) (TYPE_MAIN_TYPE (t)->flag_fixed_instance) + +/* This debug target supports TYPE_STUB(t). In the unsupported case we have to + rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE (). + TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed + the TYPE_STUB(t) value (see dwarfread.c). */ + +#define TYPE_STUB_SUPPORTED(t) (TYPE_MAIN_TYPE (t)->flag_stub_supported) + +/* Not textual. By default, GDB treats all single byte integers as + characters (or elements of strings) unless this flag is set. */ + +#define TYPE_NOTTEXT(t) (TYPE_MAIN_TYPE (t)->flag_nottext) + +/* Constant type. If this is set, the corresponding type has a + * const modifier. + */ + +#define TYPE_CONST(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CONST) + +/* Volatile type. If this is set, the corresponding type has a + * volatile modifier. + */ + +#define TYPE_VOLATILE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_VOLATILE) /* Instruction-space delimited type. This is for Harvard architectures which have separate instruction and data address spaces (and perhaps @@ -236,64 +296,26 @@ enum type_code If neither flag is set, the default space for functions / methods is instruction space, and for data objects is data memory. */ -#define TYPE_FLAG_CODE_SPACE (1 << 9) -#define TYPE_CODE_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_CODE_SPACE) - -#define TYPE_FLAG_DATA_SPACE (1 << 10) -#define TYPE_DATA_SPACE(t) (TYPE_INSTANCE_FLAGS (t) & TYPE_FLAG_DATA_SPACE) +#define TYPE_CODE_SPACE(t) \ + (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_CODE_SPACE) -/* FIXME drow/2002-06-03: Only used for methods, but applies as well - to functions. */ - -#define TYPE_FLAG_VARARGS (1 << 11) -#define TYPE_VARARGS(t) (TYPE_FLAGS (t) & TYPE_FLAG_VARARGS) - -/* Identify a vector type. Gcc is handling this by adding an extra - attribute to the array type. We slurp that in as a new flag of a - type. This is used only in dwarf2read.c. */ -#define TYPE_FLAG_VECTOR (1 << 12) -#define TYPE_VECTOR(t) (TYPE_FLAGS (t) & TYPE_FLAG_VECTOR) +#define TYPE_DATA_SPACE(t) \ + (TYPE_INSTANCE_FLAGS (t) & TYPE_INSTANCE_FLAG_DATA_SPACE) /* Address class flags. Some environments provide for pointers whose size is different from that of a normal pointer or address types where the bits are interpreted differently than normal addresses. The TYPE_FLAG_ADDRESS_CLASS_n flags may be used in target specific ways to represent these different types of address classes. */ -#define TYPE_FLAG_ADDRESS_CLASS_1 (1 << 13) #define TYPE_ADDRESS_CLASS_1(t) (TYPE_INSTANCE_FLAGS(t) \ - & TYPE_FLAG_ADDRESS_CLASS_1) -#define TYPE_FLAG_ADDRESS_CLASS_2 (1 << 14) + & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1) #define TYPE_ADDRESS_CLASS_2(t) (TYPE_INSTANCE_FLAGS(t) \ - & TYPE_FLAG_ADDRESS_CLASS_2) -#define TYPE_FLAG_ADDRESS_CLASS_ALL (TYPE_FLAG_ADDRESS_CLASS_1 \ - | TYPE_FLAG_ADDRESS_CLASS_2) + & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2) +#define TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL \ + (TYPE_INSTANCE_FLAG_ADDRESS_CLASS_1 | TYPE_INSTANCE_FLAG_ADDRESS_CLASS_2) #define TYPE_ADDRESS_CLASS_ALL(t) (TYPE_INSTANCE_FLAGS(t) \ - & TYPE_FLAG_ADDRESS_CLASS_ALL) - -/* The debugging formats (especially STABS) do not contain enough information - to represent all Ada types---especially those whose size depends on - dynamic quantities. Therefore, the GNAT Ada compiler includes - extra information in the form of additional type definitions - connected by naming conventions. This flag indicates that the - type is an ordinary (unencoded) GDB type that has been created from - the necessary run-time information, and does not need further - interpretation. Optionally marks ordinary, fixed-size GDB type. */ - -#define TYPE_FLAG_FIXED_INSTANCE (1 << 15) - -/* This debug target supports TYPE_STUB(t). In the unsupported case we have to - rely on NFIELDS to be zero etc., see TYPE_IS_OPAQUE (). - TYPE_STUB(t) with !TYPE_STUB_SUPPORTED(t) may exist if we only guessed - the TYPE_STUB(t) value (see dwarfread.c). */ - -#define TYPE_FLAG_STUB_SUPPORTED (1 << 16) -#define TYPE_STUB_SUPPORTED(t) (TYPE_FLAGS (t) & TYPE_FLAG_STUB_SUPPORTED) + & TYPE_INSTANCE_FLAG_ADDRESS_CLASS_ALL) -/* Not textual. By default, GDB treats all single byte integers as - characters (or elements of strings) unless this flag is set. */ - -#define TYPE_FLAG_NOTTEXT (1 << 17) -#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT) /* Array bound type. */ enum array_bound_type @@ -321,6 +343,41 @@ struct main_type ENUM_BITFIELD(array_bound_type) upper_bound_type : 4; ENUM_BITFIELD(array_bound_type) lower_bound_type : 4; + /* Flags about this type. These fields appear at this location + because they packs nicely here. See the TYPE_* macros for + documentation about these fields. */ + + unsigned int flag_unsigned : 1; + unsigned int flag_nosign : 1; + unsigned int flag_stub : 1; + unsigned int flag_target_stub : 1; + unsigned int flag_static : 1; + unsigned int flag_prototyped : 1; + unsigned int flag_incomplete : 1; + unsigned int flag_varargs : 1; + unsigned int flag_vector : 1; + unsigned int flag_stub_supported : 1; + unsigned int flag_nottext : 1; + unsigned int flag_fixed_instance : 1; + + /* Number of fields described for this type. This field appears at + this location because it packs nicely here. */ + + short nfields; + + /* Field number of the virtual function table pointer in + VPTR_BASETYPE. If -1, we were unable to find the virtual + function table pointer in initial symbol reading, and + get_vptr_fieldno should be called to find it if possible. + get_vptr_fieldno will update this field if possible. + Otherwise the value is left at -1. + + Unused if this type does not have virtual functions. + + This field appears at this location because it packs nicely here. */ + + short vptr_fieldno; + /* Name of this type, or NULL if none. This is used for printing only, except by poorly designed C++ code. @@ -364,25 +421,6 @@ struct main_type struct type *target_type; - /* Flags about this type. */ - - int flags; - - /* Number of fields described for this type */ - - short nfields; - - /* Field number of the virtual function table pointer in - VPTR_BASETYPE. If -1, we were unable to find the virtual - function table pointer in initial symbol reading, and - get_vptr_fieldno should be called to find it if possible. - get_vptr_fieldno will update this field if possible. - Otherwise the value is left at -1. - - Unused if this type does not have virtual functions. */ - - short vptr_fieldno; - /* For structure and union types, a description of each field. For set and pascal array types, there is one "field", whose type is the domain type of the set or array. @@ -766,7 +804,6 @@ extern void allocate_cplus_struct_type (struct type *); calls check_typedef, TYPE_LENGTH (VALUE_TYPE (X)) is safe. */ #define TYPE_LENGTH(thistype) (thistype)->length #define TYPE_OBJFILE(thistype) TYPE_MAIN_TYPE(thistype)->objfile -#define TYPE_FLAGS(thistype) TYPE_MAIN_TYPE(thistype)->flags /* Note that TYPE_CODE can be TYPE_CODE_TYPEDEF, so if you want the real type, you need to do TYPE_CODE (check_type (this_type)). */ #define TYPE_CODE(thistype) TYPE_MAIN_TYPE(thistype)->code diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c index 6c8feb5c108..048454aae39 100644 --- a/gdb/i386-tdep.c +++ b/gdb/i386-tdep.c @@ -2038,7 +2038,7 @@ i386_mmx_type (struct gdbarch *gdbarch) append_composite_type_field (t, "v8_int8", init_vector_type (builtin_type_int8, 8)); - TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (t) = 1; TYPE_NAME (t) = "builtin_type_vec64i"; tdep->i386_mmx_type = t; } @@ -2084,7 +2084,7 @@ i386_sse_type (struct gdbarch *gdbarch) init_vector_type (builtin_type_int64, 2)); append_composite_type_field (t, "uint128", builtin_type_int128); - TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (t) = 1; TYPE_NAME (t) = "builtin_type_vec128i"; tdep->i386_sse_type = t; } diff --git a/gdb/iq2000-tdep.c b/gdb/iq2000-tdep.c index 4843ff1e67e..d7a47a2ba20 100644 --- a/gdb/iq2000-tdep.c +++ b/gdb/iq2000-tdep.c @@ -93,7 +93,7 @@ iq2000_pointer_to_address (struct type * type, const gdb_byte * buf) if (target == TYPE_CODE_FUNC || target == TYPE_CODE_METHOD - || (TYPE_FLAGS (TYPE_TARGET_TYPE (type)) & TYPE_FLAG_CODE_SPACE) != 0) + || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type))) addr = insn_addr_from_ptr (addr); return addr; diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 8a5a8f9c066..ecce2370c35 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -189,7 +189,7 @@ java_lookup_class (char *name) TYPE_CODE (type) = TYPE_CODE_STRUCT; INIT_CPLUS_SPECIFIC (type); TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->objfile_obstack); - TYPE_FLAGS (type) |= TYPE_FLAG_STUB; + TYPE_STUB (type) = 1; TYPE ? = addr; return type; #else diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ab797f5586c..ede6fce235a 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -789,7 +789,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, /* All functions in C++ have prototypes. For C we don't have enough information in the debug info. */ if (SYMBOL_LANGUAGE (s) == language_cplus) - TYPE_FLAGS (SYMBOL_TYPE (s)) |= TYPE_FLAG_PROTOTYPED; + TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1; /* Create and enter a new lexical context */ b = new_block (FUNCTION_BLOCK); @@ -1080,7 +1080,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, f++; } if (unsigned_enum) - TYPE_FLAGS (t) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (t) = 1; } /* make this the current type */ top_stack->cur_type = t; @@ -1094,7 +1094,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, do not create a symbol for it either. */ if (TYPE_NFIELDS (t) == 0) { - TYPE_FLAGS (t) |= TYPE_FLAG_STUB; + TYPE_STUB (t) = 1; break; } @@ -1781,7 +1781,7 @@ upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend, problem. */ if (TYPE_LENGTH (*tpp) == 0) { - TYPE_FLAGS (t) |= TYPE_FLAG_TARGET_STUB; + TYPE_TARGET_STUB (t) = 1; } *tpp = t; diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index d48ea9ec629..fa00cc45437 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -2087,7 +2087,7 @@ rs6000_builtin_type_vec64 (struct gdbarch *gdbarch) append_composite_type_field (t, "v8_int8", init_vector_type (builtin_type_int8, 8)); - TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (t) = 1; TYPE_NAME (t) = "ppc_builtin_type_vec64"; tdep->ppc_builtin_type_vec64 = t; } diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 73abdd1416c..911785a0934 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -1080,7 +1080,7 @@ sh_push_dummy_call_fpu (struct gdbarch *gdbarch, non-vararg argument to be on the stack, no matter how many registers have been used so far. */ if (sh_is_renesas_calling_convention (func_type) - && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS)) + && TYPE_VARARGS (func_type)) last_reg_arg = TYPE_NFIELDS (func_type) - 2; /* first force sp to a 4-byte alignment */ @@ -1217,7 +1217,7 @@ sh_push_dummy_call_nofpu (struct gdbarch *gdbarch, non-vararg argument to be on the stack, no matter how many registers have been used so far. */ if (sh_is_renesas_calling_convention (func_type) - && (TYPE_FLAGS (func_type) & TYPE_FLAG_VARARGS)) + && TYPE_VARARGS (func_type)) last_reg_arg = TYPE_NFIELDS (func_type) - 2; /* first force sp to a 4-byte alignment */ diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c index 502fc83cb5d..6e2fdb7212e 100644 --- a/gdb/spu-tdep.c +++ b/gdb/spu-tdep.c @@ -78,7 +78,7 @@ spu_builtin_type_vec128 (struct gdbarch *gdbarch) append_composite_type_field (t, "v4_float", init_vector_type (builtin_type_float, 4)); - TYPE_FLAGS (t) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (t) = 1; TYPE_NAME (t) = "spu_builtin_type_vec128"; tdep->spu_builtin_type_vec128 = t; diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 248f061b615..45e7cee1211 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -826,7 +826,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, than the "declared-as" type for unprototyped functions, so we treat all functions as if they were prototyped. This is used primarily for promotion when calling the function from GDB. */ - TYPE_FLAGS (SYMBOL_TYPE (sym)) |= TYPE_FLAG_PROTOTYPED; + TYPE_PROTOTYPED (SYMBOL_TYPE (sym)) = 1; /* fall into process_prototype_types */ @@ -872,7 +872,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, TYPE_FIELD_ARTIFICIAL (ftype, nparams++) = 0; } TYPE_NFIELDS (ftype) = nparams; - TYPE_FLAGS (ftype) |= TYPE_FLAG_PROTOTYPED; + TYPE_PROTOTYPED (ftype) = 1; } break; @@ -1564,7 +1564,7 @@ again: TYPE_CODE (type) = code; TYPE_TAG_NAME (type) = type_name; INIT_CPLUS_SPECIFIC (type); - TYPE_FLAGS (type) |= TYPE_FLAG_STUB; + TYPE_STUB (type) = 1; add_undefined_type (type, typenums); return type; @@ -1630,7 +1630,7 @@ again: } else { - TYPE_FLAGS (type) |= TYPE_FLAG_TARGET_STUB; + TYPE_TARGET_STUB (type) = 1; TYPE_TARGET_TYPE (type) = xtype; } } @@ -1725,7 +1725,7 @@ again: TYPE_FIELD_TYPE (func_type, i) = t->type; } TYPE_NFIELDS (func_type) = num_args; - TYPE_FLAGS (func_type) |= TYPE_FLAG_PROTOTYPED; + TYPE_PROTOTYPED (func_type) = 1; type = func_type; break; @@ -3338,7 +3338,7 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code, INIT_CPLUS_SPECIFIC (type); TYPE_CODE (type) = type_code; - TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; + TYPE_STUB (type) = 0; /* First comes the total size in bytes. */ @@ -3512,9 +3512,9 @@ read_enum_type (char **pp, struct type *type, TYPE_LENGTH (type) = gdbarch_int_bit (gdbarch) / HOST_CHAR_BIT; TYPE_CODE (type) = TYPE_CODE_ENUM; - TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; + TYPE_STUB (type) = 0; if (unsigned_enum) - TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; + TYPE_UNSIGNED (type) = 1; TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) TYPE_ALLOC (type, sizeof (struct field) * nsyms); diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3d7333fc972..38208c477a0 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2008-08-24 Tom Tromey + + * gdb.base/maint.exp: Update "maint print type". + 2008-08-21 Vladimir Prus * gdb.mi/mi-nonstop.exp: Fix the check for non-stop diff --git a/gdb/testsuite/gdb.base/maint.exp b/gdb/testsuite/gdb.base/maint.exp index 1955175a65d..05786e7e41d 100644 --- a/gdb/testsuite/gdb.base/maint.exp +++ b/gdb/testsuite/gdb.base/maint.exp @@ -401,7 +401,7 @@ gdb_expect { send_gdb "maint print type argc\n" gdb_expect { - -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags $hex\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\ + -re "type node $hex\r\nname .int. \\($hex\\)\r\ntagname .. \\($hex\\)\r\ncode $hex \\(TYPE_CODE_INT\\)\r\nlength \[24\]\r\nupper_bound_type $hex \\(BOUND_SIMPLE\\)\r\nlower_bound_type $hex \\(BOUND_SIMPLE\\)\r\nobjfile $hex\r\ntarget_type $hex\r\npointer_type $hex\r\nreference_type $hex\r\ntype_chain $hex\r\ninstance_flags $hex\r\nflags\r\nnfields 0 $hex\r\nvptr_basetype $hex\r\nvptr_fieldno -1\r\ntype_specific $hex\r\n$gdb_prompt $"\ { pass "maint print type" } -re ".*$gdb_prompt $" { fail "maint print type" } timeout { fail "(timeout) maint print type" } diff --git a/gdb/xml-tdesc.c b/gdb/xml-tdesc.c index d66c0e3e6b0..42bc4a03416 100644 --- a/gdb/xml-tdesc.c +++ b/gdb/xml-tdesc.c @@ -222,7 +222,7 @@ tdesc_end_union (struct gdb_xml_parser *parser, for (i = 0; i < TYPE_NFIELDS (data->current_union); i++) if (TYPE_VECTOR (TYPE_FIELD_TYPE (data->current_union, i))) { - TYPE_FLAGS (data->current_union) |= TYPE_FLAG_VECTOR; + TYPE_VECTOR (data->current_union) = 1; break; } }