[llvm] r316398 - [codeview] Add support for inlinee lists
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 16:43:40 PDT 2017
Author: rnk
Date: Mon Oct 23 16:43:40 2017
New Revision: 316398
URL: http://llvm.org/viewvc/llvm-project?rev=316398&view=rev
Log:
[codeview] Add support for inlinee lists
This adds type index discovery and dumper support for symbol record kind
0x1168, which is a list of inlined function ids. This symbol kind is
undocumented, but S_INLINEES is consistent with the existing
nomenclature.
Fixes PR34222
Added:
llvm/trunk/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj (with props)
llvm/trunk/test/tools/llvm-readobj/codeview-inlinees.test
Modified:
llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def?rev=316398&r1=316397&r2=316398&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def Mon Oct 23 16:43:40 2017
@@ -184,7 +184,8 @@ CV_SYMBOL(S_LDATA_HLSL32 , 0x1163)
CV_SYMBOL(S_GDATA_HLSL32_EX, 0x1164)
CV_SYMBOL(S_LDATA_HLSL32_EX, 0x1165)
-CV_SYMBOL(S_FASTLINK, 0x1167)
+CV_SYMBOL(S_FASTLINK, 0x1167) // Undocumented
+SYMBOL_RECORD_ALIAS(S_INLINEES, 0x1168, InlineesSym, CallerSym) // Undocumented
// Known symbol types
SYMBOL_RECORD(S_END , 0x0006, ScopeEndSym)
@@ -234,7 +235,7 @@ SYMBOL_RECORD(S_HEAPALLOCSITE , 0x115e,
SYMBOL_RECORD(S_FRAMECOOKIE , 0x113a, FrameCookieSym)
SYMBOL_RECORD(S_CALLEES , 0x115a, CallerSym)
-SYMBOL_RECORD_ALIAS(S_CALLERS , 0x115b, CalleeSym, CallerSym)
+SYMBOL_RECORD_ALIAS(S_CALLERS, 0x115b, CalleeSym, CallerSym)
SYMBOL_RECORD(S_UDT , 0x1108, UDTSym)
SYMBOL_RECORD_ALIAS(S_COBOLUDT , 0x1109, CobolUDT, UDTSym)
Modified: llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp?rev=316398&r1=316397&r2=316398&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp (original)
+++ llvm/trunk/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp Mon Oct 23 16:43:40 2017
@@ -404,6 +404,7 @@ static bool discoverTypeIndices(ArrayRef
break;
case SymbolKind::S_CALLERS:
case SymbolKind::S_CALLEES:
+ case SymbolKind::S_INLINEES:
// The record is a count followed by an array of type indices.
Count = *reinterpret_cast<const ulittle32_t *>(Content.data());
Refs.push_back({TiRefKind::IndexRef, 4, Count}); // Callees
Added: llvm/trunk/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj?rev=316398&view=auto
==============================================================================
Binary file - no diff available.
Propchange: llvm/trunk/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: llvm/trunk/test/tools/llvm-readobj/codeview-inlinees.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-readobj/codeview-inlinees.test?rev=316398&view=auto
==============================================================================
--- llvm/trunk/test/tools/llvm-readobj/codeview-inlinees.test (added)
+++ llvm/trunk/test/tools/llvm-readobj/codeview-inlinees.test Mon Oct 23 16:43:40 2017
@@ -0,0 +1,38 @@
+Compile the following like so to reproduce the input:
+$ cl -c -O2 t.c -Z7
+void g();
+static inline void f() { g(); }
+static inline void h() { g(); }
+void k() {
+ f();
+ h();
+}
+
+RUN: llvm-readobj -codeview %p/Inputs/codeview-inlinees.obj | FileCheck %s
+
+CHECK: SubSectionType: InlineeLines (0xF6)
+CHECK: Inlinee: f (0x1003)
+CHECK: Inlinee: h (0x1004)
+CHECK-NOT: Inlinee:
+
+CHECK: GlobalProcIdSym {
+CHECK: Kind: S_GPROC32_ID (0x1147)
+CHECK: DisplayName: k
+CHECK: LinkageName: k
+CHECK: }
+CHECK: InlineSiteSym
+CHECK: Kind: S_INLINESITE (0x114D)
+CHECK: Inlinee: h (0x1004)
+CHECK: InlineSiteSym
+CHECK: Kind: S_INLINESITE (0x114D)
+CHECK: Inlinee: f (0x1003)
+CHECK: InlineesSym {
+CHECK-NEXT: Kind: S_INLINEES (0x1168)
+CHECK-NEXT: Callers [
+CHECK-NEXT: FuncID: f (0x1003)
+CHECK-NEXT: FuncID: h (0x1004)
+CHECK-NEXT: ]
+CHECK: }
+CHECK: ProcEnd {
+CHECK: Kind: S_PROC_ID_END (0x114F)
+CHECK: }
Modified: llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp?rev=316398&r1=316397&r2=316398&view=diff
==============================================================================
--- llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp (original)
+++ llvm/trunk/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp Mon Oct 23 16:43:40 2017
@@ -560,7 +560,12 @@ TEST_F(TypeIndexIteratorTest, CallerSym)
Callers.Indices.push_back(TypeIndex(4));
Callers.Indices.push_back(TypeIndex(5));
Callers.Indices.push_back(TypeIndex(6));
- writeSymbolRecords(Callees, Callers);
+ CallerSym Inlinees(SymbolRecordKind::InlineesSym);
+ Inlinees.Indices.push_back(TypeIndex(7));
+ Inlinees.Indices.push_back(TypeIndex(8));
+ Inlinees.Indices.push_back(TypeIndex(9));
+ writeSymbolRecords(Callees, Callers, Inlinees);
checkTypeReferences(0, TypeIndex(1), TypeIndex(2), TypeIndex(3));
checkTypeReferences(1, TypeIndex(4), TypeIndex(5), TypeIndex(6));
+ checkTypeReferences(2, TypeIndex(7), TypeIndex(8), TypeIndex(9));
}
More information about the llvm-commits
mailing list