OSDN Git Service

ART: Fix JDWP GetClassLoader command
authorAndreas Gampe <agampe@google.com>
Wed, 30 Dec 2015 00:23:20 +0000 (16:23 -0800)
committerAndreas Gampe <agampe@google.com>
Wed, 30 Dec 2015 00:23:20 +0000 (16:23 -0800)
The command is spec-ed to take a type, and return the type's
classloader. The input is thus already a Class, not a generic Object.
Fix the implementation to not always return null.

Bug: 26349019
Change-Id: I4aa075902f4a112624edc644d3540a59eea057c8

runtime/debugger.cc

index e0211f5..f009fe6 100644 (file)
@@ -730,7 +730,8 @@ JDWP::JdwpError Dbg::GetClassLoader(JDWP::RefTypeId id, JDWP::ExpandBuf* pReply)
   if (o == nullptr) {
     return JDWP::ERR_INVALID_OBJECT;
   }
-  expandBufAddObjectId(pReply, gRegistry->Add(o->GetClass()->GetClassLoader()));
+  DCHECK(o->IsClass());
+  expandBufAddObjectId(pReply, gRegistry->Add(o->AsClass()->GetClassLoader()));
   return JDWP::ERR_NONE;
 }