teak-llvm/llvm/lib/DebugInfo/CodeView
Zachary Turner 579264bd59 Support skewed stream arrays.
VarStreamArray was built on the assumption that it is backed by a
StreamRef, and offset 0 of that StreamRef is the first byte of the first
record in the array.

This is a logical and intuitive assumption, but unfortunately we have
use cases where it doesn't hold. Specifically, a PDB module's symbol
stream is prefixed by 4 bytes containing a magic value, and the first
byte of record data in the array is actually at offset 4 of this byte
sequence.

Previously, we would just truncate the first 4 bytes and then construct
the VarStreamArray with the resulting StreamRef, so that offset 0 of the
underlying stream did correspond to the first byte of the first record,
but this is problematic, because symbol records reference other symbol
records by the absolute offset including that initial magic 4 bytes. So
if another record wants to refer to the first record in the array, it
would say "the record at offset 4".

This led to extremely confusing hacks and semantics in loading code, and
after spending 30 minutes trying to get some math right and failing, I
decided to fix this in the underlying implementation of VarStreamArray.
Now, we can say that a stream is skewed by a particular amount. This
way, when we access a record by absolute offset, we can use the same
values that the records themselves contain, instead of having to do
fixups.

Differential Revision: https://reviews.llvm.org/D55344

llvm-svn: 348499
2018-12-06 16:55:00 +00:00
..
AppendingTypeTableBuilder.cpp
CMakeLists.txt
CodeViewError.cpp [COFF][LLD] Add link support for Microsoft precompiled headers OBJs 2018-11-05 19:20:47 +00:00
CodeViewRecordIO.cpp
ContinuationRecordBuilder.cpp
CVSymbolVisitor.cpp Support skewed stream arrays. 2018-12-06 16:55:00 +00:00
CVTypeVisitor.cpp
DebugChecksumsSubsection.cpp
DebugCrossExSubsection.cpp
DebugCrossImpSubsection.cpp
DebugFrameDataSubsection.cpp
DebugInlineeLinesSubsection.cpp
DebugLinesSubsection.cpp
DebugStringTableSubsection.cpp
DebugSubsection.cpp
DebugSubsectionRecord.cpp
DebugSubsectionVisitor.cpp
DebugSymbolRVASubsection.cpp
DebugSymbolsSubsection.cpp
EnumTables.cpp
Formatters.cpp
GlobalTypeTableBuilder.cpp
LazyRandomTypeCollection.cpp [NativePDB] Improved support for nested type reconstruction. 2018-11-13 20:07:32 +00:00
Line.cpp
LLVMBuild.txt
MergingTypeTableBuilder.cpp
RecordName.cpp
RecordSerialization.cpp
SimpleTypeSerializer.cpp
StringsAndChecksums.cpp
SymbolDumper.cpp Fix a compilation failure on non-MSVC compilers. 2018-10-08 04:34:41 +00:00
SymbolRecordMapping.cpp [codeview] Add breaks to fix -Wimplicit-fallthrough 2018-11-01 19:36:29 +00:00
SymbolSerializer.cpp
TypeDumpVisitor.cpp [CodeView] Add support for ref-qualified member functions. 2018-11-20 22:13:43 +00:00
TypeHashing.cpp
TypeIndex.cpp [CodeView] Emit the correct TypeIndex for std::nullptr_t. 2018-11-01 04:02:41 +00:00
TypeIndexDiscovery.cpp
TypeRecordHelpers.cpp
TypeRecordMapping.cpp
TypeStreamMerger.cpp [COFF][LLD] Add link support for Microsoft precompiled headers OBJs 2018-11-05 19:20:47 +00:00
TypeTableCollection.cpp