OSDN Git Service

Support new JDWP InterfaceType.InvokeMethod command
authorAlex Light <allight@google.com>
Thu, 25 Feb 2016 00:35:59 +0000 (16:35 -0800)
committerAlex Light <allight@google.com>
Thu, 25 Feb 2016 17:41:30 +0000 (09:41 -0800)
This command is used to invoke static methods in interfaces.

Bug: 27218415

Change-Id: Ie4dc1876a20567240267f309dc18f1aec2c1b4c2

runtime/jdwp/jdwp_handler.cc
runtime/jdwp/jdwp_priv.h

index f1f4a03..6278ef0 100644 (file)
@@ -690,6 +690,19 @@ static JdwpError AT_newInstance(JdwpState*, Request* request, ExpandBuf* pReply)
 }
 
 /*
+ * 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 @@ static const JdwpHandlerMap gHandlers[] = {
   { 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 @@ static bool IsInvokeCommand(uint8_t command_set, uint8_t command) {
     return command == kJDWPClassTypeInvokeMethodCmd || command == kJDWPClassTypeNewInstanceCmd;
   } else if (command_set == kJDWPObjectReferenceCmdSet) {
     return command == kJDWPObjectReferenceInvokeCmd;
+  } else if (command_set == kJDWPInterfaceTypeCmdSet) {
+    return command == kJDWPInterfaceTypeInvokeMethodCmd;
   } else {
     return false;
   }
index 29314f6..4e1bda8 100644 (file)
@@ -45,6 +45,8 @@ static constexpr size_t kMagicHandshakeLen = sizeof(kMagicHandshake) - 1;
 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;