diff --git a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp @@ -448,6 +448,13 @@ break; } + case dwarf::DW_OP_call_frame_cfa: { + // The canonical frame address, typically defined as the stack pointer at + // function entry. + raw_svector_ostream S(Stack.emplace_back().String); + S << "CFA"; + break; + } default: if (Opcode >= dwarf::DW_OP_reg0 && Opcode <= dwarf::DW_OP_reg31) { // DW_OP_reg: A register, with the register num implied by the diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp --- a/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp +++ b/llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp @@ -148,3 +148,11 @@ TEST_F(DWARFExpressionCompactPrinterTest, Test_OP_fbreg) { TestExprPrinter({DW_OP_fbreg, 0x8}, "[R11+8]", {DW_OP_reg11}); } + +TEST_F(DWARFExpressionCompactPrinterTest, Test_OP_cfa) { + TestExprPrinter({DW_OP_call_frame_cfa}, "[CFA]"); +} + +TEST_F(DWARFExpressionCompactPrinterTest, Test_OP_fbreg_cfa) { + TestExprPrinter({DW_OP_fbreg, 0x78}, "[CFA-8]", {DW_OP_call_frame_cfa}); +}