diff options
author | Sebastien Hertz <shertz@google.com> | 2014-03-28 16:29:41 +0100 |
---|---|---|
committer | Sebastien Hertz <shertz@google.com> | 2014-03-31 11:14:40 +0200 |
commit | 4d8fd49509fdcf203107fb33c62d8f451b6eb1d0 (patch) | |
tree | cfb6cd9417159ba197b2f7dae0c9cc03a8eb7c94 /runtime | |
parent | a708e32a9f764a48175e705ec4bcd2201c84f492 (diff) | |
download | art-4d8fd49509fdcf203107fb33c62d8f451b6eb1d0.zip art-4d8fd49509fdcf203107fb33c62d8f451b6eb1d0.tar.gz art-4d8fd49509fdcf203107fb33c62d8f451b6eb1d0.tar.bz2 |
Return correct JDWP type tag for array class
Uses GetTypeTag function to get JDWP type tag for a class. This fixes the
returned type tag in ClassObjectReference.ReflectedType command.
Bug: 13689172
Change-Id: Ibb9006eb604d84cfb8e279eaeed1982a136d6510
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/debugger.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 9af9c7a..26170de 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -968,6 +968,18 @@ void Dbg::DisposeObject(JDWP::ObjectId object_id, uint32_t reference_count) gRegistry->DisposeObject(object_id, reference_count); } +static JDWP::JdwpTypeTag GetTypeTag(mirror::Class* klass) + SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { + DCHECK(klass != nullptr); + if (klass->IsArrayClass()) { + return JDWP::TT_ARRAY; + } else if (klass->IsInterface()) { + return JDWP::TT_INTERFACE; + } else { + return JDWP::TT_CLASS; + } +} + JDWP::JdwpError Dbg::GetReflectedType(JDWP::RefTypeId class_id, JDWP::ExpandBuf* pReply) { JDWP::JdwpError status; mirror::Class* c = DecodeClass(class_id, status); @@ -975,7 +987,8 @@ JDWP::JdwpError Dbg::GetReflectedType(JDWP::RefTypeId class_id, JDWP::ExpandBuf* return status; } - expandBufAdd1(pReply, c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS); + JDWP::JdwpTypeTag type_tag = GetTypeTag(c); + expandBufAdd1(pReply, type_tag); expandBufAddRefTypeId(pReply, class_id); return JDWP::ERR_NONE; } @@ -1049,14 +1062,7 @@ JDWP::JdwpError Dbg::GetReferenceType(JDWP::ObjectId object_id, JDWP::ExpandBuf* return JDWP::ERR_INVALID_OBJECT; } - JDWP::JdwpTypeTag type_tag; - if (o->GetClass()->IsArrayClass()) { - type_tag = JDWP::TT_ARRAY; - } else if (o->GetClass()->IsInterface()) { - type_tag = JDWP::TT_INTERFACE; - } else { - type_tag = JDWP::TT_CLASS; - } + JDWP::JdwpTypeTag type_tag = GetTypeTag(o->GetClass()); JDWP::RefTypeId type_id = gRegistry->AddRefType(o->GetClass()); expandBufAdd1(pReply, type_tag); @@ -1309,7 +1315,7 @@ static void SetLocation(JDWP::JdwpLocation& location, mirror::ArtMethod* m, uint memset(&location, 0, sizeof(location)); } else { mirror::Class* c = m->GetDeclaringClass(); - location.type_tag = c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS; + location.type_tag = GetTypeTag(c); location.class_id = gRegistry->AddRefType(c); location.method_id = ToMethodId(m); location.dex_pc = (m->IsNative() || m->IsProxyMethod()) ? static_cast<uint64_t>(-1) : dex_pc; @@ -2481,7 +2487,7 @@ void Dbg::PostClassPrepare(mirror::Class* c) { // debuggers seem to like that. There might be some advantage to honesty, // since the class may not yet be verified. int state = JDWP::CS_VERIFIED | JDWP::CS_PREPARED; - JDWP::JdwpTypeTag tag = c->IsInterface() ? JDWP::TT_INTERFACE : JDWP::TT_CLASS; + JDWP::JdwpTypeTag tag = GetTypeTag(c); gJdwpState->PostClassPrepare(tag, gRegistry->Add(c), ClassHelper(c).GetDescriptor(), state); } |