diff options
| -rw-r--r-- | runtime/debugger.cc | 7 | ||||
| -rw-r--r-- | runtime/mirror/throwable.cc | 15 | ||||
| -rw-r--r-- | runtime/thread.cc | 2 |
3 files changed, 17 insertions, 7 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index 7999559aaf..24615e2a66 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -1467,7 +1467,7 @@ std::string Dbg::GetMethodName(JDWP::MethodId method_id) { if (m == nullptr) { return "null"; } - return m->GetName(); + return m->GetInterfaceMethodIfProxy(sizeof(void*))->GetName(); } std::string Dbg::GetFieldName(JDWP::FieldId field_id) { @@ -1590,8 +1590,9 @@ JDWP::JdwpError Dbg::OutputDeclaredMethods(JDWP::RefTypeId class_id, bool with_g ArtMethod* m = i < direct_method_count ? c->GetDirectMethod(i, ptr_size) : c->GetVirtualMethod(i - direct_method_count, ptr_size); expandBufAddMethodId(pReply, ToMethodId(m)); - expandBufAddUtf8String(pReply, m->GetName()); - expandBufAddUtf8String(pReply, m->GetSignature().ToString()); + expandBufAddUtf8String(pReply, m->GetInterfaceMethodIfProxy(sizeof(void*))->GetName()); + expandBufAddUtf8String(pReply, + m->GetInterfaceMethodIfProxy(sizeof(void*))->GetSignature().ToString()); if (with_generic) { const char* generic_signature = ""; expandBufAddUtf8String(pReply, generic_signature); diff --git a/runtime/mirror/throwable.cc b/runtime/mirror/throwable.cc index 224d266a15..1c21edbc42 100644 --- a/runtime/mirror/throwable.cc +++ b/runtime/mirror/throwable.cc @@ -71,9 +71,18 @@ bool Throwable::IsCheckedException() { int32_t Throwable::GetStackDepth() { Object* stack_state = GetStackState(); - if (stack_state == nullptr || !stack_state->IsObjectArray()) return -1; - ObjectArray<Object>* method_trace = down_cast<ObjectArray<Object>*>(stack_state); - return method_trace->GetLength() - 1; + if (stack_state == nullptr) { + return -1; + } + if (!stack_state->IsIntArray() && !stack_state->IsLongArray()) { + return -1; + } + mirror::PointerArray* method_trace = down_cast<mirror::PointerArray*>(stack_state->AsArray()); + int32_t array_len = method_trace->GetLength(); + // The format is [method pointers][pcs] so the depth is half the length (see method + // BuildInternalStackTraceVisitor::Init). + CHECK_EQ(array_len % 2, 0); + return array_len / 2; } std::string Throwable::Dump() { diff --git a/runtime/thread.cc b/runtime/thread.cc index 89e34674d5..65999f77b5 100644 --- a/runtime/thread.cc +++ b/runtime/thread.cc @@ -1583,7 +1583,7 @@ class BuildInternalStackTraceVisitor : public StackVisitor { bool Init(int depth) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) { - // Allocate method trace with an extra slot that will hold the PC trace + // Allocate method trace with format [method pointers][pcs]. auto* cl = Runtime::Current()->GetClassLinker(); trace_ = cl->AllocPointerArray(self_, depth * 2); if (trace_ == nullptr) { |