aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:12:57 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:12:57 +0000
commit98b90dd8884cb6526f17524e800a315860904ec0 (patch)
tree5a4e5fc0e4b814c25ada5188b1b4c40e23958261
parentc806c55a0672b52f228ce56f5bf57f065c447506 (diff)
downloadgdb-98b90dd8884cb6526f17524e800a315860904ec0.zip
gdb-98b90dd8884cb6526f17524e800a315860904ec0.tar.gz
gdb-98b90dd8884cb6526f17524e800a315860904ec0.tar.bz2
* eval.c (evaluate_subexp_for_sizeof): Use builtin_int type of
the expression architecture instead of builtin_type_int as the sizeof return type.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/eval.c12
2 files changed, 12 insertions, 6 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f98c925..6a903b9 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@
2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
+ * eval.c (evaluate_subexp_for_sizeof): Use builtin_int type of
+ the expression architecture instead of builtin_type_int as the
+ sizeof return type.
+
+2008-09-11 Ulrich Weigand <uweigand@de.ibm.com>
+
* expression.h (enum exp_opcode): Document OP_COMPLEX to take
a type parameter as expression element.
* eval.c (evaluate_subexp_standard) [OP_COMPLEX]: Retrieve result
diff --git a/gdb/eval.c b/gdb/eval.c
index 92b2d72..3c082c2 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2335,6 +2335,8 @@ evaluate_subexp_with_coercion (struct expression *exp,
static struct value *
evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
{
+ /* FIXME: This should be size_t. */
+ struct type *size_type = builtin_type (exp->gdbarch)->builtin_int;
enum exp_opcode op;
int pc;
struct type *type;
@@ -2358,24 +2360,22 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos)
&& TYPE_CODE (type) != TYPE_CODE_ARRAY)
error (_("Attempt to take contents of a non-pointer value."));
type = check_typedef (TYPE_TARGET_TYPE (type));
- return value_from_longest (builtin_type_int, (LONGEST)
- TYPE_LENGTH (type));
+ return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
case UNOP_MEMVAL:
(*pos) += 3;
type = check_typedef (exp->elts[pc + 1].type);
- return value_from_longest (builtin_type_int,
- (LONGEST) TYPE_LENGTH (type));
+ return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
case OP_VAR_VALUE:
(*pos) += 4;
type = check_typedef (SYMBOL_TYPE (exp->elts[pc + 2].symbol));
return
- value_from_longest (builtin_type_int, (LONGEST) TYPE_LENGTH (type));
+ value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type));
default:
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
- return value_from_longest (builtin_type_int,
+ return value_from_longest (size_type,
(LONGEST) TYPE_LENGTH (value_type (val)));
}
}