aboutsummaryrefslogtreecommitdiff
path: root/gdb/valarith.c
diff options
context:
space:
mode:
authorSiva Chandra <sivachandra@chromium.org>2014-05-20 06:41:39 -0700
committerSiva Chandra <sivachandra@chromium.org>2014-06-03 09:54:21 -0700
commit233e8b28cf7b548ca197a7a6d9bf5f9ce80053ac (patch)
treecfd187d00cfc805f22d8e1d4736413e742e7a3cf /gdb/valarith.c
parente81e7f5e38bf0da52d9e88a94e4df9aeecd80357 (diff)
downloadgdb-233e8b28cf7b548ca197a7a6d9bf5f9ce80053ac.zip
gdb-233e8b28cf7b548ca197a7a6d9bf5f9ce80053ac.tar.gz
gdb-233e8b28cf7b548ca197a7a6d9bf5f9ce80053ac.tar.bz2
Lookup and invoke debug methods of C++ classes if they are the best match.
* eval.c (evaluate_subexp_standard): Call the xmethod if the best match method returned by find_overload_match is an xmethod. * valarith.c (value_x_binop, value_x_unop): Call the xmethod if the best matching operator returned by find_overload_match is an xmethod. * valops.c: #include "extension.h". (find_method_list): Add "fn_list" and "xm_worker_vec" arguments. Return void. The list of matching source methods is returned in "fn_list" and a vector of matching debug method workers is returned in "xm_worker_vec". Update all callers. (value_find_oload_method_list): Likewise. (find_oload_champ): Add "xm_worker_vec" parameter. If it is non-NULL, then the index of the best matching method in this vector is returned. Update all callers. (find_overload_match): Include xmethods while performing overload resolution.
Diffstat (limited to 'gdb/valarith.c')
-rw-r--r--gdb/valarith.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 8e863e3..4da41cb 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -489,8 +489,16 @@ value_x_binop (struct value *arg1, struct value *arg2, enum exp_opcode op,
= TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
return value_zero (return_type, VALUE_LVAL (arg1));
}
- return call_function_by_hand (argvec[0], 2 - static_memfuncp,
- argvec + 1);
+
+ if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD)
+ {
+ /* Static xmethods are not supported yet. */
+ gdb_assert (static_memfuncp == 0);
+ return call_xmethod (argvec[0], 2, argvec + 1);
+ }
+ else
+ return call_function_by_hand (argvec[0], 2 - static_memfuncp,
+ argvec + 1);
}
throw_error (NOT_FOUND_ERROR,
_("member function %s not found"), tstr);
@@ -593,7 +601,14 @@ value_x_unop (struct value *arg1, enum exp_opcode op, enum noside noside)
= TYPE_TARGET_TYPE (check_typedef (value_type (argvec[0])));
return value_zero (return_type, VALUE_LVAL (arg1));
}
- return call_function_by_hand (argvec[0], nargs, argvec + 1);
+ if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_XMETHOD)
+ {
+ /* Static xmethods are not supported yet. */
+ gdb_assert (static_memfuncp == 0);
+ return call_xmethod (argvec[0], 1, argvec + 1);
+ }
+ else
+ return call_function_by_hand (argvec[0], nargs, argvec + 1);
}
throw_error (NOT_FOUND_ERROR,
_("member function %s not found"), tstr);