summaryrefslogtreecommitdiff
path: root/gdb/extension-priv.h
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2015-04-29 13:24:21 -0700
committerDoug Evans <dje@google.com>2015-04-29 13:24:21 -0700
commit2ce1cdbf84ce883b992bc8ffec3d29b4da229b72 (patch)
tree4143b5da94595cdef5199d0ca8afd6ec14bc30e6 /gdb/extension-priv.h
parent99b2a2dd3cd91ee45aba56a90b52be943001e8f4 (diff)
PR python/18285
gdb/ChangeLog: PR python/18285 * NEWS: Document new gdb.XMethodWorker.get_result_type method. * eval.c (evaluate_subexp_standard) <OP_FUNCALL>: Handle EVAL_AVOID_SIDE_EFFECTS for xmethods. * extension-priv.h (struct extension_language_ops) <get_xmethod_result_type>: New member. * extension.c (get_xmethod_result_type): New function. * extension.h (get_xmethod_result_type): Declare. * python/py-xmethods.c (get_result_type_method_name): New static global. (py_get_result_type_method_name): Ditto. (gdbpy_get_xmethod_result_type): New function. (gdbpy_initialize_xmethods): Initialize py_get_result_type_method_name. * python/python-internal.h (gdbpy_get_xmethod_result_type): Declare. * python/python.c (python_extension_ops): Add gdbpy_get_xmethod_result_type. * python/lib/gdb/xmethod.py (XMethodWorker): Add get_result_type. * valarith.c (value_x_binop): Handle EVAL_AVOID_SIDE_EFFECTS for xmethods. (value_x_unop): Ditto. * value.c (result_type_of_xmethod): New function. * value.h (result_type_of_xmethod): Declare. gdb/testsuite/ChangeLog: * gdb.python/py-xmethods.exp: Add ptype tests. * gdb.python/py-xmethods.py (E_method_char_worker): Add get_result_type method. gdb/doc/ChangeLog: * python.texi (Xmethod API) <gdb.XMethodWorker.get_result_type>: Document. (Writing an Xmethod): Add get_result_type to example.
Diffstat (limited to 'gdb/extension-priv.h')
-rw-r--r--gdb/extension-priv.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/gdb/extension-priv.h b/gdb/extension-priv.h
index dd2600ebe8..d0242e28f2 100644
--- a/gdb/extension-priv.h
+++ b/gdb/extension-priv.h
@@ -265,7 +265,7 @@ struct extension_language_ops
/* xmethod support:
clone_xmethod_worker_data, free_xmethod_worker_data,
get_matching_xmethod_workers, get_xmethod_arg_types,
- invoke_xmethod.
+ get_xmethod_return_type, invoke_xmethod.
These methods are optional and may be NULL, but if one of them is
implemented then they all must be. */
@@ -298,6 +298,18 @@ struct extension_language_ops
int *nargs,
struct type ***arg_types);
+ /* Given a WORKER servicing a particular method, fetch the type of the
+ result of the method. OBJECT, ARGS, NARGS are the same as for
+ invoke_xmethod. The result type is stored in *RESULT_TYPE.
+ For backward compatibility with 7.9, which did not support getting the
+ result type, if the get_result_type operation is not provided by WORKER
+ then EXT_LANG_RC_OK is returned and NULL is returned in *RESULT_TYPE. */
+ enum ext_lang_rc (*get_xmethod_result_type)
+ (const struct extension_language_defn *extlang,
+ struct xmethod_worker *worker,
+ struct value *object, struct value **args, int nargs,
+ struct type **result_type);
+
/* Invoke the xmethod serviced by WORKER. The xmethod is invoked
on OBJECT with arguments in the array ARGS. NARGS is the length of
this array. Returns the value returned by the xmethod. */