Refactor MethodDebugInfo (input of DWARF writer).
Do not pass CompiledMethod pointer through since it is only available
during AOT compile but not during JIT compile or at runtime. Creating
mock CompiledMethod just pass data is proving increasingly tricky, so
copy the fields that we need to MethodDebugInfo instead.
Change-Id: I820297b41e769fcac488c0ff2d2ea0492bb13ed8
diff --git a/compiler/debug/elf_symtab_writer.h b/compiler/debug/elf_symtab_writer.h
index 41508f4..0a199da 100644
--- a/compiler/debug/elf_symtab_writer.h
+++ b/compiler/debug/elf_symtab_writer.h
@@ -47,12 +47,12 @@
return;
}
- // Find all addresses (low_pc) which contain deduped methods.
+ // Find all addresses which contain deduped methods.
// The first instance of method is not marked deduped_, but the rest is.
- std::unordered_set<uint32_t> deduped_addresses;
+ std::unordered_set<uint64_t> deduped_addresses;
for (const MethodDebugInfo& info : method_infos) {
if (info.deduped) {
- deduped_addresses.insert(info.low_pc);
+ deduped_addresses.insert(info.code_address);
}
}
@@ -65,33 +65,25 @@
continue; // Add symbol only for the first instance.
}
std::string name = PrettyMethod(info.dex_method_index, *info.dex_file, with_signature);
- if (deduped_addresses.find(info.low_pc) != deduped_addresses.end()) {
+ if (deduped_addresses.find(info.code_address) != deduped_addresses.end()) {
name += " [DEDUPED]";
}
// If we write method names without signature, we might see the same name multiple times.
size_t name_offset = (name == last_name ? last_name_offset : strtab->Write(name));
- const auto* text = builder->GetText()->Exists() ? builder->GetText() : nullptr;
- const bool is_relative = (text != nullptr);
- uint32_t low_pc = info.low_pc;
+ const auto* text = info.is_code_address_text_relative ? builder->GetText() : nullptr;
+ uint64_t address = info.code_address + (text != nullptr ? text->GetAddress() : 0);
// Add in code delta, e.g., thumb bit 0 for Thumb2 code.
- low_pc += info.compiled_method->CodeDelta();
- symtab->Add(name_offset,
- text,
- low_pc,
- is_relative,
- info.high_pc - info.low_pc,
- STB_GLOBAL,
- STT_FUNC);
+ address += CompiledMethod::CodeDelta(info.isa);
+ symtab->Add(name_offset, text, address, info.code_size, STB_GLOBAL, STT_FUNC);
// Conforming to aaelf, add $t mapping symbol to indicate start of a sequence of thumb2
// instructions, so that disassembler tools can correctly disassemble.
// Note that even if we generate just a single mapping symbol, ARM's Streamline
// requires it to match function symbol. Just address 0 does not work.
- if (info.compiled_method->GetInstructionSet() == kThumb2) {
+ if (info.isa == kThumb2) {
if (!generated_mapping_symbol || !kGenerateSingleArmMappingSymbol) {
- symtab->Add(strtab->Write("$t"), text, info.low_pc & ~1,
- is_relative, 0, STB_LOCAL, STT_NOTYPE);
+ symtab->Add(strtab->Write("$t"), text, address & ~1, 0, STB_LOCAL, STT_NOTYPE);
generated_mapping_symbol = true;
}
}