[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.

llvm-svn: 310867
This commit is contained in:
Zachary Turner 2017-08-14 18:44:58 +00:00
parent 451ef4adcd
commit 302dc8bccf
4 changed files with 9 additions and 15 deletions

View File

@ -483,7 +483,6 @@ static bool symbolGoesInModuleStream(const CVSymbol &Sym) {
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(const CVSymbol &Sym) {
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;
}

View File

@ -15,22 +15,18 @@ RUN: llvm-pdbutil dump -symbols -globals %t.pdb | FileCheck %s
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

View File

@ -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

View File

@ -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: ============================================================