[lld] r310867 - [PDB] Ignore all S_UDT symbols when writing PDBs.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 14 11:44:59 PDT 2017
Author: zturner
Date: Mon Aug 14 11:44:58 2017
New Revision: 310867
URL: http://llvm.org/viewvc/llvm-project?rev=310867&view=rev
Log:
[PDB] Ignore all S_UDT symbols when writing PDBs.
We don't have the right algorithm for copying S_UDT symbols
from object files to the globals stream, and having it wrong
is worse than not having it at all, since it breaks display
of local variables of UDT types (for example, "dv Foo" fails
in our current implementation, but succeeds if the S_UDT records
are omitted). Omit them until we fix the algorithm.
Modified:
lld/trunk/COFF/PDB.cpp
lld/trunk/test/COFF/pdb-globals.test
lld/trunk/test/COFF/pdb-symbol-types.yaml
lld/trunk/test/COFF/pdb-type-server-simple.test
Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=310867&r1=310866&r2=310867&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Mon Aug 14 11:44:58 2017
@@ -483,7 +483,6 @@ static bool symbolGoesInModuleStream(con
static bool symbolGoesInGlobalsStream(const CVSymbol &Sym) {
switch (Sym.kind()) {
case SymbolKind::S_CONSTANT:
- case SymbolKind::S_UDT:
case SymbolKind::S_GDATA32:
// S_LDATA32 goes in both the module stream and the globals stream.
case SymbolKind::S_LDATA32:
@@ -495,6 +494,13 @@ static bool symbolGoesInGlobalsStream(co
case SymbolKind::S_PROCREF:
case SymbolKind::S_LPROCREF:
return true;
+ // FIXME: For now, we drop all S_UDT symbols (i.e. they don't go in the
+ // globals stream or the modules stream). These have special handling which
+ // needs more investigation before we can get right, but by putting them all
+ // into the globals stream WinDbg fails to display local variables of class
+ // types saying that it cannot find the type Foo *. So as a stopgap just to
+ // keep things working, we drop them.
+ case SymbolKind::S_UDT:
default:
return false;
}
Modified: lld/trunk/test/COFF/pdb-globals.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-globals.test?rev=310867&r1=310866&r2=310867&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-globals.test (original)
+++ lld/trunk/test/COFF/pdb-globals.test Mon Aug 14 11:44:58 2017
@@ -15,22 +15,18 @@ RUN: llvm-pdbutil dump -symbols -globals
CHECK-LABEL: Global Symbols
CHECK-NEXT: ============================================================
CHECK-NEXT: Records
-CHECK-NEXT: 340 | S_UDT [size = 20] `HelloPoint`
-CHECK-NEXT: original type = 0x1007
CHECK-NEXT: 160 | S_PROCREF [size = 28] `GlobalFunc`
CHECK-NEXT: module = 1, sum name = 0, offset = 52
CHECK-NEXT: 188 | S_PROCREF [size = 20] `main`
CHECK-NEXT: module = 1, sum name = 0, offset = 108
CHECK-NEXT: 208 | S_LPROCREF [size = 24] `LocalFunc`
CHECK-NEXT: module = 1, sum name = 0, offset = 292
-CHECK-NEXT: 360 | S_PROCREF [size = 40] `HelloPoint::HelloPoint`
+CHECK-NEXT: 312 | S_PROCREF [size = 40] `HelloPoint::HelloPoint`
CHECK-NEXT: module = 1, sum name = 0, offset = 376
CHECK-NEXT: 232 | S_GDATA32 [size = 28] `__purecall`
CHECK-NEXT: type = 0x0403 (void*), addr = 0000:0000
CHECK-NEXT: 260 | S_GDATA32 [size = 24] `GlobalVar`
CHECK-NEXT: type = 0x100B (const int*), addr = 0001:0000
-CHECK-NEXT: 312 | S_UDT [size = 28] `HelloPointTypedef`
-CHECK-NEXT: original type = 0x1005
CHECK-NEXT: 284 | S_LDATA32 [size = 28] `ConstantVar`
CHECK-NEXT: type = 0x100A (const int), addr = 0002:0000
Modified: lld/trunk/test/COFF/pdb-symbol-types.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-symbol-types.yaml?rev=310867&r1=310866&r2=310867&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-symbol-types.yaml (original)
+++ lld/trunk/test/COFF/pdb-symbol-types.yaml Mon Aug 14 11:44:58 2017
@@ -18,10 +18,6 @@
# CHECK-NEXT: Records
# CHECK-NEXT: 48 | S_PROCREF [size = 20] `main`
# CHECK-NEXT: module = 1, sum name = 0, offset = 116
-# CHECK-NEXT: 96 | S_UDT [size = 16] `UDT_Foo`
-# CHECK-NEXT: original type = 0x1004
-# CHECK-NEXT: 112 | S_UDT [size = 12] `Foo`
-# CHECK-NEXT: original type = 0x1004
# CHECK-NEXT: 68 | S_GDATA32 [size = 28] `global_foo`
# CHECK-NEXT: type = 0x1004 (Foo), addr = 0001:0000
Modified: lld/trunk/test/COFF/pdb-type-server-simple.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-type-server-simple.test?rev=310867&r1=310866&r2=310867&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-type-server-simple.test (original)
+++ lld/trunk/test/COFF/pdb-type-server-simple.test Mon Aug 14 11:44:58 2017
@@ -64,12 +64,8 @@ CHECK: ===========================
CHECK-NEXT: Records
CHECK-NEXT: 36 | S_PROCREF [size = 20] `main`
CHECK-NEXT: module = 1, sum name = 0, offset = 104
-CHECK-NEXT: 68 | S_PROCREF [size = 16] `g`
+CHECK-NEXT: 56 | S_PROCREF [size = 16] `g`
CHECK-NEXT: module = 2, sum name = 0, offset = 104
-CHECK-NEXT: 56 | S_UDT [size = 12] `Foo`
-CHECK-NEXT: original type = 0x1006
-CHECK-NEXT: 84 | S_UDT [size = 12] `Foo`
-CHECK-NEXT: original type = 0x1006
CHECK-LABEL: Symbols
CHECK: ============================================================
More information about the llvm-commits
mailing list