summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPaul Robinson <paul.robinson@sony.com>2017-11-22 15:48:30 +0000
committerPaul Robinson <paul.robinson@sony.com>2017-11-22 15:48:30 +0000
commit511b54cadcc9b87ce1541bd80a1be730f4d687e4 (patch)
tree7bc12378af62bf8f54a00ca10c3d1a4281bcf07b /llvm/lib
parentc492500e7efd3fbb0da2af0e0fac2d6141703cbd (diff)
downloadbcm5719-llvm-511b54cadcc9b87ce1541bd80a1be730f4d687e4.tar.gz
bcm5719-llvm-511b54cadcc9b87ce1541bd80a1be730f4d687e4.zip
[DebugInfo] Dump a .debug_line section, including line-number program,
without any compile units. Differential Revision: https://reviews.llvm.org/D40114 llvm-svn: 318842
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFContext.cpp5
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp18
2 files changed, 18 insertions, 5 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index e96678bc87c..cd7a81fe892 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -342,10 +342,9 @@ void DWARFContext::dump(
while (Offset < LineData.getData().size()) {
DWARFUnit *U = nullptr;
auto It = LineToUnit.find(Offset);
- if (It != LineToUnit.end()) {
+ if (It != LineToUnit.end())
U = It->second;
- LineData.setAddressSize(U->getAddressByteSize());
- }
+ LineData.setAddressSize(U ? U->getAddressByteSize() : 0);
DWARFDebugLine::LineTable LineTable;
if (DumpOffset && Offset != *DumpOffset) {
// Find the size of this part of the line table section and skip it.
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 554e073bf58..3e7f3c59c30 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -383,7 +383,7 @@ DWARFDebugLine::getLineTable(uint32_t Offset) const {
}
const DWARFDebugLine::LineTable *
-DWARFDebugLine::getOrParseLineTable(const DWARFDataExtractor &DebugLineData,
+DWARFDebugLine::getOrParseLineTable(DWARFDataExtractor &DebugLineData,
uint32_t Offset, const DWARFUnit *U) {
std::pair<LineTableIter, bool> Pos =
LineTableMap.insert(LineTableMapTy::value_type(Offset, LineTable()));
@@ -395,7 +395,7 @@ DWARFDebugLine::getOrParseLineTable(const DWARFDataExtractor &DebugLineData,
return LT;
}
-bool DWARFDebugLine::LineTable::parse(const DWARFDataExtractor &DebugLineData,
+bool DWARFDebugLine::LineTable::parse(DWARFDataExtractor &DebugLineData,
uint32_t *OffsetPtr, const DWARFUnit *U,
raw_ostream *OS) {
const uint32_t DebugLineOffset = *OffsetPtr;
@@ -414,6 +414,13 @@ bool DWARFDebugLine::LineTable::parse(const DWARFDataExtractor &DebugLineData,
const uint32_t EndOffset =
DebugLineOffset + Prologue.TotalLength + Prologue.sizeofTotalLength();
+ // See if we should tell the data extractor the address size.
+ if (DebugLineData.getAddressSize() == 0)
+ DebugLineData.setAddressSize(Prologue.getAddressSize());
+ else
+ assert(Prologue.getAddressSize() == 0 ||
+ Prologue.getAddressSize() == DebugLineData.getAddressSize());
+
ParsingState State(this);
while (*OffsetPtr < EndOffset) {
@@ -467,6 +474,13 @@ bool DWARFDebugLine::LineTable::parse(const DWARFDataExtractor &DebugLineData,
// relocatable address. All of the other statement program opcodes
// that affect the address register add a delta to it. This instruction
// stores a relocatable value into it instead.
+ //
+ // Make sure the extractor knows the address size. If not, infer it
+ // from the size of the operand.
+ if (DebugLineData.getAddressSize() == 0)
+ DebugLineData.setAddressSize(Len - 1);
+ else
+ assert(DebugLineData.getAddressSize() == Len - 1);
State.Row.Address = DebugLineData.getRelocatedAddress(OffsetPtr);
if (OS)
*OS << format(" (0x%16.16" PRIx64 ")", State.Row.Address);
OpenPOWER on IntegriCloud