]> granicus.if.org Git - llvm/commitdiff
[DebugInfo] Fix register variables not showing up in pdb.
authorZachary Turner <zturner@google.com>
Thu, 7 Dec 2017 22:51:16 +0000 (22:51 +0000)
committerZachary Turner <zturner@google.com>
Thu, 7 Dec 2017 22:51:16 +0000 (22:51 +0000)
Previously, when linking against libcmt from the MSVC runtime,
lld-link /verbose would show "Ignoring unknown symbol record
with kind 0x1006".  It turns out this was because
TypeIndexDiscovery did not handle S_REGISTER records, so these
records were not getting properly remapped.

Patch by: Alexnadre Ganea
Differential Revision: https://reviews.llvm.org/D40919

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@320108 91177308-0d34-0410-b5e6-96231b3b80d8

lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp

index c23fadc230482853507215d576a798a2ae9d2d16..d283e9e6d2f1759b5c75d8d46e7c105717e698fb 100644 (file)
@@ -392,6 +392,9 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind,
   case SymbolKind::S_LOCAL:
     Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
     break;
+  case SymbolKind::S_REGISTER:
+    Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type;
+    break;
   case SymbolKind::S_CONSTANT:
     Refs.push_back({TiRefKind::TypeRef, 0, 1}); // Type
     break;
index 7ceefe5d22c390acca39d83bcc0ea625c0d8d537..0948c493ed48a913c2d659b19d8c2ab56ce408e8 100644 (file)
@@ -537,9 +537,9 @@ TEST_F(TypeIndexIteratorTest, ManyMembers) {
 
 TEST_F(TypeIndexIteratorTest, ProcSym) {
   ProcSym GS(SymbolRecordKind::GlobalProcSym);
-  GS.FunctionType = TypeIndex(0x40);
+  GS.FunctionType = TypeIndex::Float32();
   ProcSym LS(SymbolRecordKind::ProcSym);
-  LS.FunctionType = TypeIndex(0x41);
+  LS.FunctionType = TypeIndex::Float64();
   writeSymbolRecords(GS, LS);
   checkTypeReferences(0, GS.FunctionType);
   checkTypeReferences(1, LS.FunctionType);
@@ -547,11 +547,20 @@ TEST_F(TypeIndexIteratorTest, ProcSym) {
 
 TEST_F(TypeIndexIteratorTest, DataSym) {
   DataSym DS(SymbolRecordKind::GlobalData);
-  DS.Type = TypeIndex(0x40);
+  DS.Type = TypeIndex::Float32();
   writeSymbolRecords(DS);
   checkTypeReferences(0, DS.Type);
 }
 
+TEST_F(TypeIndexIteratorTest, RegisterSym) {
+  RegisterSym Reg(SymbolRecordKind::RegisterSym);
+  Reg.Index = TypeIndex::UInt32();
+  Reg.Register = RegisterId::EAX;
+  Reg.Name = "Target";
+  writeSymbolRecords(Reg);
+  checkTypeReferences(0, Reg.Index);
+}
+
 TEST_F(TypeIndexIteratorTest, CallerSym) {
   CallerSym Callees(SymbolRecordKind::CalleeSym);
   Callees.Indices.push_back(TypeIndex(1));