From 2ac8a782d97ff325b3873a02672c79b5a33a3a0c Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Wed, 10 Sep 2008 16:12:35 +0000 Subject: [PATCH] * ada-lang.c (ada_evaluate_subexp) [BINOP_ADD, BINOP_SUB]: Add special handling for pointer types. --- gdb/ChangeLog | 5 +++++ gdb/ada-lang.c | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 05db26505b9..deec62d95e8 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2008-09-10 Joel Brobecker + + * ada-lang.c (ada_evaluate_subexp) [BINOP_ADD, BINOP_SUB]: + Add special handling for pointer types. + 2008-09-10 Pedro Alves * inf-ttrace.c (inf_ttrace_follow_fork): Declare locals at the diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 8845433061f..fa163c4b54c 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)) -- 2.30.2