diff options
Diffstat (limited to 'llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp')
-rw-r--r-- | llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp index 8ba6b2eec09..795a26d91a5 100644 --- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp @@ -607,19 +607,28 @@ Error DWARFDebugLine::LineTable::parse( //
// Make sure the extractor knows the address size. If not, infer it
// from the size of the operand.
- if (DebugLineData.getAddressSize() == 0)
+ {
+ uint8_t ExtractorAddressSize = DebugLineData.getAddressSize();
+ if (ExtractorAddressSize != Len - 1 && ExtractorAddressSize != 0)
+ RecoverableErrorCallback(createStringError(
+ errc::invalid_argument,
+ "mismatching address size at offset 0x%8.8" PRIx64
+ " expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64,
+ ExtOffset, ExtractorAddressSize, Len - 1));
+
+ // Assume that the line table is correct and temporarily override the
+ // address size.
DebugLineData.setAddressSize(Len - 1);
- else if (DebugLineData.getAddressSize() != Len - 1) {
- return createStringError(errc::invalid_argument,
- "mismatching address size at offset 0x%8.8" PRIx64
- " expected 0x%2.2" PRIx8 " found 0x%2.2" PRIx64,
- ExtOffset, DebugLineData.getAddressSize(),
- Len - 1);
+ State.Row.Address.Address = DebugLineData.getRelocatedAddress(
+ OffsetPtr, &State.Row.Address.SectionIndex);
+
+ // Restore the address size if the extractor already had it.
+ if (ExtractorAddressSize != 0)
+ DebugLineData.setAddressSize(ExtractorAddressSize);
+
+ if (OS)
+ *OS << format(" (0x%16.16" PRIx64 ")", State.Row.Address.Address);
}
- State.Row.Address.Address = DebugLineData.getRelocatedAddress(
- OffsetPtr, &State.Row.Address.SectionIndex);
- if (OS)
- *OS << format(" (0x%16.16" PRIx64 ")", State.Row.Address.Address);
break;
case DW_LNE_define_file:
|