summaryrefslogtreecommitdiffstats
path: root/compiler/debug/elf_debug_line_writer.h
diff options
context:
space:
mode:
authorMathieu Chartier <mathieuc@google.com>2018-09-11 12:35:30 -0700
committerMathieu Chartier <mathieuc@google.com>2018-09-12 11:32:40 -0700
commit3e2e123239952c80e1b37431bf2efbbe07a41940 (patch)
tree153be0dafdbce55b5e5432cb10025b802a637402 /compiler/debug/elf_debug_line_writer.h
parent68851b53e4152d3edaea977573af8bdc0bd23313 (diff)
downloadart-3e2e123239952c80e1b37431bf2efbbe07a41940.tar.gz
art-3e2e123239952c80e1b37431bf2efbbe07a41940.tar.bz2
art-3e2e123239952c80e1b37431bf2efbbe07a41940.zip
Refactor debug info position visiting
Move logic to CodeItemDebugInfoAccessor, makes it easier to modify the debug info format. Test: test-art-host Bug: 112311591 Bug: 77709234 Change-Id: Ice56a88951efa54dc07d88f2c228c01be4670e73
Diffstat (limited to 'compiler/debug/elf_debug_line_writer.h')
-rw-r--r--compiler/debug/elf_debug_line_writer.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/compiler/debug/elf_debug_line_writer.h b/compiler/debug/elf_debug_line_writer.h
index 3d78943cd0..0a13a92d07 100644
--- a/compiler/debug/elf_debug_line_writer.h
+++ b/compiler/debug/elf_debug_line_writer.h
@@ -34,11 +34,6 @@ namespace debug {
typedef std::vector<DexFile::PositionInfo> PositionInfos;
-static bool PositionInfoCallback(void* ctx, const DexFile::PositionInfo& entry) {
- static_cast<PositionInfos*>(ctx)->push_back(entry);
- return false;
-}
-
template<typename ElfTypes>
class ElfDebugLineWriter {
using Elf_Addr = typename ElfTypes::Addr;
@@ -154,11 +149,14 @@ class ElfDebugLineWriter {
Elf_Addr method_address = base_address + mi->code_address;
PositionInfos dex2line_map;
- DCHECK(mi->dex_file != nullptr);
const DexFile* dex = mi->dex_file;
+ DCHECK(dex != nullptr);
CodeItemDebugInfoAccessor accessor(*dex, mi->code_item, mi->dex_method_index);
- const uint32_t debug_info_offset = accessor.DebugInfoOffset();
- if (!dex->DecodeDebugPositionInfo(debug_info_offset, PositionInfoCallback, &dex2line_map)) {
+ if (!accessor.DecodeDebugPositionInfo(
+ [&](const DexFile::PositionInfo& entry) {
+ dex2line_map.push_back(entry);
+ return false;
+ })) {
continue;
}