2017-07-11 03:16:49 +08:00
|
|
|
This test verifies that we produce PDBs compatible with MSVC in various ways.
|
|
|
|
We check in a cl-generated object file, PDB, and original source which serve
|
|
|
|
as the "baseline" for us to measure against. Then we link the same object
|
|
|
|
file with LLD and compare the two PDBs. Since the baseline object file and
|
|
|
|
PDB are already checked in, we just run LLD on the object file.
|
|
|
|
|
[LLD COFF/PDB] Incrementally update the build id.
Previously, our algorithm to compute a build id involved hashing the
executable and storing that as the GUID in the CV Debug Record chunk,
and setting the age to 1.
This breaks down in one very obvious case: a user adds some newlines to
a file, rebuilds, but changes nothing else. This causes new line
information and new file checksums to get written to the PDB, meaning
that the debug info is different, but the generated code would be the
same, so we would write the same build over again with an age of 1.
Anyone using a symbol cache would have a problem now, because the
debugger would open the executable, look at the age and guid, find a
matching PDB in the symbol cache and then load it. It would never copy
the new PDB to the symbol cache.
This patch implements the canonical Windows algorithm for updating
a build id, which is to check the existing executable first, and
re-use an existing GUID while bumping the age if it already
exists.
Differential Revision: https://reviews.llvm.org/D36758
llvm-svn: 310961
2017-08-16 05:31:41 +08:00
|
|
|
RUN: rm -f %T/pdb-diff-lld.pdb %T/pdb-diff-lld.exe
|
|
|
|
RUN: lld-link /debug /pdb:%T/pdb-diff-lld.pdb /out:%T/pdb-diff-lld.exe /nodefaultlib \
|
|
|
|
RUN: /entry:main %S/Inputs/pdb-diff.obj
|
|
|
|
RUN: llvm-pdbutil diff -result -values=false -left-bin-root=%S -right-bin-root=D:/src/llvm-mono/lld/test/COFF/ \
|
|
|
|
RUN: %T/pdb-diff-lld.pdb %S/Inputs/pdb-diff-cl.pdb | FileCheck %s
|
2017-07-11 03:16:49 +08:00
|
|
|
|
|
|
|
CHECK: ----------------------
|
|
|
|
CHECK-NEXT: | MSF Super Block |
|
|
|
|
CHECK-NEXT: |----------------+---|
|
|
|
|
CHECK-NEXT: | File | |
|
|
|
|
CHECK-NEXT: |----------------+---|
|
|
|
|
CHECK-NEXT: | Block Size | I |
|
|
|
|
CHECK-NEXT: |----------------+---|
|
|
|
|
CHECK-NEXT: | Block Count |
|
|
|
|
CHECK-NEXT: |----------------+---|
|
|
|
|
CHECK-NEXT: | Unknown 1 | I |
|
|
|
|
CHECK-NEXT: |----------------+---|
|
|
|
|
CHECK-NEXT: | Directory Size |
|
|
|
|
CHECK-NEXT: |----------------+---|
|
|
|
|
CHECK-NEXT: ------------------------------------
|
|
|
|
CHECK-NEXT: | Stream Directory |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | File | |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
2017-08-01 03:36:08 +08:00
|
|
|
CHECK-NEXT: | Stream Count | I |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Old MSF Directory | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | PDB Stream | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | TPI Stream | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBI Stream | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | IPI Stream | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | New FPO Data | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Section Header Data | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Named Stream "/names" | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Named Stream "/LinkInfo" | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Module "Inputs\pdb-diff.obj" | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Module "* Linker *" | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | TPI Hash | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | IPI Hash | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
2017-07-11 06:40:20 +08:00
|
|
|
CHECK-NEXT: | Public Symbol Hash | {{[EI]}} |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |------------------------------+---|
|
2017-08-01 03:36:08 +08:00
|
|
|
CHECK-NEXT: | Global Symbol Hash | {{[EI]}} |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |------------------------------+---|
|
2017-08-21 22:53:25 +08:00
|
|
|
CHECK-NEXT: | Symbol Records | {{[EI]}} |
|
2017-08-09 12:23:25 +08:00
|
|
|
CHECK-NEXT: |------------------------------+---|
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: ------------------------------------
|
|
|
|
CHECK-NEXT: | String Table |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | File | |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Number of Strings | D |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Hash Version | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Byte Size |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Signature | I |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | Empty Strings |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | {{.*}}pdb-diff.cpp | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | $T0 $ebp = $...p $T0 8 + = | D |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: | d:\src\llvm-...er internal) | D |
|
|
|
|
CHECK-NEXT: |------------------------------+---|
|
|
|
|
CHECK-NEXT: ----------------------------
|
|
|
|
CHECK-NEXT: | PDB Stream |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | File | |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Stream Size |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Age | I |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Guid | D |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Signature | D |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Version | I |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Features (set) | I |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Feature | I |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Named Stream Size |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | Named Streams (map) | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | /names | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: | /LinkInfo | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------+---|
|
|
|
|
CHECK-NEXT: ----------------------------------------------
|
|
|
|
CHECK-NEXT: | DBI Stream |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | File | |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Dbi Version | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Age | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Machine | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Flags | D |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Build Major | D |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Build Minor | D |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Build Number | D |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | PDB DLL Version | D |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | PDB DLL RBLD | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (FPO) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (Exception) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (Fixup) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (OmapToSrc) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (OmapFromSrc) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (SectionHdr) | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (TokenRidMap) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (Xdata) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (Pdata) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (NewFPO) | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | DBG (SectionHdrOrig) | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
2017-08-01 03:36:08 +08:00
|
|
|
CHECK-NEXT: | Globals Stream | {{[EI]}} |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
2017-07-11 06:40:20 +08:00
|
|
|
CHECK-NEXT: | Publics Stream | {{[EI]}} |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
2017-07-11 06:40:20 +08:00
|
|
|
CHECK-NEXT: | Symbol Records | {{[EI]}} |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Has CTypes | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Is Incrementally Linked | D |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Is Stripped | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Module Count | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Source File Count | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Module "Inputs\pdb-diff.obj" |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Modi | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Obj File Name | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Debug Stream | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - C11 Byte Size | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - C13 Byte Size | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - # of files | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Pdb File Path Index | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Source File Name Index | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
2017-08-01 03:36:08 +08:00
|
|
|
CHECK-NEXT: | - Symbol Byte Size |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | Module "* Linker *" |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Modi | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Obj File Name | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Debug Stream | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - C11 Byte Size | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - C13 Byte Size | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - # of files | I |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Pdb File Path Index | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
CHECK-NEXT: | - Source File Name Index | {{[EI]}} |
|
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
2017-07-13 02:10:02 +08:00
|
|
|
CHECK-NEXT: | - Symbol Byte Size |
|
2017-07-11 03:16:49 +08:00
|
|
|
CHECK-NEXT: |----------------------------------------+---|
|
|
|
|
|
|
|
|
|