diff options
author | Siva Chandra <sivachandra@chromium.org> | 2014-07-09 10:25:48 -0700 |
---|---|---|
committer | Siva Chandra <sivachandra@chromium.org> | 2014-08-15 18:28:59 -0700 |
commit | e66d44466912ecf581f6b67ff299d064c7bf4f1a (patch) | |
tree | 447ff1714ecb2c4bce548c8565e0102feb489cc8 /gdb/valops.c | |
parent | 940df408121be31beed22ef7a5ad133cb1592726 (diff) | |
download | gdb-e66d44466912ecf581f6b67ff299d064c7bf4f1a.zip gdb-e66d44466912ecf581f6b67ff299d064c7bf4f1a.tar.gz gdb-e66d44466912ecf581f6b67ff299d064c7bf4f1a.tar.bz2 |
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/valops.c')
-rw-r--r-- | gdb/valops.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index d9ce2f2..e1decf0 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -2449,6 +2449,12 @@ value_find_oload_method_list (struct value **argp, const char *method, ADL overload candidates when performing overload resolution for a fully qualified name. + If NOSIDE is EVAL_AVOID_SIDE_EFFECTS, then OBJP's memory cannot be + read while picking the best overload match (it may be all zeroes and thus + not have a vtable pointer), in which case skip virtual function lookup. + This is ok as typically EVAL_AVOID_SIDE_EFFECTS is only used to determine + the result type. + Note: This function does *not* check the value of overload_resolution. Caller must check it to see whether overload resolution is permitted. */ @@ -2458,7 +2464,8 @@ find_overload_match (struct value **args, int nargs, const char *name, enum oload_search_type method, struct value **objp, struct symbol *fsym, struct value **valp, struct symbol **symp, - int *staticp, const int no_adl) + int *staticp, const int no_adl, + const enum noside noside) { struct value *obj = (objp ? *objp : NULL); struct type *obj_type = obj ? value_type (obj) : NULL; @@ -2764,9 +2771,13 @@ find_overload_match (struct value **args, int nargs, { if (src_method_oload_champ >= 0) { - if (TYPE_FN_FIELD_VIRTUAL_P (fns_ptr, method_oload_champ)) - *valp = value_virtual_fn_field (&temp, fns_ptr, method_oload_champ, - basetype, boffset); + if (TYPE_FN_FIELD_VIRTUAL_P (fns_ptr, method_oload_champ) + && noside != EVAL_AVOID_SIDE_EFFECTS) + { + *valp = value_virtual_fn_field (&temp, fns_ptr, + method_oload_champ, basetype, + boffset); + } else *valp = value_fn_field (&temp, fns_ptr, method_oload_champ, basetype, boffset); |