[Lldb-commits] [PATCH] Fixed CFI state corruption bug.

Richard Mitton richard at codersnotes.com
Thu Sep 12 16:17:25 PDT 2013


Fixed a bug where CFI data would become corrupted when using remember/restore state instructions.

This would prevent system calls on Linux from being able to backtrace correctly.


http://llvm-reviews.chandlerc.com/D1666

Files:
  source/Symbol/DWARFCallFrameInfo.cpp

Index: source/Symbol/DWARFCallFrameInfo.cpp
===================================================================
--- source/Symbol/DWARFCallFrameInfo.cpp
+++ source/Symbol/DWARFCallFrameInfo.cpp
@@ -444,6 +444,8 @@
     unwind_plan.SetRegisterKind (m_reg_kind);
     unwind_plan.SetReturnAddressRegister (cie->return_addr_reg_num);
 
+    std::vector<UnwindPlan::RowSP> stack;
+
     UnwindPlan::Row::RegisterLocation reg_location;
     while (m_cfi_data.ValidOffset(offset) && offset < end_offset)
     {
@@ -629,7 +631,7 @@
                         // the stack and place them in the current row. (This operation is
                         // useful for compilers that move epilogue code into the body of a
                         // function.)
-                        unwind_plan.AppendRow (row);
+                        stack.push_back (row);
                         UnwindPlan::Row *newrow = new UnwindPlan::Row;
                         *newrow = *row.get();
                         row.reset (newrow);
@@ -645,7 +647,8 @@
                     // useful for compilers that move epilogue code into the body of a
                     // function.)
                     {
-                        row = unwind_plan.GetRowAtIndex(unwind_plan.GetRowCount() - 1);
+                        row = stack.back ();
+                        stack.pop_back ();
                     }
                     break;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1666.1.patch
Type: text/x-patch
Size: 1412 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20130912/1d3c2778/attachment.bin>


More information about the lldb-commits mailing list