+/* Return the TYPE_CODE_XMETHOD value corresponding to WORKER. */
+
+struct value *
+value_of_xmethod (struct xmethod_worker *worker)
+{
+ if (worker->value == NULL)
+ {
+ struct value *v;
+
+ v = allocate_value (builtin_type (target_gdbarch ())->xmethod);
+ v->lval = lval_xcallable;
+ v->location.xm_worker = worker;
+ v->modifiable = 0;
+ worker->value = v;
+ }
+
+ return worker->value;
+}
+
+/* Call the xmethod corresponding to the TYPE_CODE_XMETHOD value METHOD. */
+
+struct value *
+call_xmethod (struct value *method, int argc, struct value **argv)
+{
+ gdb_assert (TYPE_CODE (value_type (method)) == TYPE_CODE_XMETHOD
+ && method->lval == lval_xcallable && argc > 0);
+
+ return invoke_xmethod (method->location.xm_worker,
+ argv[0], argv + 1, argc - 1);
+}
+\f