mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Fix a few small issues in llvm-pdbutil
Running "llvm-pdbutil dump -all" on linux (using the native PDB reader), over a few PDBs pulled from the Microsoft public symbol store uncovered a few small issues: - stripped PDBs might not have the strings stream (/names) - stripped PDBs might not have the "module info" stream Differential Revision: https://reviews.llvm.org/D54006 llvm-svn: 346010
This commit is contained in:
parent
14c7a87da5
commit
f728f0d1e8
BIN
test/tools/llvm-pdbdump/Inputs/Stripped.pdb
Normal file
BIN
test/tools/llvm-pdbdump/Inputs/Stripped.pdb
Normal file
Binary file not shown.
@ -1,3 +1,4 @@
|
||||
; REQUIRES: diasdk
|
||||
; RUN: llvm-pdbutil pretty -lines %p/Inputs/PrettyFuncDumperTest.pdb > %t
|
||||
|
||||
; CHECK: ---COMPILANDS---
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -all -class-recurse-depth=1 \
|
||||
; RUN: %p/Inputs/ClassLayoutTest.pdb > %t
|
||||
; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBALS_TEST
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -classes -class-definitions=layout \
|
||||
; RUN: -include-types=Test %p/Inputs/ComplexPaddingTest.pdb > %t
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -types %p/Inputs/ClassLayoutTest.pdb > %t
|
||||
; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBAL_ENUM
|
||||
; RUN: FileCheck -input-file=%t %s -check-prefix=MEMBER_ENUM
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil explain \
|
||||
; RUN: -offset=0xF000 \
|
||||
; RUN: -offset=0xF004 \
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil explain \
|
||||
; RUN: -offset=0x11000 \
|
||||
; RUN: -offset=0x11004 \
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil explain -offset=0 %p/Inputs/InjectedSource.pdb \
|
||||
; RUN: | FileCheck --check-prefix=ZERO %s
|
||||
; RUN: llvm-pdbutil explain -offset=40 %p/Inputs/InjectedSource.pdb \
|
||||
|
@ -1,6 +1,8 @@
|
||||
; The PDB committed to the repo does not seem to be recognized by older
|
||||
; versions of DIA SDK, so we xfail the test temporarily until we can
|
||||
; figure out how to get a PDB that makes all versions of MSVC happy.
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -injected-sources -injected-source-content \
|
||||
; RUN: %p/Inputs/InjectedSource.pdb | FileCheck %s
|
||||
; RUN: llvm-pdbutil pretty -injected-sources -injected-source-content \
|
||||
|
@ -1 +1,2 @@
|
||||
config.unsupported = not config.have_dia_sdk
|
||||
if config.have_dia_sdk:
|
||||
config.available_features.add("diasdk")
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -externals %p/Inputs/LoadAddressTest.pdb \
|
||||
; RUN: | FileCheck --check-prefix=RVA %s
|
||||
; RUN: llvm-pdbutil pretty -externals -load-address=0x40000000 \
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -all -class-recurse-depth=1 \
|
||||
; RUN: %p/Inputs/PrettyFuncDumperTest.pdb > %t
|
||||
; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBALS_FUNC
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -module-syms -globals -types %p/Inputs/FilterTest.pdb \
|
||||
; RUN: | FileCheck --check-prefix=NO_FILTER %s
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -classes -class-definitions=layout \
|
||||
; RUN: -include-types=SimplePad %p/Inputs/SimplePaddingTest.pdb > %t
|
||||
|
||||
|
109
test/tools/llvm-pdbdump/stripped.test
Normal file
109
test/tools/llvm-pdbdump/stripped.test
Normal file
@ -0,0 +1,109 @@
|
||||
; RUN: llvm-pdbutil dump -all %p/Inputs/Stripped.pdb > %t
|
||||
; RUN: FileCheck -input-file=%t %s
|
||||
|
||||
; CHECK: Summary
|
||||
; CHECK-NEXT: ============================================================
|
||||
; CHECK-NEXT: Block Size: 4096
|
||||
; CHECK-NEXT: Number of blocks: 17
|
||||
; CHECK-NEXT: Number of streams: 12
|
||||
; CHECK-NEXT: Signature: 1541179274
|
||||
; CHECK-NEXT: Age: 2
|
||||
; CHECK-NEXT: GUID: {FF4F9B62-D99A-4647-97A7-22C702B1E053}
|
||||
; CHECK-NEXT: Features: 0x1
|
||||
; CHECK-NEXT: Has Debug Info: true
|
||||
; CHECK-NEXT: Has Types: true
|
||||
; CHECK-NEXT: Has IDs: true
|
||||
; CHECK-NEXT: Has Globals: true
|
||||
; CHECK-NEXT: Has Publics: true
|
||||
; CHECK-NEXT: Is incrementally linked: false
|
||||
; CHECK-NEXT: Has conflicting types: false
|
||||
; CHECK-NEXT: Is stripped: true
|
||||
|
||||
; CHECK: Streams
|
||||
; CHECK-NEXT: ============================================================
|
||||
; CHECK-NEXT: Stream 0 ( 88 bytes): [Old MSF Directory]
|
||||
; CHECK-NEXT: Blocks: [4]
|
||||
; CHECK-NEXT: Stream 1 ( 78 bytes): [PDB Stream]
|
||||
; CHECK-NEXT: Blocks: [14]
|
||||
; CHECK-NEXT: Stream 2 ( 56 bytes): [TPI Stream]
|
||||
; CHECK-NEXT: Blocks: [13]
|
||||
; CHECK-NEXT: Stream 3 (1355 bytes): [DBI Stream]
|
||||
; CHECK-NEXT: Blocks: [7]
|
||||
; CHECK-NEXT: Stream 4 ( 56 bytes): [IPI Stream]
|
||||
; CHECK-NEXT: Blocks: [6]
|
||||
; CHECK-NEXT: Stream 5 ( 0 bytes): [Named Stream "/LinkInfo"]
|
||||
; CHECK-NEXT: Blocks: []
|
||||
; CHECK-NEXT: Stream 6 ( 200 bytes): [Section Header Data]
|
||||
; CHECK-NEXT: Blocks: [8]
|
||||
; CHECK-NEXT: Stream 7 ( 16 bytes): [Global Symbol Hash]
|
||||
; CHECK-NEXT: Blocks: [9]
|
||||
; CHECK-NEXT: Stream 8 ( 928 bytes): [Public Symbol Hash]
|
||||
; CHECK-NEXT: Blocks: [11]
|
||||
; CHECK-NEXT: Stream 9 ( 716 bytes): [Symbol Records]
|
||||
; CHECK-NEXT: Blocks: [10]
|
||||
; CHECK-NEXT: Stream 10 ( 0 bytes): [TPI Hash]
|
||||
; CHECK-NEXT: Blocks: []
|
||||
; CHECK-NEXT: Stream 11 ( 0 bytes): [IPI Hash]
|
||||
; CHECK-NEXT: Blocks: []
|
||||
|
||||
; CHECK: Module Stats
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: S_UDT Record Stats
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: String Table
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Modules
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Files
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Lines
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Inlinee Lines
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Cross Module Imports
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Cross Module Exports
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Old FPO Data
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: New FPO Data
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Types (TPI Stream)
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Types (IPI Stream)
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Global Symbols
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Public Symbols
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Symbols
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Section Headers
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Original Section Headers
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Section Contributions
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
; CHECK: Section Map
|
||||
; CHECK-NEXT: ============================================================
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -globals -module-syms -sym-types=data %p/Inputs/FilterTest.pdb \
|
||||
; RUN: | FileCheck --check-prefix=ONLY_DATA %s
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -all -class-recurse-depth=1 \
|
||||
; RUN: %p/Inputs/TypeQualifiersTest.pdb > %t
|
||||
; RUN: FileCheck -input-file=%t %s -check-prefix=GLOBALS_FUNC
|
||||
|
@ -1,3 +1,5 @@
|
||||
; REQUIRES: diasdk
|
||||
|
||||
; RUN: llvm-pdbutil pretty -module-syms %p/Inputs/UsingNamespaceTest.pdb > %t
|
||||
; RUN: FileCheck -input-file=%t %s
|
||||
|
||||
|
@ -250,7 +250,7 @@ Error DumpOutputStyle::dumpFileSummary() {
|
||||
static StatCollection getSymbolStats(const SymbolGroup &SG,
|
||||
StatCollection &CumulativeStats) {
|
||||
StatCollection Stats;
|
||||
if (SG.getFile().isPdb()) {
|
||||
if (SG.getFile().isPdb() && SG.hasDebugStream()) {
|
||||
// For PDB files, all symbols are packed into one stream.
|
||||
for (const auto &S : SG.getPdbModuleStream().symbols(nullptr)) {
|
||||
Stats.update(S.kind(), S.length());
|
||||
@ -1420,6 +1420,7 @@ Error DumpOutputStyle::dumpTpiStream(uint32_t StreamIdx) {
|
||||
P.formatLine("TI: {0}, Offset: {1}", IO.Type, fmtle(IO.Offset));
|
||||
}
|
||||
|
||||
if (getPdb().hasPDBStringTable()) {
|
||||
P.NewLine();
|
||||
P.formatLine("Hash Adjusters:");
|
||||
auto &Adjusters = Stream.getHashAdjusters();
|
||||
@ -1436,6 +1437,7 @@ Error DumpOutputStyle::dumpTpiStream(uint32_t StreamIdx) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return Error::success();
|
||||
}
|
||||
|
||||
|
@ -116,10 +116,6 @@ static std::string formatChecksumKind(FileChecksumKind Kind) {
|
||||
return formatUnknownEnum(Kind);
|
||||
}
|
||||
|
||||
static const DebugStringTableSubsectionRef &extractStringTable(PDBFile &File) {
|
||||
return cantFail(File.getStringTable()).getStringTable();
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
static void formatInternal(LinePrinter &Printer, bool Append, Args &&... args) {
|
||||
if (Append)
|
||||
@ -168,8 +164,13 @@ void SymbolGroup::initializeForPdb(uint32_t Modi) {
|
||||
|
||||
// PDB always uses the same string table, but each module has its own
|
||||
// checksums. So we only set the strings if they're not already set.
|
||||
if (!SC.hasStrings())
|
||||
SC.setStrings(extractStringTable(File->pdb()));
|
||||
if (!SC.hasStrings()) {
|
||||
auto StringTable = File->pdb().getStringTable();
|
||||
if (StringTable)
|
||||
SC.setStrings(StringTable->getStringTable());
|
||||
else
|
||||
consumeError(StringTable.takeError());
|
||||
}
|
||||
|
||||
SC.resetChecksums();
|
||||
auto MDS = getModuleDebugStream(File->pdb(), Name, Modi);
|
||||
|
@ -110,6 +110,8 @@ public:
|
||||
const InputFile &getFile() const { return *File; }
|
||||
InputFile &getFile() { return *File; }
|
||||
|
||||
bool hasDebugStream() const { return DebugStream != nullptr; }
|
||||
|
||||
private:
|
||||
void initializeForPdb(uint32_t Modi);
|
||||
void updatePdbModi(uint32_t Modi);
|
||||
|
Loading…
Reference in New Issue
Block a user