Fixes to interpreter and debugger for JDWP.
- Fixed off-by-one error for MethodEndCodeIndex.
- Changed first instance of dex_pc 0 in interpreter Execute to output
METHOD_ENTRY event.
Change-Id: I4854cb7cbde0db53db23d8b1c5bb9f08bf8409f1
diff --git a/src/debugger.cc b/src/debugger.cc
index 12ea5e2..a75cd8c 100644
--- a/src/debugger.cc
+++ b/src/debugger.cc
@@ -1118,8 +1118,8 @@
end = -1;
} else {
start = 0;
- // TODO: what are the units supposed to be? *2?
- end = mh.GetCodeItem()->insns_size_in_code_units_;
+ // Return the index of the last instruction
+ end = mh.GetCodeItem()->insns_size_in_code_units_ - 1;
}
expandBufAdd8BE(pReply, start);
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index fd101fe..f89d648 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -545,11 +545,16 @@
ShadowFrame& shadow_frame) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_) {
const uint16_t* insns = code_item->insns_;
const Instruction* inst = Instruction::At(insns + shadow_frame.GetDexPC());
+ bool entry = (inst->GetDexPc(insns) == 0);
JValue result_register;
while (true) {
CheckSuspend(self);
uint32_t dex_pc = inst->GetDexPc(insns);
shadow_frame.SetDexPC(dex_pc);
+ if (entry) {
+ Dbg::UpdateDebugger(-1, self);
+ }
+ entry = false;
Dbg::UpdateDebugger(dex_pc, self);
DecodedInstruction dec_insn(inst);
const bool kTracing = false;