aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:17:58 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2008-09-11 14:17:58 +0000
commit22fe0fbb30429cd8f4f086a1da5d4821433e6a41 (patch)
tree8519e22fe2dfc4d366850b7a9cb3410097b80943 /gdb/eval.c
parentd8631d213f802a03c92513bb264b2f4ae65eb259 (diff)
downloadgdb-22fe0fbb30429cd8f4f086a1da5d4821433e6a41.zip
gdb-22fe0fbb30429cd8f4f086a1da5d4821433e6a41.tar.gz
gdb-22fe0fbb30429cd8f4f086a1da5d4821433e6a41.tar.bz2
* valops.c (value_ind): No longer allow dereferencing an
integer type. * eval.c (evaluate_subexp_standard): Handle deferencing an integer type here. * ada-lang.c (ada_evaluate_subexp): Likewise.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 6a43e94..f4ae539 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2288,10 +2288,19 @@ evaluate_subexp_standard (struct type *expect_type,
lval_memory);
else if (TYPE_CODE (type) == TYPE_CODE_INT)
/* GDB allows dereferencing an int. */
- return value_zero (builtin_type_int, lval_memory);
+ return value_zero (builtin_type (exp->gdbarch)->builtin_int,
+ lval_memory);
else
error (_("Attempt to take contents of a non-pointer value."));
}
+
+ /* Allow * on an integer so we can cast it to whatever we want.
+ This returns an int, which seems like the most C-like thing to
+ do. "long long" variables are rare enough that
+ BUILTIN_TYPE_LONGEST would seem to be a mistake. */
+ if (TYPE_CODE (type) == TYPE_CODE_INT)
+ return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int,
+ (CORE_ADDR) value_as_address (arg1));
return value_ind (arg1);
case UNOP_ADDR: