aboutsummaryrefslogtreecommitdiff
path: root/gdb/ada-lang.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-09-10 16:12:35 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-09-10 16:12:35 +0000
commit2ac8a782d97ff325b3873a02672c79b5a33a3a0c (patch)
tree3d8d3f6ae0eeb76c852559f56eefde0a9998f06d /gdb/ada-lang.c
parentb861ac8114b6e8351e6694c2a025dce137acb876 (diff)
downloadgdb-2ac8a782d97ff325b3873a02672c79b5a33a3a0c.zip
gdb-2ac8a782d97ff325b3873a02672c79b5a33a3a0c.tar.gz
gdb-2ac8a782d97ff325b3873a02672c79b5a33a3a0c.tar.bz2
* ada-lang.c (ada_evaluate_subexp) [BINOP_ADD, BINOP_SUB]:
Add special handling for pointer types.
Diffstat (limited to 'gdb/ada-lang.c')
-rw-r--r--gdb/ada-lang.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 8845433..fa163c4 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -8497,6 +8497,10 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
+ if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR)
+ return (value_from_longest
+ (value_type (arg1),
+ value_as_long (arg1) + value_as_long (arg2)));
if ((ada_is_fixed_point_type (value_type (arg1))
|| ada_is_fixed_point_type (value_type (arg2)))
&& value_type (arg1) != value_type (arg2))
@@ -8514,6 +8518,10 @@ ada_evaluate_subexp (struct type *expect_type, struct expression *exp,
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
if (noside == EVAL_SKIP)
goto nosideret;
+ if (TYPE_CODE (value_type (arg1)) == TYPE_CODE_PTR)
+ return (value_from_longest
+ (value_type (arg1),
+ value_as_long (arg1) - value_as_long (arg2)));
if ((ada_is_fixed_point_type (value_type (arg1))
|| ada_is_fixed_point_type (value_type (arg2)))
&& value_type (arg1) != value_type (arg2))