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;
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;
 
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to