llvm-project/llvm/lib/DebugInfo/PDB/Native
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
..
DbiModuleDescriptor.cpp [llvm-pdbutil] Dump first section contribution for each module. 2018-04-17 20:06:43 +00:00
DbiModuleDescriptorBuilder.cpp Add missing error checking code intended for r347687 2018-11-27 19:14:11 +00:00
DbiModuleList.cpp [CodeView, PDB] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-06-30 23:06:03 +00:00
DbiStream.cpp [PDB] Add the ability to lookup global symbols by name. 2018-10-08 04:19:16 +00:00
DbiStreamBuilder.cpp [PDB] Emit old fpo data to the PDB file. 2018-09-12 21:02:01 +00:00
EnumTables.cpp
GSIStreamBuilder.cpp [PDB] Emit S_UDT records in LLD. 2018-12-04 21:48:46 +00:00
GlobalsStream.cpp [PDB] Fix another bug in globals stream name lookup. 2018-10-09 21:19:03 +00:00
Hash.cpp [CodeView, PDB] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC). 2017-06-30 23:06:03 +00:00
HashTable.cpp [PDB] Fix a bug where we were serializing hash tables incorrectly. 2018-03-15 22:31:00 +00:00
InfoStream.cpp [llvm-pdbutil] Add the ability to explain binary files. 2018-04-04 17:29:09 +00:00
InfoStreamBuilder.cpp Give InfoStreamBuilder an opt-in method to write a hash of the PDB as GUID. 2018-09-15 18:35:51 +00:00
ModuleDebugStream.cpp Support skewed stream arrays. 2018-12-06 16:55:00 +00:00
NamedStreamMap.cpp [PDB] Make our PDBs look more like MS PDBs. 2018-03-23 18:43:39 +00:00
NativeCompilandSymbol.cpp [PDB] Better support for enumerating pointer types. 2018-09-18 16:35:05 +00:00
NativeEnumGlobals.cpp [PDB] Add support for dumping Typedef records. 2018-10-01 17:55:38 +00:00
NativeEnumModules.cpp [PDB] Remove all clone() methods. 2018-09-12 22:57:03 +00:00
NativeEnumTypes.cpp [NativePDB] Add support for reading function signatures. 2018-09-21 22:36:28 +00:00
NativeExeSymbol.cpp [PDB] Add support for dumping Typedef records. 2018-10-01 17:55:38 +00:00
NativeRawSymbol.cpp [PDB] Add native reading support for UDT / class types. 2018-09-21 22:36:04 +00:00
NativeSession.cpp Revert "Revert "[PDB] Extend IPDBSession's interface to retrieve frame data"" 2018-10-23 08:14:53 +00:00
NativeSymbolEnumerator.cpp [PDB] Better support for enumerating pointer types. 2018-09-18 16:35:05 +00:00
NativeTypeArray.cpp [PDB] Add native support for dumping array types. 2018-09-30 16:19:18 +00:00
NativeTypeBuiltin.cpp [NativePDB] Add support for reading function signatures. 2018-09-21 22:36:28 +00:00
NativeTypeEnum.cpp [PDB] Add native reading support for UDT / class types. 2018-09-21 22:36:04 +00:00
NativeTypeFunctionSig.cpp [PDB] Add support for parsing VFTable Shape records. 2018-10-01 17:55:16 +00:00
NativeTypePointer.cpp [PDB] Better native API support for pointers. 2018-09-29 23:28:19 +00:00
NativeTypeTypedef.cpp [PDB] Add support for dumping Typedef records. 2018-10-01 17:55:38 +00:00
NativeTypeUDT.cpp [PDB] Add native reading support for UDT / class types. 2018-09-21 22:36:04 +00:00
NativeTypeVTShape.cpp [PDB] Add support for parsing VFTable Shape records. 2018-10-01 17:55:16 +00:00
PDBFile.cpp [DebugInfo] Common behavior for error types 2018-08-31 17:41:58 +00:00
PDBFileBuilder.cpp Give InfoStreamBuilder an opt-in method to write a hash of the PDB as GUID. 2018-09-15 18:35:51 +00:00
PDBStringTable.cpp [PDB] Don't ignore bucket 0 when writing the PDB string table. 2018-03-21 22:23:59 +00:00
PDBStringTableBuilder.cpp [PDB] Resubmit "Support embedding natvis files in PDBs." 2018-03-23 19:57:25 +00:00
PublicsStream.cpp Remove redundant includes from lib/DebugInfo. 2017-12-13 21:30:49 +00:00
RawError.cpp [DebugInfo] Common behavior for error types 2018-08-31 17:41:58 +00:00
SymbolCache.cpp Don't build the Tpi Hash map by default. 2018-12-03 18:32:05 +00:00
SymbolStream.cpp Remove redundant includes from lib/DebugInfo. 2017-12-13 21:30:49 +00:00
TpiHashing.cpp [PDB] Add the ability to map forward references to full decls. 2018-09-20 15:50:13 +00:00
TpiStream.cpp Fix issue with Tpi Stream hash map. 2018-12-03 19:05:12 +00:00
TpiStreamBuilder.cpp Remove redundant includes from lib/DebugInfo. 2017-12-13 21:30:49 +00:00