summaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-07-09 10:25:48 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-08-15 18:28:59 -0700
commite66d44466912ecf581f6b67ff299d064c7bf4f1a (patch)
tree447ff1714ecb2c4bce548c8565e0102feb489cc8 /gdb/valarith.c
parent940df408121be31beed22ef7a5ad133cb1592726 (diff)
downloadbinutils-gdb-e66d44466912ecf581f6b67ff299d064c7bf4f1a.tar.gz
Add new argument NOSIDE to find_overload_match.
This is a fix for PR c++/17132. If this new argument is set to EVAL_AVOID_SIDE_EFFECTS, then the object's memory will not be read while picking the best overload match. gdb/ * eval.c: Update all calls to find_overload_match. * valarith.c: Likewise. (value_user_defined_cpp_op, value_user_defined_op): New argument NOSIDE. Update all callers. * valops.c (find_overload_match): New argument NOSIDE. * value.h (find_overload_match): Update signature. gdb/testsuite * gdb.cp/pr17132.cc: New file. * gdb.cp/pr17132.exp: New file.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index d60dedb2908..44673a11267 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -286,7 +286,7 @@ unop_user_defined_p (enum exp_opcode op, struct value *arg1)
static struct value *
value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
- int *static_memfuncp)
+ int *static_memfuncp, enum noside noside)
{
struct symbol *symp = NULL;
@@ -295,7 +295,7 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
find_overload_match (args, nargs, operator, BOTH /* could be method */,
&args[0] /* objp */,
NULL /* pass NULL symbol since symbol is unknown */,
- &valp, &symp, static_memfuncp, 0);
+ &valp, &symp, static_memfuncp, 0, noside);
if (valp)
return valp;
@@ -317,12 +317,15 @@ value_user_defined_cpp_op (struct value **args, int nargs, char *operator,
static struct value *
value_user_defined_op (struct value **argp, struct value **args, char *name,
- int *static_memfuncp, int nargs)
+ int *static_memfuncp, int nargs, enum noside noside)
{
struct value *result = NULL;
if (current_language->la_language == language_cplus)
- result = value_user_defined_cpp_op (args, nargs, name, static_memfuncp);
+ {
+ result = value_user_defined_cpp_op (args, nargs, name, static_memfuncp,
+ noside);
+ }
else
result = value_struct_elt (argp, args, name, static_memfuncp,
"structure");
@@ -471,7 +474,7 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
}
argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
- &static_memfuncp, 2);
+ &static_memfuncp, 2, noside);
if (argvec[0])
{
@@ -582,7 +585,7 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
}
argvec[0] = value_user_defined_op (&arg1, argvec + 1, tstr,
- &static_memfuncp, nargs);
+ &static_memfuncp, nargs, noside);
if (argvec[0])
{