diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2008-09-11 14:17:58 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2008-09-11 14:17:58 +0000 |
commit | 22fe0fbb30429cd8f4f086a1da5d4821433e6a41 (patch) | |
tree | 8519e22fe2dfc4d366850b7a9cb3410097b80943 | |
parent | d8631d213f802a03c92513bb264b2f4ae65eb259 (diff) | |
download | gdb-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.
-rw-r--r-- | gdb/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/ada-lang.c | 7 | ||||
-rw-r--r-- | gdb/eval.c | 11 | ||||
-rw-r--r-- | gdb/valops.c | 9 |
4 files changed, 25 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4249f7f..aedacce 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,13 @@ 2008-09-11 Ulrich Weigand <uweigand@de.ibm.com> + * 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. + +2008-09-11 Ulrich Weigand <uweigand@de.ibm.com> + * ada-valprint.c (ada_val_print_1): When implicitly dereferencing a reference type, pass the reference type directly to unpack_pointer. * c-valprint.c (c_val_print): Likewise. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 15310ef..75a9828 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -9155,7 +9155,8 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, } 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.")); } @@ -9165,6 +9166,10 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, if (ada_is_array_descriptor_type (type)) /* GDB allows dereferencing GNAT array descriptors. */ return ada_coerce_to_simple_array (arg1); + else if (TYPE_CODE (type) == TYPE_CODE_INT) + /* GDB allows dereferencing an int. */ + return value_at_lazy (builtin_type (exp->gdbarch)->builtin_int, + (CORE_ADDR) value_as_address (arg1)); else return ada_value_ind (arg1); @@ -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: diff --git a/gdb/valops.c b/gdb/valops.c index 0d1ffdf..f14c2f5 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -1172,14 +1172,7 @@ value_ind (struct value *arg1) base_type = check_typedef (value_type (arg1)); - /* 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 (base_type) == TYPE_CODE_INT) - return value_at_lazy (builtin_type_int, - (CORE_ADDR) value_as_address (arg1)); - else if (TYPE_CODE (base_type) == TYPE_CODE_PTR) + if (TYPE_CODE (base_type) == TYPE_CODE_PTR) { struct type *enc_type; /* We may be pointing to something embedded in a larger object. |