Add JDWP ReferenceType.ClassObject handler.

For bug 2157236.
diff --git a/vm/Debugger.c b/vm/Debugger.c
index 3119350..86adbb6 100644
--- a/vm/Debugger.c
+++ b/vm/Debugger.c
@@ -512,6 +512,15 @@
 }
 
 /*
+ * Convert a RefTypeId to an ObjectId.
+ */
+ObjectId dvmDbgGetClassObject(RefTypeId id)
+{
+    ClassObject* clazz = refTypeIdToClassObject(id);
+    return objectToObjectId((Object*) clazz);
+}
+
+/*
  * Return the superclass of a class (will be NULL for java/lang/Object).
  */
 RefTypeId dvmDbgGetSuperclass(RefTypeId id)
diff --git a/vm/Debugger.h b/vm/Debugger.h
index b41318c..189e2be 100644
--- a/vm/Debugger.h
+++ b/vm/Debugger.h
@@ -159,6 +159,7 @@
  * Class, Object, Array
  */
 const char* dvmDbgGetClassDescriptor(RefTypeId id);
+ObjectId dvmDbgGetClassObject(RefTypeId id);
 RefTypeId dvmDbgGetSuperclass(RefTypeId id);
 ObjectId dvmDbgGetClassLoader(RefTypeId id);
 u4 dvmDbgGetAccessFlags(RefTypeId id);
diff --git a/vm/jdwp/JdwpHandler.c b/vm/jdwp/JdwpHandler.c
index 16d9a5d..1163fde 100644
--- a/vm/jdwp/JdwpHandler.c
+++ b/vm/jdwp/JdwpHandler.c
@@ -665,8 +665,6 @@
     const u1* buf, int dataLen, ExpandBuf* pReply)
 {
     RefTypeId refTypeId;
-    u4 numInterfaces;
-    int i;
 
     refTypeId = dvmReadRefTypeId(&buf);
 
@@ -679,6 +677,25 @@
 }
 
 /*
+ * Return the class object corresponding to this type.
+ */
+static JdwpError handleRT_ClassObject(JdwpState* state,
+    const u1* buf, int dataLen, ExpandBuf* pReply)
+{
+    RefTypeId refTypeId;
+    ObjectId classObjId;
+
+    refTypeId = dvmReadRefTypeId(&buf);
+    classObjId = dvmDbgGetClassObject(refTypeId);
+
+    LOGV("  RefTypeId %llx -> ObjectId %llx\n", refTypeId, classObjId);
+
+    expandBufAddObjectId(pReply, classObjId);
+
+    return ERR_NONE;
+}
+
+/*
  * Returns the value of the SourceDebugExtension attribute.
  *
  * JDB seems interested, but DEX files don't currently support this.
@@ -1980,7 +1997,7 @@
     //2,    8,  NestedTypes
     { 2,    9,  handleRT_Status,        "ReferenceType.Status" },
     { 2,    10, handleRT_Interfaces,    "ReferenceType.Interfaces" },
-    //2,    11, ClassObject
+    { 2,    11, handleRT_ClassObject,   "ReferenceType.ClassObject" },
     { 2,    12, handleRT_SourceDebugExtension,
                                         "ReferenceType.SourceDebugExtension" },
     { 2,    13, handleRT_SignatureWithGeneric,