From 2a7c1ef95c850abae915b3a59fbafa87e6833967 Mon Sep 17 00:00:00 2001 From: Yevgeny Rouban Date: Wed, 22 Jul 2015 18:36:24 +0600 Subject: Add more dwarf debug line info for Optimized methods. Optimizing compiler generates minimum debug line info that is built using the dex_pc information about suspend points. This is not enough for performance and debugging needs. This CL generates additional debug line information for instructions which have known dex_pc and it ensures that whole call sites are mapped (as opposed to suspend points which map only one instruction past the function call). Bug: 23157336 Change-Id: I9f2b1c2038e3560847c175b8121cf9496b8b58fa Signed-off-by: Yevgeny Rouban --- compiler/optimizing/code_generator.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'compiler/optimizing/code_generator.cc') diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc index 3f69270f17..a6fc4557f7 100644 --- a/compiler/optimizing/code_generator.cc +++ b/compiler/optimizing/code_generator.cc @@ -239,7 +239,10 @@ void CodeGenerator::CompileInternal(CodeAllocator* allocator, bool is_baseline) InitLocationsBaseline(current); } DCHECK(CheckTypeConsistency(current)); + uintptr_t native_pc_begin = GetAssembler()->CodeSize(); current->Accept(instruction_visitor); + uintptr_t native_pc_end = GetAssembler()->CodeSize(); + RecordNativeDebugInfo(current->GetDexPc(), native_pc_begin, native_pc_end); } } @@ -604,15 +607,6 @@ void CodeGenerator::BuildNativeGCMap( } } -void CodeGenerator::BuildSourceMap(DefaultSrcMap* src_map) const { - for (size_t i = 0, num = stack_map_stream_.GetNumberOfStackMaps(); i != num; ++i) { - const StackMapStream::StackMapEntry& stack_map_entry = stack_map_stream_.GetStackMap(i); - uint32_t pc2dex_offset = stack_map_entry.native_pc_offset; - int32_t pc2dex_dalvik_offset = stack_map_entry.dex_pc; - src_map->push_back(SrcMapElem({pc2dex_offset, pc2dex_dalvik_offset})); - } -} - void CodeGenerator::BuildMappingTable(ArenaVector* data) const { uint32_t pc2dex_data_size = 0u; uint32_t pc2dex_entries = stack_map_stream_.GetNumberOfStackMaps(); @@ -728,6 +722,15 @@ void CodeGenerator::BuildStackMaps(ArenaVector* data) { stack_map_stream_.FillIn(region); } +void CodeGenerator::RecordNativeDebugInfo(uint32_t dex_pc, + uintptr_t native_pc_begin, + uintptr_t native_pc_end) { + if (src_map_ != nullptr && dex_pc != kNoDexPc && native_pc_begin != native_pc_end) { + src_map_->push_back(SrcMapElem({static_cast(native_pc_begin), + static_cast(dex_pc)})); + } +} + void CodeGenerator::RecordPcInfo(HInstruction* instruction, uint32_t dex_pc, SlowPathCode* slow_path) { -- cgit v1.2.3-59-g8ed1b