From 6d84d3d833b29bb5adc88f462fa5ec9c65f5b143 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Thu, 11 Sep 2008 14:22:33 +0000 Subject: [PATCH] * ada-lang.c (ada_coerce_to_simple_array_type): Use builtin_type_int32 instead of builtin_type_int as default unspecified integral type. (ada_index_type, ada_array_bound_from_type, ada_variant_discrim_type, assign_component, to_fixed_range_type): Likewise. * ada-typeprint.c (print_range, print_range_bound, print_range_type_named): Likewise. * ada-valprint.c (print_optional_low_bound, ada_val_print_1): Likewise. * eval.c (evaluate_subexp_standard): Likewise. * gnu-v2-abi.c (gnuv2_virtual_fn_field): Likewise. * gnu-v3-abi.c (gnuv3_get_virtual_fn, gnuv3_baseclass_offset, build_gdb_vtable_type): Likewise. * jv-lang.c (java_array_type): Likewise. * m2-typeprint.c (m2_print_bounds, m2_is_long_set_of_type): Likewise. * m2-valprint.c (m2_print_long_set): Likewise. * parse.c (follow_types): Likewise. * p-typeprint.c (pascal_type_print_base): Likewise. * valops.c (value_one, value_array, value_string, value_bitstring): Likewise. * value.c (allocate_repeat_value, value_from_string): Likewise. * varobj.c (c_describe_child): Likewise. * mt-tdep.c (mt_register_type): Likewise. * sh-tdep.c (sh_sh4_build_float_register_type): Likewise. * sh64-tdep.c (sh64_build_float_register_type): Likewise. --- gdb/ChangeLog | 26 ++++++++++++++++++++++++++ gdb/ada-lang.c | 12 ++++++------ gdb/ada-typeprint.c | 8 ++++---- gdb/ada-valprint.c | 4 ++-- gdb/eval.c | 2 +- gdb/gnu-v2-abi.c | 2 +- gdb/gnu-v3-abi.c | 8 ++++---- gdb/jv-lang.c | 2 +- gdb/m2-typeprint.c | 4 ++-- gdb/m2-valprint.c | 4 ++-- gdb/mt-tdep.c | 2 +- gdb/p-typeprint.c | 2 +- gdb/parse.c | 2 +- gdb/sh-tdep.c | 2 +- gdb/sh64-tdep.c | 2 +- gdb/valops.c | 10 +++++----- gdb/value.c | 4 ++-- gdb/varobj.c | 2 +- 18 files changed, 62 insertions(+), 36 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 61644638c1..70b9ae94cd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2008-09-11 Ulrich Weigand + + * ada-lang.c (ada_coerce_to_simple_array_type): Use builtin_type_int32 + instead of builtin_type_int as default unspecified integral type. + (ada_index_type, ada_array_bound_from_type, ada_variant_discrim_type, + assign_component, to_fixed_range_type): Likewise. + * ada-typeprint.c (print_range, print_range_bound, + print_range_type_named): Likewise. + * ada-valprint.c (print_optional_low_bound, ada_val_print_1): Likewise. + * eval.c (evaluate_subexp_standard): Likewise. + * gnu-v2-abi.c (gnuv2_virtual_fn_field): Likewise. + * gnu-v3-abi.c (gnuv3_get_virtual_fn, gnuv3_baseclass_offset, + build_gdb_vtable_type): Likewise. + * jv-lang.c (java_array_type): Likewise. + * m2-typeprint.c (m2_print_bounds, m2_is_long_set_of_type): Likewise. + * m2-valprint.c (m2_print_long_set): Likewise. + * parse.c (follow_types): Likewise. + * p-typeprint.c (pascal_type_print_base): Likewise. + * valops.c (value_one, value_array, value_string, + value_bitstring): Likewise. + * value.c (allocate_repeat_value, value_from_string): Likewise. + * varobj.c (c_describe_child): Likewise. + * mt-tdep.c (mt_register_type): Likewise. + * sh-tdep.c (sh_sh4_build_float_register_type): Likewise. + * sh64-tdep.c (sh64_build_float_register_type): Likewise. + 2008-09-11 Ulrich Weigand * gdbtypes.h (struct builtin_type): Remove builtin_true_char diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 66f01ac048..844b25d9f4 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -1759,7 +1759,7 @@ struct type * ada_coerce_to_simple_array_type (struct type *type) { struct value *mark = value_mark (); - struct value *dummy = value_from_longest (builtin_type_long, 0); + struct value *dummy = value_from_longest (builtin_type_int32, 0); struct type *result; deprecated_set_value_type (dummy, type); result = ada_type_of_array (dummy, 0); @@ -2500,7 +2500,7 @@ ada_index_type (struct type *type, int n) has a target type of TYPE_CODE_UNDEF. We compensate here, but perhaps stabsread.c would make more sense. */ if (result_type == NULL || TYPE_CODE (result_type) == TYPE_CODE_UNDEF) - result_type = builtin_type_int; + result_type = builtin_type_int32; return result_type; } @@ -2528,7 +2528,7 @@ ada_array_bound_from_type (struct type * arr_type, int n, int which, if (arr_type == NULL || !ada_is_simple_array_type (arr_type)) { if (typep != NULL) - *typep = builtin_type_int; + *typep = builtin_type_int32; return (LONGEST) - which; } @@ -5842,7 +5842,7 @@ ada_variant_discrim_type (struct type *var_type, struct type *outer_type) struct type *type = ada_lookup_struct_elt_type (outer_type, name, 1, 1, NULL); if (type == NULL) - return builtin_type_int; + return builtin_type_int32; else return type; } @@ -8054,7 +8054,7 @@ assign_component (struct value *container, struct value *lhs, LONGEST index, struct value *elt; if (TYPE_CODE (value_type (lhs)) == TYPE_CODE_ARRAY) { - struct value *index_val = value_from_longest (builtin_type_int, index); + struct value *index_val = value_from_longest (builtin_type_int32, index); elt = unwrap_value (ada_value_subscript (lhs, 1, &index_val)); } else @@ -9504,7 +9504,7 @@ to_fixed_range_type (char *name, struct value *dval, struct objfile *objfile) char *subtype_info; if (raw_type == NULL) - base_type = builtin_type_int; + base_type = builtin_type_int32; else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (raw_type); else diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c index e46637f48b..cb4fecd3e1 100644 --- a/gdb/ada-typeprint.c +++ b/gdb/ada-typeprint.c @@ -149,7 +149,7 @@ print_range (struct type *type, struct ui_file *stream) case TYPE_CODE_ENUM: break; default: - target_type = builtin_type_int; + target_type = builtin_type_int32; break; } @@ -197,11 +197,11 @@ print_range_bound (struct type *type, char *bounds, int *n, the upper bound of the 0 .. -1 range types to be printed as a very large unsigned number instead of -1. To workaround this stabs deficiency, we replace the TYPE by - builtin_type_long when we detect that the bound is negative, + builtin_type_int32 when we detect that the bound is negative, and the type is a TYPE_CODE_INT. The bound is negative when 'm' is the last character of the number scanned in BOUNDS. */ if (bounds[*n - 1] == 'm' && TYPE_CODE (type) == TYPE_CODE_INT) - type = builtin_type_long; + type = builtin_type_int32; ada_print_scalar (type, B, stream); if (bounds[*n] == '_') *n += 2; @@ -258,7 +258,7 @@ print_range_type_named (char *name, struct ui_file *stream) char *subtype_info; if (raw_type == NULL) - base_type = builtin_type_int; + base_type = builtin_type_int32; else if (TYPE_CODE (raw_type) == TYPE_CODE_RANGE) base_type = TYPE_TARGET_TYPE (raw_type); else diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 5d8d73d56d..e2f7740e28 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -122,7 +122,7 @@ print_optional_low_bound (struct ui_file *stream, struct type *type) return 0; break; case TYPE_CODE_UNDEF: - index_type = builtin_type_long; + index_type = builtin_type_int32; /* FALL THROUGH */ default: if (low_bound == 1) @@ -753,7 +753,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0, make_pointer_type (create_array_type (NULL, builtin_type_true_char, - create_range_type (NULL, builtin_type_int, 0, 32)), NULL); + create_range_type (NULL, builtin_type_int32, 0, 32)), NULL); printable_val = value_ind (value_cast (parray_of_char, diff --git a/gdb/eval.c b/gdb/eval.c index 0cccc82866..66259b9f95 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2028,7 +2028,7 @@ evaluate_subexp_standard (struct type *expect_type, /* Construct a value node with the value of the offset */ - arg2 = value_from_longest (builtin_type_f_integer, offset_item); + arg2 = value_from_longest (builtin_type_int32, offset_item); /* Let us now play a dirty trick: we will take arg1 which is a value node pointing to the topmost level diff --git a/gdb/gnu-v2-abi.c b/gdb/gnu-v2-abi.c index 771cc2b709..2405fb04eb 100644 --- a/gdb/gnu-v2-abi.c +++ b/gdb/gnu-v2-abi.c @@ -97,7 +97,7 @@ gnuv2_virtual_fn_field (struct value **arg1p, struct fn_field * f, int j, struct value *entry; struct value *vfn; struct value *vtbl; - struct value *vi = value_from_longest (builtin_type_int, + struct value *vi = value_from_longest (builtin_type_int32, (LONGEST) TYPE_FN_FIELD_VOFFSET (f, j)); struct type *fcontext = TYPE_FN_FIELD_FCONTEXT (f, j); struct type *context; diff --git a/gdb/gnu-v3-abi.c b/gdb/gnu-v3-abi.c index 90497ca0b0..1ae6d9a079 100644 --- a/gdb/gnu-v3-abi.c +++ b/gdb/gnu-v3-abi.c @@ -132,7 +132,7 @@ build_gdb_vtable_type (struct gdbarch *arch) FIELD_NAME (*field) = "vcall_and_vbase_offsets"; FIELD_TYPE (*field) = create_array_type (0, ptrdiff_type, - create_range_type (0, builtin_type_int, 0, -1)); + create_range_type (0, builtin_type_int32, 0, -1)); FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT; offset += TYPE_LENGTH (FIELD_TYPE (*field)); field++; @@ -155,7 +155,7 @@ build_gdb_vtable_type (struct gdbarch *arch) FIELD_NAME (*field) = "virtual_functions"; FIELD_TYPE (*field) = create_array_type (0, ptr_to_void_fn_type, - create_range_type (0, builtin_type_int, 0, -1)); + create_range_type (0, builtin_type_int32, 0, -1)); FIELD_BITPOS (*field) = offset * TARGET_CHAR_BIT; offset += TYPE_LENGTH (FIELD_TYPE (*field)); field++; @@ -326,7 +326,7 @@ gnuv3_get_virtual_fn (struct value *container, struct type *fntype, /* Fetch the appropriate function pointer from the vtable. */ vfn = value_subscript (value_field (vtable, vtable_field_virtual_functions), - value_from_longest (builtin_type_int, vtable_index)); + value_from_longest (builtin_type_int32, vtable_index)); /* If this architecture uses function descriptors directly in the vtable, then the address of the vtable entry is actually a "function pointer" @@ -429,7 +429,7 @@ gnuv3_baseclass_offset (struct type *type, int index, const bfd_byte *valaddr, address)); vtable = value_at_lazy (vtable_type, vtable_address - vtable_address_point_offset ()); - offset_val = value_from_longest(builtin_type_int, cur_base_offset); + offset_val = value_from_longest(builtin_type_int32, cur_base_offset); vbase_array = value_field (vtable, vtable_field_vcall_and_vbase_offsets); base_offset = value_as_long (value_subscript (vbase_array, offset_val)); return base_offset; diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 4430633240..39d8f4821e 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -775,7 +775,7 @@ java_array_type (struct type *type, int dims) while (dims-- > 0) { - range_type = create_range_type (NULL, builtin_type_int, 0, 0); + range_type = create_range_type (NULL, builtin_type_int32, 0, 0); /* FIXME This is bogus! Java arrays are not gdb arrays! */ type = create_array_type (NULL, type, range_type); } diff --git a/gdb/m2-typeprint.c b/gdb/m2-typeprint.c index 335f8c3c41..666ae28667 100644 --- a/gdb/m2-typeprint.c +++ b/gdb/m2-typeprint.c @@ -287,7 +287,7 @@ m2_print_bounds (struct type *type, struct type *target = TYPE_TARGET_TYPE (type); if (target == NULL) - target = builtin_type_int; + target = builtin_type_int32; if (TYPE_NFIELDS(type) == 0) return; @@ -394,7 +394,7 @@ m2_is_long_set_of_type (struct type *type, struct type **of_type) range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)); target = TYPE_TARGET_TYPE (range); if (target == NULL) - target = builtin_type_int; + target = builtin_type_int32; l1 = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i))); h1 = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1))); diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index e09ec2153f..82ff30e0b7 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -119,7 +119,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr, target = TYPE_TARGET_TYPE (range); if (target == NULL) - target = builtin_type_int; + target = builtin_type_int32; if (get_discrete_bounds (range, &field_low, &field_high) >= 0) { @@ -165,7 +165,7 @@ m2_print_long_set (struct type *type, const gdb_byte *valaddr, break; target = TYPE_TARGET_TYPE (range); if (target == NULL) - target = builtin_type_int; + target = builtin_type_int32; } } if (element_seen) diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index 0a78f0fe16..fd3f5882d4 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -258,7 +258,7 @@ mt_register_type (struct gdbarch *arch, int regnum) if (copro_type == NULL) { struct type *temp; - temp = create_range_type (NULL, builtin_type_unsigned_int, 0, 1); + temp = create_range_type (NULL, builtin_type_int32, 0, 1); copro_type = create_array_type (NULL, builtin_type_int16, temp); } switch (regnum) diff --git a/gdb/p-typeprint.c b/gdb/p-typeprint.c index e2c34e5e9c..a10982d773 100644 --- a/gdb/p-typeprint.c +++ b/gdb/p-typeprint.c @@ -756,7 +756,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show, { struct type *target = TYPE_TARGET_TYPE (type); if (target == NULL) - target = builtin_type_long; + target = builtin_type_int32; print_type_scalar (target, TYPE_LOW_BOUND (type), stream); fputs_filtered ("..", stream); print_type_scalar (target, TYPE_HIGH_BOUND (type), stream); diff --git a/gdb/parse.c b/gdb/parse.c index 2a6b8cb25d..75853ff2e2 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -1262,7 +1262,7 @@ follow_types (struct type *follow_type) done with it. */ range_type = create_range_type ((struct type *) NULL, - builtin_type_int, 0, + builtin_type_int32, 0, array_size >= 0 ? array_size - 1 : 0); follow_type = create_array_type ((struct type *) NULL, diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c index 0c841d6f61..20ba95ec08 100644 --- a/gdb/sh-tdep.c +++ b/gdb/sh-tdep.c @@ -2148,7 +2148,7 @@ sh_sh4_build_float_register_type (int high) { struct type *temp; - temp = create_range_type (NULL, builtin_type_int, 0, high); + temp = create_range_type (NULL, builtin_type_int32, 0, high); return create_array_type (NULL, builtin_type_float, temp); } diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index d8ab939914..e127995cbd 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -1499,7 +1499,7 @@ sh64_build_float_register_type (int high) { struct type *temp; - temp = create_range_type (NULL, builtin_type_int, 0, high); + temp = create_range_type (NULL, builtin_type_int32, 0, high); return create_array_type (NULL, builtin_type_float, temp); } diff --git a/gdb/valops.c b/gdb/valops.c index f14c2f5f38..48c2445630 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -529,11 +529,11 @@ value_one (struct type *type, enum lval_type lv) if (TYPE_CODE (type1) == TYPE_CODE_DECFLOAT) { - struct value *int_one = value_from_longest (builtin_type_int, 1); + struct value *int_one = value_from_longest (builtin_type_int32, 1); struct value *val; gdb_byte v[16]; - decimal_from_integral (int_one, v, TYPE_LENGTH (builtin_type_int)); + decimal_from_integral (int_one, v, TYPE_LENGTH (builtin_type_int32)); val = value_from_decfloat (type, v); } else if (TYPE_CODE (type1) == TYPE_CODE_FLT) @@ -1247,7 +1247,7 @@ value_array (int lowbound, int highbound, struct value **elemvec) } rangetype = create_range_type ((struct type *) NULL, - builtin_type_int, + builtin_type_int32, lowbound, highbound); arraytype = create_array_type ((struct type *) NULL, value_enclosing_type (elemvec[0]), @@ -1291,7 +1291,7 @@ value_string (char *ptr, int len) struct value *val; int lowbound = current_language->string_lower_bound; struct type *rangetype = create_range_type ((struct type *) NULL, - builtin_type_int, + builtin_type_int32, lowbound, len + lowbound - 1); struct type *stringtype @@ -1321,7 +1321,7 @@ value_bitstring (char *ptr, int len) { struct value *val; struct type *domain_type = create_range_type (NULL, - builtin_type_int, + builtin_type_int32, 0, len - 1); struct type *type = create_set_type ((struct type *) NULL, domain_type); diff --git a/gdb/value.c b/gdb/value.c index c0e6c99b36..f3f2c72dab 100644 --- a/gdb/value.c +++ b/gdb/value.c @@ -249,7 +249,7 @@ allocate_repeat_value (struct type *type, int count) /* FIXME-type-allocation: need a way to free this type when we are done with it. */ struct type *range_type - = create_range_type ((struct type *) NULL, builtin_type_int, + = create_range_type ((struct type *) NULL, builtin_type_int32, low_bound, count + low_bound - 1); /* FIXME-type-allocation: need a way to free this type when we are done with it. */ @@ -1638,7 +1638,7 @@ value_from_string (char *ptr) struct type *stringtype; rangetype = create_range_type ((struct type *) NULL, - builtin_type_int, + builtin_type_int32, lowbound, len + lowbound - 1); string_char_type = language_string_char_type (current_language, current_gdbarch); diff --git a/gdb/varobj.c b/gdb/varobj.c index 3a0bf5e373..35d876ff09 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2072,7 +2072,7 @@ c_describe_child (struct varobj *parent, int index, { int real_index = index + TYPE_LOW_BOUND (TYPE_INDEX_TYPE (type)); struct value *indval = - value_from_longest (builtin_type_int, (LONGEST) real_index); + value_from_longest (builtin_type_int32, (LONGEST) real_index); gdb_value_subscript (value, indval, cvalue); } -- 2.34.1