mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-19 03:24:09 +00:00
Add support for fetching inlining context (stack of source code locations)
by instruction address from DWARF. Add --inlining flag to llvm-dwarfdump to demonstrate and test this functionality, so that "llvm-dwarfdump --inlining --address=0x..." now works much like "addr2line -i 0x...", provided that the binary has debug info (Clang's -gline-tables-only *is* enough). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163128 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -75,6 +75,15 @@ DWARFCompileUnit::extract(uint32_t offset, DataExtractor debug_info_data,
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool DWARFCompileUnit::extractRangeList(uint32_t RangeListOffset,
|
||||
DWARFDebugRangeList &RangeList) const {
|
||||
// Require that compile unit is extracted.
|
||||
assert(DieArray.size() > 0);
|
||||
DataExtractor RangesData(Context.getRangeSection(),
|
||||
Context.isLittleEndian(), AddrSize);
|
||||
return RangeList.extract(RangesData, &RangeListOffset);
|
||||
}
|
||||
|
||||
void DWARFCompileUnit::clear() {
|
||||
Offset = 0;
|
||||
Length = 0;
|
||||
@ -246,12 +255,21 @@ DWARFCompileUnit::buildAddressRangeTable(DWARFDebugAranges *debug_aranges,
|
||||
clearDIEs(true);
|
||||
}
|
||||
|
||||
const DWARFDebugInfoEntryMinimal*
|
||||
DWARFCompileUnit::getFunctionDIEForAddress(int64_t address) {
|
||||
DWARFDebugInfoEntryMinimal::InlinedChain
|
||||
DWARFCompileUnit::getInlinedChainForAddress(uint64_t Address) {
|
||||
// First, find a subprogram that contains the given address (the root
|
||||
// of inlined chain).
|
||||
extractDIEsIfNeeded(false);
|
||||
const DWARFDebugInfoEntryMinimal *SubprogramDIE = 0;
|
||||
for (size_t i = 0, n = DieArray.size(); i != n; i++) {
|
||||
if (DieArray[i].addressRangeContainsAddress(this, address))
|
||||
return &DieArray[i];
|
||||
if (DieArray[i].isSubprogramDIE() &&
|
||||
DieArray[i].addressRangeContainsAddress(this, Address)) {
|
||||
SubprogramDIE = &DieArray[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
// Get inlined chain rooted at this subprogram DIE.
|
||||
if (!SubprogramDIE)
|
||||
return DWARFDebugInfoEntryMinimal::InlinedChain();
|
||||
return SubprogramDIE->getInlinedChainForAddress(this, Address);
|
||||
}
|
||||
|
Reference in New Issue
Block a user