[PATCH] D76224: [llvm-objdump] Add call_frame_cfa locations to variable display

Oliver Stannard (Linaro) via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 16 05:17:13 PDT 2020


ostannard created this revision.
ostannard added reviewers: jhenderson, echristo, MaskRay.
Herald added a subscriber: hiraditya.
Herald added a project: LLVM.
ostannard added a parent revision: D76223: [llvm-objdump] Add frame register opcode to variable display.
ostannard added a child revision: D76225: [llvm-objdump] Add constant value opcodes to variable display.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76224

Files:
  llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp


Index: llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp
===================================================================
--- llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp
+++ 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});
+}
Index: llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
===================================================================
--- llvm/lib/DebugInfo/DWARF/DWARFExpression.cpp
+++ 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<N>: A register, with the register num implied by the


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76224.250524.patch
Type: text/x-patch
Size: 1373 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200316/f423f37d/attachment.bin>


More information about the llvm-commits mailing list