aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorKen Werner <ken.werner@de.ibm.com>2010-11-03 13:49:38 +0000
committerKen Werner <ken.werner@de.ibm.com>2010-11-03 13:49:38 +0000
commitc37f7098e9cb05b2574cf82e6ae299530ed407ba (patch)
tree04d07481c7bee9f22662d80e56efecb1311ce103 /gdb/eval.c
parent2ebf396434301f62203a5f1d3ada888af8dd193d (diff)
downloadgdb-c37f7098e9cb05b2574cf82e6ae299530ed407ba.zip
gdb-c37f7098e9cb05b2574cf82e6ae299530ed407ba.tar.gz
gdb-c37f7098e9cb05b2574cf82e6ae299530ed407ba.tar.bz2
gdb:
* value.h (value_non_lval): Declare. * value.c (value_non_lval): New function. * eval.c (evaluate_subexp_standard) <UNOP_POSTINCREMENT, UNOP_POSTDECREMENT>: Call value_non_lval to ensure to return a non-lvalue. gdb/testsuite: * gdb.base/exprs.exp: Add tests for pre-/post- in-/decrement operators.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 471dcd7..71c3ff8 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2782,6 +2782,8 @@ evaluate_subexp_standard (struct type *expect_type,
}
else
{
+ arg3 = value_non_lval (arg1);
+
if (ptrmath_type_p (exp->language_defn, value_type (arg1)))
arg2 = value_ptradd (arg1, 1);
else
@@ -2794,7 +2796,7 @@ evaluate_subexp_standard (struct type *expect_type,
}
value_assign (arg1, arg2);
- return arg1;
+ return arg3;
}
case UNOP_POSTDECREMENT:
@@ -2807,6 +2809,8 @@ evaluate_subexp_standard (struct type *expect_type,
}
else
{
+ arg3 = value_non_lval (arg1);
+
if (ptrmath_type_p (exp->language_defn, value_type (arg1)))
arg2 = value_ptradd (arg1, -1);
else
@@ -2819,7 +2823,7 @@ evaluate_subexp_standard (struct type *expect_type,
}
value_assign (arg1, arg2);
- return arg1;
+ return arg3;
}
case OP_THIS: