mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
Add support for DebugFission to DWARF parser
Summary: 1) Make llvm-symbolizer properly symbolize files with split debug info (by using stanalone .dwo files). 2) Make DWARFCompileUnit parse and store corresponding .dwo file, if necessary. 3) Make bits of DWARF parsing more CompileUnit-oriented. Reviewers: echristo Reviewed By: echristo CC: bkramer, llvm-commits Differential Revision: http://llvm-reviews.chandlerc.com/D1164 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189329 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -222,29 +222,30 @@ DWARFDebugInfoEntryMinimal::getAttributeValue(const DWARFCompileUnit *cu,
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char*
|
||||
DWARFDebugInfoEntryMinimal::getAttributeValueAsString(
|
||||
const DWARFCompileUnit* cu,
|
||||
const uint16_t attr,
|
||||
const char* fail_value)
|
||||
const {
|
||||
DWARFFormValue form_value;
|
||||
if (getAttributeValue(cu, attr, form_value)) {
|
||||
DataExtractor stringExtractor(cu->getStringSection(), false, 0);
|
||||
return form_value.getAsCString(&stringExtractor);
|
||||
}
|
||||
return fail_value;
|
||||
const char *DWARFDebugInfoEntryMinimal::getAttributeValueAsString(
|
||||
const DWARFCompileUnit *CU, const uint16_t Attr,
|
||||
const char *FailValue) const {
|
||||
DWARFFormValue FormValue;
|
||||
if (getAttributeValue(CU, Attr, FormValue))
|
||||
return FormValue.getAsCString(CU);
|
||||
return FailValue;
|
||||
}
|
||||
|
||||
uint64_t
|
||||
DWARFDebugInfoEntryMinimal::getAttributeValueAsUnsigned(
|
||||
const DWARFCompileUnit* cu,
|
||||
const uint16_t attr,
|
||||
uint64_t fail_value) const {
|
||||
DWARFFormValue form_value;
|
||||
if (getAttributeValue(cu, attr, form_value))
|
||||
return form_value.getUnsigned();
|
||||
return fail_value;
|
||||
uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsAddress(
|
||||
const DWARFCompileUnit *CU, const uint16_t Attr, uint64_t FailValue) const {
|
||||
DWARFFormValue FormValue;
|
||||
if (getAttributeValue(CU, Attr, FormValue))
|
||||
return FormValue.getAsAddress(CU);
|
||||
return FailValue;
|
||||
}
|
||||
|
||||
uint64_t DWARFDebugInfoEntryMinimal::getAttributeValueAsUnsigned(
|
||||
const DWARFCompileUnit *CU, const uint16_t Attr, uint64_t FailValue) const {
|
||||
DWARFFormValue FormValue;
|
||||
if (getAttributeValue(CU, Attr, FormValue)) {
|
||||
return FormValue.getUnsigned();
|
||||
}
|
||||
return FailValue;
|
||||
}
|
||||
|
||||
int64_t
|
||||
@@ -274,29 +275,29 @@ bool DWARFDebugInfoEntryMinimal::getLowAndHighPC(const DWARFCompileUnit *CU,
|
||||
uint64_t &LowPC,
|
||||
uint64_t &HighPC) const {
|
||||
HighPC = -1ULL;
|
||||
LowPC = getAttributeValueAsUnsigned(CU, DW_AT_low_pc, -1ULL);
|
||||
LowPC = getAttributeValueAsAddress(CU, DW_AT_low_pc, -1ULL);
|
||||
if (LowPC != -1ULL)
|
||||
HighPC = getAttributeValueAsUnsigned(CU, DW_AT_high_pc, -1ULL);
|
||||
HighPC = getAttributeValueAsAddress(CU, DW_AT_high_pc, -1ULL);
|
||||
return (HighPC != -1ULL);
|
||||
}
|
||||
|
||||
void
|
||||
DWARFDebugInfoEntryMinimal::buildAddressRangeTable(const DWARFCompileUnit *CU,
|
||||
DWARFDebugAranges *DebugAranges)
|
||||
DWARFDebugAranges *DebugAranges,
|
||||
uint32_t CUOffsetInAranges)
|
||||
const {
|
||||
if (AbbrevDecl) {
|
||||
if (isSubprogramDIE()) {
|
||||
uint64_t LowPC, HighPC;
|
||||
if (getLowAndHighPC(CU, LowPC, HighPC)) {
|
||||
DebugAranges->appendRange(CU->getOffset(), LowPC, HighPC);
|
||||
}
|
||||
if (getLowAndHighPC(CU, LowPC, HighPC))
|
||||
DebugAranges->appendRange(CUOffsetInAranges, LowPC, HighPC);
|
||||
// FIXME: try to append ranges from .debug_ranges section.
|
||||
}
|
||||
|
||||
const DWARFDebugInfoEntryMinimal *child = getFirstChild();
|
||||
while (child) {
|
||||
child->buildAddressRangeTable(CU, DebugAranges);
|
||||
child = child->getSibling();
|
||||
const DWARFDebugInfoEntryMinimal *Child = getFirstChild();
|
||||
while (Child) {
|
||||
Child->buildAddressRangeTable(CU, DebugAranges, CUOffsetInAranges);
|
||||
Child = Child->getSibling();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user