aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-10-18 06:14:00 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-11-03 18:01:39 -0800
commite0f52461c2467b6610391681fa27cd9b3c5def57 (patch)
treedd366cad441389a5483994a0c6ad2454464ac4e2 /gdb/eval.c
parentf868b157aa4079bcdcb482b6b6634b5df8f74dbd (diff)
downloadgdb-e0f52461c2467b6610391681fa27cd9b3c5def57.zip
gdb-e0f52461c2467b6610391681fa27cd9b3c5def57.tar.gz
gdb-e0f52461c2467b6610391681fa27cd9b3c5def57.tar.bz2
Fix evaluation of method calls under EVAL_SKIP.
When evaluating method calls under EVAL_SKIP, the "object" and the arguments to the method should also be evaluated under EVAL_SKIP, instead of skipping to evaluate them as was being done previously. gdb/ChangeLog: PR c++/17494 * eval.c (evaluate_subexp_standard): Evaluate the "object" and the method args also under EVAL_SKIP when evaluating method calls under EVAL_SKIP. gdb/testsuite/ChangeLog: PR c++/17494 * gdb.cp/pr17494.cc: New file. * gdb.cp/pr17494.exp: New file.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 5906744..ab431c6 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1332,9 +1332,6 @@ evaluate_subexp_standard (struct type *expect_type,
/* First, evaluate the structure into arg2. */
pc2 = (*pos)++;
- if (noside == EVAL_SKIP)
- goto nosideret;
-
if (op == STRUCTOP_MEMBER)
{
arg2 = evaluate_subexp_for_address (exp, pos, noside);
@@ -1353,7 +1350,10 @@ evaluate_subexp_standard (struct type *expect_type,
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
type = check_typedef (value_type (arg1));
- if (TYPE_CODE (type) == TYPE_CODE_METHODPTR)
+ if (noside == EVAL_SKIP)
+ tem = 1; /* Set it to the right arg index so that all arguments
+ can also be skipped. */
+ else if (TYPE_CODE (type) == TYPE_CODE_METHODPTR)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
arg1 = value_zero (TYPE_TARGET_TYPE (type), not_lval);
@@ -1396,8 +1396,6 @@ evaluate_subexp_standard (struct type *expect_type,
pc2 = (*pos)++;
tem2 = longest_to_int (exp->elts[pc2 + 1].longconst);
*pos += 3 + BYTES_TO_EXP_ELEM (tem2 + 1);
- if (noside == EVAL_SKIP)
- goto nosideret;
if (op == STRUCTOP_STRUCT)
{
@@ -1546,6 +1544,9 @@ evaluate_subexp_standard (struct type *expect_type,
/* Signal end of arglist. */
argvec[tem] = 0;
+ if (noside == EVAL_SKIP)
+ goto nosideret;
+
if (op == OP_ADL_FUNC)
{
struct symbol *symp;