[llvm] r320108 - [DebugInfo] Fix register variables not showing up in pdb.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 14:51:16 PST 2017
Author: zturner
Date: Thu Dec 7 14:51:16 2017
New Revision: 320108
URL: http://llvm.org/viewvc/llvm-project?rev=320108&view=rev
Log:
[DebugInfo] Fix register variables not showing up in pdb.
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
Modified:
llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp?rev=320108&r1=320107&r2=320108&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp Thu Dec 7 14:51:16 2017
@@ -392,6 +392,9 @@ static bool discoverTypeIndices(ArrayRef
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;
Modified: llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp?rev=320108&r1=320107&r2=320108&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp Thu Dec 7 14:51:16 2017
@@ -537,9 +537,9 @@ TEST_F(TypeIndexIteratorTest, ManyMember
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));
More information about the llvm-commits
mailing list