diff options
Diffstat (limited to 'llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp')
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp index d37a22f..65a8735 100644 --- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp @@ -3566,15 +3566,34 @@ void CodeViewDebug::collectDebugInfoForJumpTables(const MachineFunction *MF, break; } - CurFn->JumpTables.push_back( - {EntrySize, Base, BaseOffset, Branch, - MF->getJTISymbol(JumpTableIndex, MMI->getContext()), - JTI.getJumpTables()[JumpTableIndex].MBBs.size()}); + const MachineJumpTableEntry &JTE = JTI.getJumpTables()[JumpTableIndex]; + JumpTableInfo CVJTI{EntrySize, + Base, + BaseOffset, + Branch, + MF->getJTISymbol(JumpTableIndex, MMI->getContext()), + JTE.MBBs.size()}; + for (const auto &MBB : JTE.MBBs) + CVJTI.Cases.push_back(MBB->getSymbol()); + CurFn->JumpTables.push_back(std::move(CVJTI)); }); } void CodeViewDebug::emitDebugInfoForJumpTables(const FunctionInfo &FI) { - for (auto JumpTable : FI.JumpTables) { + // Emit S_LABEL32 records for each jump target + for (const auto &JumpTable : FI.JumpTables) { + for (const auto &CaseSym : JumpTable.Cases) { + MCSymbol *LabelEnd = beginSymbolRecord(SymbolKind::S_LABEL32); + OS.AddComment("Offset and segment"); + OS.emitCOFFSecRel32(CaseSym, 0); + OS.AddComment("Flags"); + OS.emitInt8(0); + emitNullTerminatedSymbolName(OS, CaseSym->getName()); + endSymbolRecord(LabelEnd); + } + } + + for (const auto &JumpTable : FI.JumpTables) { MCSymbol *JumpTableEnd = beginSymbolRecord(SymbolKind::S_ARMSWITCHTABLE); if (JumpTable.Base) { OS.AddComment("Base offset"); |