diff options
-rw-r--r-- | llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def | 5 | ||||
-rw-r--r-- | llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp | 1 | ||||
-rw-r--r-- | llvm/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj | bin | 0 -> 2793 bytes | |||
-rw-r--r-- | llvm/test/tools/llvm-readobj/codeview-inlinees.test | 38 | ||||
-rw-r--r-- | llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp | 7 |
5 files changed, 48 insertions, 3 deletions
diff --git a/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def b/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def index 834f4b69194..41c53807679 100644 --- a/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def +++ b/llvm/include/llvm/DebugInfo/CodeView/CodeViewSymbols.def @@ -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, HeapAllocationSiteSym) 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) diff --git a/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp b/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp index c802b6b6935..104e8f78589 100644 --- a/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp +++ b/llvm/lib/DebugInfo/CodeView/TypeIndexDiscovery.cpp @@ -404,6 +404,7 @@ static bool discoverTypeIndices(ArrayRef<uint8_t> Content, SymbolKind Kind, 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 diff --git a/llvm/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj b/llvm/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj Binary files differnew file mode 100644 index 00000000000..297fdcad0e1 --- /dev/null +++ b/llvm/test/tools/llvm-readobj/Inputs/codeview-inlinees.obj diff --git a/llvm/test/tools/llvm-readobj/codeview-inlinees.test b/llvm/test/tools/llvm-readobj/codeview-inlinees.test new file mode 100644 index 00000000000..bbbe8b45de7 --- /dev/null +++ b/llvm/test/tools/llvm-readobj/codeview-inlinees.test @@ -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: } diff --git a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp index 560c4ac4f82..125506716d9 100644 --- a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp +++ b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp @@ -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)); } |