summaryrefslogtreecommitdiffstats
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2014-04-01 09:07:49 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2014-04-01 09:07:50 +0000
commit6c90df9d49b29bddc1e3d27ff2698ae1df89d517 (patch)
tree1a16923b1d323dc1a6ff2d115a0a4a9029c48a4a /runtime/debugger.cc
parente18b027344e521e1b374d967948c7dd55cc02c8a (diff)
parent4d8fd49509fdcf203107fb33c62d8f451b6eb1d0 (diff)
downloadart-6c90df9d49b29bddc1e3d27ff2698ae1df89d517.tar.gz
art-6c90df9d49b29bddc1e3d27ff2698ae1df89d517.tar.bz2
art-6c90df9d49b29bddc1e3d27ff2698ae1df89d517.zip
Merge "Return correct JDWP type tag for array class"
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc28
1 files changed, 17 insertions, 11 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 20e720b950..024f83028f 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);
}