From: Ulrich Weigand Date: Thu, 2 Jul 2009 12:20:18 +0000 (+0000) Subject: * ada-lang.c (assign_component): Use platform-specific integer type X-Git-Tag: msnyder-checkpoint-072509-branchpoint~244 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=22601c155deb926f6bd8ffa2faa04f80b52fc676;p=external%2Fbinutils.git * ada-lang.c (assign_component): Use platform-specific integer type instead of builtin_type_int32 type. (ada_evaluate_subexp) [OP_ATR_SIZE]: Likewise. * ax-gdb.c (gen_expr) [UNOP_NEG]: Use platform-specific integer type instead of builtin_type_int8 type. * valarith.c (value_x_unop): Likewise. * python/python-value.c (valpy_absolute): Avoid reference to builtin_type_int8 type. * eval.c (evaluate_subexp_standard): Use platform-specific integer type instead of builtin_type_int8 as EVAL_SKIP return value type. * ada-lang.c (ada_evaluate_subexp): Likewise. * jv-lang.c (evaluate_subexp_java): Likewise. * m2-lang.c (evaluate_subexp_modula2): Likewise. * scm-lang.c (evaluate_exp): Likewise. * value.h (value_bitstring): Add INDEX_TYPE argument. * valops.c (value_bitstring): Add INDEX_TYPE argument, use it instead of builtin_type_int32 as base range type. * eval.c (evaluate_subexp_standard): Update value_bitstring call. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index bd617d5..f7daf3a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,29 @@ 2009-07-02 Ulrich Weigand + * ada-lang.c (assign_component): Use platform-specific integer type + instead of builtin_type_int32 type. + (ada_evaluate_subexp) [OP_ATR_SIZE]: Likewise. + + * ax-gdb.c (gen_expr) [UNOP_NEG]: Use platform-specific integer type + instead of builtin_type_int8 type. + * valarith.c (value_x_unop): Likewise. + * python/python-value.c (valpy_absolute): Avoid reference to + builtin_type_int8 type. + + * eval.c (evaluate_subexp_standard): Use platform-specific integer + type instead of builtin_type_int8 as EVAL_SKIP return value type. + * ada-lang.c (ada_evaluate_subexp): Likewise. + * jv-lang.c (evaluate_subexp_java): Likewise. + * m2-lang.c (evaluate_subexp_modula2): Likewise. + * scm-lang.c (evaluate_exp): Likewise. + + * value.h (value_bitstring): Add INDEX_TYPE argument. + * valops.c (value_bitstring): Add INDEX_TYPE argument, use it instead + of builtin_type_int32 as base range type. + * eval.c (evaluate_subexp_standard): Update value_bitstring call. + +2009-07-02 Ulrich Weigand + * gdbtypes.c (lookup_array_range_type): Add prototype. (lookup_string_range_type): Likewise. * gdbtypes.c (lookup_array_range_type): New function. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 520b401..7bda72c 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -7990,7 +7990,8 @@ 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_int32, index); + struct type *index_type = builtin_type (exp->gdbarch)->builtin_int; + struct value *index_val = value_from_longest (index_type, index); elt = unwrap_value (ada_value_subscript (lhs, 1, &index_val)); } else @@ -9235,9 +9236,9 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) - return value_zero (builtin_type_int32, not_lval); + return value_zero (builtin_type (exp->gdbarch)->builtin_int, not_lval); else - return value_from_longest (builtin_type_int32, + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, TARGET_CHAR_BIT * TYPE_LENGTH (type)); case OP_ATR_VAL: @@ -9422,7 +9423,7 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, } nosideret: - return value_from_longest (builtin_type_int8, (LONGEST) 1); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); } diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c index 80f6cbf..4edf8f2 100644 --- a/gdb/ax-gdb.c +++ b/gdb/ax-gdb.c @@ -1642,7 +1642,8 @@ gen_expr (struct expression *exp, union exp_element **pc, case UNOP_NEG: (*pc)++; /* -FOO is equivalent to 0 - FOO. */ - gen_int_literal (ax, &value1, (LONGEST) 0, builtin_type_int8); + gen_int_literal (ax, &value1, 0, + builtin_type (exp->gdbarch)->builtin_int); gen_usual_unary (exp, ax, &value1); /* shouldn't do much */ gen_expr (exp, pc, ax, &value2); gen_usual_unary (exp, ax, &value2); diff --git a/gdb/eval.c b/gdb/eval.c index 4a35c93..531ad76 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -805,7 +805,8 @@ evaluate_subexp_standard (struct type *expect_type, += 3 + BYTES_TO_EXP_ELEM ((tem + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT); if (noside == EVAL_SKIP) goto nosideret; - return value_bitstring (&exp->elts[pc + 2].string, tem); + return value_bitstring (&exp->elts[pc + 2].string, tem, + builtin_type (exp->gdbarch)->builtin_int); break; case OP_ARRAY: @@ -2515,7 +2516,7 @@ GDB does not (yet) know how to evaluate that kind of expression")); } nosideret: - return value_from_longest (builtin_type_int8, (LONGEST) 1); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); } /* Evaluate a subexpression of EXP, at index *POS, diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index e522a46..9d24845 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -967,7 +967,7 @@ evaluate_subexp_java (struct type *expect_type, struct expression *exp, standard: return evaluate_subexp_standard (expect_type, exp, pos, noside); nosideret: - return value_from_longest (builtin_type_int8, (LONGEST) 1); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); } static char *java_demangle (const char *mangled, int options) diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index 85fa123..90c3b2f 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -275,7 +275,7 @@ evaluate_subexp_modula2 (struct type *expect_type, struct expression *exp, } nosideret: - return value_from_longest (builtin_type_int8, (LONGEST) 1); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); } diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c index ab89842..ebc15dc 100644 --- a/gdb/python/python-value.c +++ b/gdb/python/python-value.c @@ -551,8 +551,8 @@ valpy_positive (PyObject *self) static PyObject * valpy_absolute (PyObject *self) { - if (value_less (((value_object *) self)->value, - value_from_longest (builtin_type_int8, 0))) + struct value *value = ((value_object *) self)->value; + if (value_less (value, value_zero (value_type (value), not_lval))) return valpy_negative (self); else return valpy_positive (self); diff --git a/gdb/scm-lang.c b/gdb/scm-lang.c index b1d7865..66f293b 100644 --- a/gdb/scm-lang.c +++ b/gdb/scm-lang.c @@ -222,7 +222,7 @@ evaluate_exp (struct type *expect_type, struct expression *exp, } return evaluate_subexp_standard (expect_type, exp, pos, noside); nosideret: - return value_from_longest (builtin_type_int8, (LONGEST) 1); + return value_from_longest (builtin_type (exp->gdbarch)->builtin_int, 1); } const struct exp_descriptor exp_descriptor_scm = diff --git a/gdb/valarith.c b/gdb/valarith.c index f2b7ef7..0ee25d2 100644 --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -471,6 +471,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op, struct value * value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) { + struct gdbarch *gdbarch = current_gdbarch; struct value **argvec; char *ptr, *mangle_ptr; char tstr[13], mangle_tstr[13]; @@ -505,13 +506,13 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside) break; case UNOP_POSTINCREMENT: strcpy (ptr, "++"); - argvec[2] = value_from_longest (builtin_type_int8, 0); + argvec[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0); argvec[3] = 0; nargs ++; break; case UNOP_POSTDECREMENT: strcpy (ptr, "--"); - argvec[2] = value_from_longest (builtin_type_int8, 0); + argvec[2] = value_from_longest (builtin_type (gdbarch)->builtin_int, 0); argvec[3] = 0; nargs ++; break; diff --git a/gdb/valops.c b/gdb/valops.c index 52debbe..1f71a14 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1378,14 +1378,12 @@ value_string (char *ptr, int len, struct type *char_type) } struct value * -value_bitstring (char *ptr, int len) +value_bitstring (char *ptr, int len, struct type *index_type) { struct value *val; - struct type *domain_type = create_range_type (NULL, - builtin_type_int32, - 0, len - 1); - struct type *type = create_set_type ((struct type *) NULL, - domain_type); + struct type *domain_type + = create_range_type (NULL, index_type, 0, len - 1); + struct type *type = create_set_type (NULL, domain_type); TYPE_CODE (type) = TYPE_CODE_BITSTRING; val = allocate_value (type); memcpy (value_contents_raw (val), ptr, TYPE_LENGTH (type)); diff --git a/gdb/value.h b/gdb/value.h index e3574c1..6258d9f 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -384,7 +384,8 @@ extern struct value *value_cstring (char *ptr, int len, struct type *char_type); extern struct value *value_string (char *ptr, int len, struct type *char_type); -extern struct value *value_bitstring (char *ptr, int len); +extern struct value *value_bitstring (char *ptr, int len, + struct type *index_type); extern struct value *value_array (int lowbound, int highbound, struct value **elemvec);