* 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.
This commit is contained in:
Ulrich Weigand 2009-07-02 12:20:18 +00:00
parent e3506a9f27
commit 22601c155d
11 changed files with 48 additions and 21 deletions

View File

@ -1,3 +1,27 @@
2009-07-02 Ulrich Weigand <uweigand@de.ibm.com>
* 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 <uweigand@de.ibm.com>
* gdbtypes.c (lookup_array_range_type): Add prototype.

View File

@ -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);
}

View File

@ -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);

View File

@ -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,

View File

@ -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)

View File

@ -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);
}

View File

@ -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);

View File

@ -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 =

View File

@ -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;

View File

@ -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));

View File

@ -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);