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.
This commit is contained in:
Siva Chandra
2014-10-18 06:14:00 -07:00
parent f868b157aa
commit e0f52461c2
5 changed files with 140 additions and 6 deletions

View File

@@ -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;