diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-08-27 09:20:22 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-08-27 09:20:22 +0000 |
commit | 63fd2af3892a81026f40374d08b5124e72ccff4e (patch) | |
tree | 8587e5f891d29f8cf006b2d3e39adebe47fa7a7b /lib/DebugInfo/DWARFDebugInfoEntry.cpp | |
parent | 1567abe74f519e542786bdb82664f68b10afda0b (diff) | |
download | external_llvm-63fd2af3892a81026f40374d08b5124e72ccff4e.zip external_llvm-63fd2af3892a81026f40374d08b5124e72ccff4e.tar.gz external_llvm-63fd2af3892a81026f40374d08b5124e72ccff4e.tar.bz2 |
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
Diffstat (limited to 'lib/DebugInfo/DWARFDebugInfoEntry.cpp')
-rw-r--r-- | lib/DebugInfo/DWARFDebugInfoEntry.cpp | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/lib/DebugInfo/DWARFDebugInfoEntry.cpp b/lib/DebugInfo/DWARFDebugInfoEntry.cpp index 9abf8dd..775e68f 100644 --- a/lib/DebugInfo/DWARFDebugInfoEntry.cpp +++ b/lib/DebugInfo/DWARFDebugInfoEntry.cpp @@ -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(); } } } |