diff options
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r-- | runtime/debugger.cc | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc index c85c2336b0..2be00f5f5b 100644 --- a/runtime/debugger.cc +++ b/runtime/debugger.cc @@ -278,11 +278,8 @@ class DebugInstrumentationListener FINAL : public instrumentation::Instrumentati } private: - static bool IsReturn(ArtMethod* method, uint32_t dex_pc) - REQUIRES_SHARED(Locks::mutator_lock_) { - const DexFile::CodeItem* code_item = method->GetCodeItem(); - const Instruction* instruction = Instruction::At(&code_item->insns_[dex_pc]); - return instruction->IsReturn(); + static bool IsReturn(ArtMethod* method, uint32_t dex_pc) REQUIRES_SHARED(Locks::mutator_lock_) { + return method->DexInstructions().InstructionAt(dex_pc).IsReturn(); } static bool IsListeningToDexPcMoved() REQUIRES_SHARED(Locks::mutator_lock_) { @@ -1535,15 +1532,15 @@ static uint32_t MangleAccessFlags(uint32_t accessFlags) { */ static uint16_t MangleSlot(uint16_t slot, ArtMethod* m) REQUIRES_SHARED(Locks::mutator_lock_) { - const DexFile::CodeItem* code_item = m->GetCodeItem(); - if (code_item == nullptr) { + CodeItemDataAccessor accessor(m); + if (!accessor.HasCodeItem()) { // We should not get here for a method without code (native, proxy or abstract). Log it and // return the slot as is since all registers are arguments. LOG(WARNING) << "Trying to mangle slot for method without code " << m->PrettyMethod(); return slot; } - uint16_t ins_size = code_item->ins_size_; - uint16_t locals_size = code_item->registers_size_ - ins_size; + uint16_t ins_size = accessor.InsSize(); + uint16_t locals_size = accessor.RegistersSize() - ins_size; if (slot >= locals_size) { return slot - locals_size; } else { @@ -1566,8 +1563,8 @@ static size_t GetMethodNumArgRegistersIncludingThis(ArtMethod* method) */ static uint16_t DemangleSlot(uint16_t slot, ArtMethod* m, JDWP::JdwpError* error) REQUIRES_SHARED(Locks::mutator_lock_) { - const DexFile::CodeItem* code_item = m->GetCodeItem(); - if (code_item == nullptr) { + CodeItemDataAccessor accessor(m); + if (!accessor.HasCodeItem()) { // We should not get here for a method without code (native, proxy or abstract). Log it and // return the slot as is since all registers are arguments. LOG(WARNING) << "Trying to demangle slot for method without code " @@ -1578,9 +1575,9 @@ static uint16_t DemangleSlot(uint16_t slot, ArtMethod* m, JDWP::JdwpError* error return slot; } } else { - if (slot < code_item->registers_size_) { - uint16_t ins_size = code_item->ins_size_; - uint16_t locals_size = code_item->registers_size_ - ins_size; + if (slot < accessor.RegistersSize()) { + uint16_t ins_size = accessor.InsSize(); + uint16_t locals_size = accessor.RegistersSize() - ins_size; *error = JDWP::ERR_NONE; return (slot < ins_size) ? slot + locals_size : slot - ins_size; } @@ -1793,9 +1790,9 @@ JDWP::JdwpError Dbg::GetBytecodes(JDWP::RefTypeId, JDWP::MethodId method_id, if (m == nullptr) { return JDWP::ERR_INVALID_METHODID; } - const DexFile::CodeItem* code_item = m->GetCodeItem(); - size_t byte_count = code_item->insns_size_in_code_units_ * 2; - const uint8_t* begin = reinterpret_cast<const uint8_t*>(code_item->insns_); + CodeItemDataAccessor accessor(m); + size_t byte_count = accessor.InsnsSizeInCodeUnits() * 2; + const uint8_t* begin = reinterpret_cast<const uint8_t*>(accessor.Insns()); const uint8_t* end = begin + byte_count; for (const uint8_t* p = begin; p != end; ++p) { bytecodes->push_back(*p); @@ -2978,9 +2975,8 @@ void Dbg::PostLocationEvent(ArtMethod* m, int dex_pc, mirror::Object* this_objec Handle<mirror::Throwable> pending_exception(hs.NewHandle(self->GetException())); self->ClearException(); if (kIsDebugBuild && pending_exception != nullptr) { - const DexFile::CodeItem* code_item = location.method->GetCodeItem(); - const Instruction* instr = Instruction::At(&code_item->insns_[location.dex_pc]); - CHECK_EQ(Instruction::MOVE_EXCEPTION, instr->Opcode()); + const Instruction& instr = location.method->DexInstructions().InstructionAt(location.dex_pc); + CHECK_EQ(Instruction::MOVE_EXCEPTION, instr.Opcode()); } gJdwpState->PostLocationEvent(&location, this_object, event_flags, return_value); |