diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-10-07 14:07:10 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-10-07 14:07:10 +0000 |
commit | 8c1c099fc46e7c80127337c0d81369fe18df33e5 (patch) | |
tree | f98cbae89cb92ae3e91cc66e3136e8782167c007 /gdb | |
parent | b9eb56c1fd7e43313494e4f50ed4f61351e49b16 (diff) | |
download | gdb-8c1c099fc46e7c80127337c0d81369fe18df33e5.zip gdb-8c1c099fc46e7c80127337c0d81369fe18df33e5.tar.gz gdb-8c1c099fc46e7c80127337c0d81369fe18df33e5.tar.bz2 |
* ada-lang.c (ada_evaluate_subexp) [OP_ATR_SIZE]: Add handling
of arguments that are references.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-lang.c | 11 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 572cf7f..e353473 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-10-07 Joel Brobecker <brobecker@adacore.com> + + * ada-lang.c (ada_evaluate_subexp) [OP_ATR_SIZE]: Add handling + of arguments that are references. + 2008-10-06 Doug Evans <dje@google.com> * dwarf2read.c (dwarf2_die_debug): New static global. diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 49fb252..1575fdd 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -9056,14 +9056,21 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp, case OP_ATR_SIZE: arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside); + type = value_type (arg1); + + /* If the argument is a reference, then dereference its type, since + the user is really asking for the size of the actual object, + not the size of the pointer. */ + if (TYPE_CODE (type) == TYPE_CODE_REF) + type = TYPE_TARGET_TYPE (type); + if (noside == EVAL_SKIP) goto nosideret; else if (noside == EVAL_AVOID_SIDE_EFFECTS) return value_zero (builtin_type_int32, not_lval); else return value_from_longest (builtin_type_int32, - TARGET_CHAR_BIT - * TYPE_LENGTH (value_type (arg1))); + TARGET_CHAR_BIT * TYPE_LENGTH (type)); case OP_ATR_VAL: evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP); |