diff options
author | David Srbecky <dsrbecky@google.com> | 2016-03-14 17:14:24 +0000 |
---|---|---|
committer | David Srbecky <dsrbecky@google.com> | 2016-03-17 16:58:55 +0000 |
commit | d28f4a00933a4a3b8d5e9db73b8532924d0f989d (patch) | |
tree | 1205844a68ee9e2c502f8ecbfd2d5cf96acd4190 /compiler/optimizing/code_generator.cc | |
parent | fbc61e19578d281d05728bcd120e1ace57c2fbd8 (diff) |
Generate native debug stackmaps before calls as well.
The debugger looks up PC of the call instruction, so the runtime's
stackmap is not sufficient since it is at PC after the instruction.
Change-Id: I0dd06c0b52e8079ea5d064ea10beb12c93584092
Diffstat (limited to 'compiler/optimizing/code_generator.cc')
-rw-r--r-- | compiler/optimizing/code_generator.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index af50363e31..f1bd1b7573 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -196,7 +196,7 @@ void CodeGenerator::GenerateSlowPaths() { code_start = GetAssembler()->CodeSize(); } // Record the dex pc at start of slow path (required for java line number mapping). - MaybeRecordNativeDebugInfo(nullptr /* instruction */, slow_path->GetDexPc()); + MaybeRecordNativeDebugInfo(slow_path->GetInstruction(), slow_path->GetDexPc(), slow_path); slow_path->EmitNativeCode(this); if (disasm_info_ != nullptr) { disasm_info_->AddSlowPathInterval(slow_path, code_start, GetAssembler()->CodeSize()); @@ -234,6 +234,12 @@ void CodeGenerator::Compile(CodeAllocator* allocator) { MaybeRecordNativeDebugInfo(nullptr /* instruction */, block->GetDexPc()); for (HInstructionIterator it(block->GetInstructions()); !it.Done(); it.Advance()) { HInstruction* current = it.Current(); + if (current->HasEnvironment()) { + // Create stackmap for HNativeDebugInfo or any instruction which calls native code. + // Note that we need correct mapping for the native PC of the call instruction, + // so the runtime's stackmap is not sufficient since it is at PC after the call. + MaybeRecordNativeDebugInfo(current, block->GetDexPc()); + } DisassemblyScope disassembly_scope(current, *this); DCHECK(CheckTypeConsistency(current)); current->Accept(instruction_visitor); @@ -823,13 +829,15 @@ bool CodeGenerator::HasStackMapAtCurrentPc() { return count > 0 && stack_map_stream_.GetStackMap(count - 1).native_pc_offset == pc; } -void CodeGenerator::MaybeRecordNativeDebugInfo(HInstruction* instruction, uint32_t dex_pc) { +void CodeGenerator::MaybeRecordNativeDebugInfo(HInstruction* instruction, + uint32_t dex_pc, + SlowPathCode* slow_path) { if (GetCompilerOptions().GetNativeDebuggable() && dex_pc != kNoDexPc) { if (HasStackMapAtCurrentPc()) { // Ensure that we do not collide with the stack map of the previous instruction. GenerateNop(); } - RecordPcInfo(instruction, dex_pc); + RecordPcInfo(instruction, dex_pc, slow_path); } } |