Support new JDWP InterfaceType.InvokeMethod command
This command is used to invoke static methods in interfaces.
(cherry picked from commit 4a28e1e4e02aa44aa6fd20e22d50f9d73f6279cc)
Bug: 27218415
Change-Id: Ie4dc1876a20567240267f309dc18f1aec2c1b4c2
diff --git a/runtime/jdwp/jdwp_handler.cc b/runtime/jdwp/jdwp_handler.cc
index f1f4a03..6278ef0 100644
--- a/runtime/jdwp/jdwp_handler.cc
+++ b/runtime/jdwp/jdwp_handler.cc
@@ -690,6 +690,19 @@
}
/*
+ * Invoke a static method on an interface.
+ */
+static JdwpError IT_InvokeMethod(JdwpState* state, Request* request,
+ ExpandBuf* pReply ATTRIBUTE_UNUSED)
+ SHARED_REQUIRES(Locks::mutator_lock_) {
+ RefTypeId class_id = request->ReadRefTypeId();
+ ObjectId thread_id = request->ReadThreadId();
+ MethodId method_id = request->ReadMethodId();
+
+ return RequestInvoke(state, request, thread_id, 0, class_id, method_id, false);
+}
+
+/*
* Return line number information for the method, if present.
*/
static JdwpError M_LineTable(JdwpState*, Request* request, ExpandBuf* pReply)
@@ -1481,6 +1494,7 @@
{ 4, 1, AT_newInstance, "ArrayType.NewInstance" },
/* InterfaceType command set (5) */
+ { 5, 1, IT_InvokeMethod, "InterfaceType.InvokeMethod" },
/* Method command set (6) */
{ 6, 1, M_LineTable, "Method.LineTable" },
@@ -1579,6 +1593,8 @@
return command == kJDWPClassTypeInvokeMethodCmd || command == kJDWPClassTypeNewInstanceCmd;
} else if (command_set == kJDWPObjectReferenceCmdSet) {
return command == kJDWPObjectReferenceInvokeCmd;
+ } else if (command_set == kJDWPInterfaceTypeCmdSet) {
+ return command == kJDWPInterfaceTypeInvokeMethodCmd;
} else {
return false;
}
diff --git a/runtime/jdwp/jdwp_priv.h b/runtime/jdwp/jdwp_priv.h
index 29314f6..4e1bda8 100644
--- a/runtime/jdwp/jdwp_priv.h
+++ b/runtime/jdwp/jdwp_priv.h
@@ -45,6 +45,8 @@
static constexpr uint8_t kJDWPClassTypeCmdSet = 3U;
static constexpr uint8_t kJDWPClassTypeInvokeMethodCmd = 3U;
static constexpr uint8_t kJDWPClassTypeNewInstanceCmd = 4U;
+static constexpr uint8_t kJDWPInterfaceTypeCmdSet = 5U;
+static constexpr uint8_t kJDWPInterfaceTypeInvokeMethodCmd = 1U;
static constexpr uint8_t kJDWPObjectReferenceCmdSet = 9U;
static constexpr uint8_t kJDWPObjectReferenceInvokeCmd = 6U;