[Lldb-commits] [lldb] r161089 - /lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp

Jason Molenda jmolenda at apple.com
Tue Jul 31 15:42:30 PDT 2012


Author: jmolenda
Date: Tue Jul 31 17:42:30 2012
New Revision: 161089

URL: http://llvm.org/viewvc/llvm-project?rev=161089&view=rev
Log:
When building up the UnwindPlan based on eh_frame unwind
instructions, be sure to allocate new UnwindPlan::Row's each
time we push a row on to the UnwindPlan so we don't mutate 
it any further.

(fallout from changing the UnwindPlan from having a vector
of Row's to having a vector of RowSP shared pointers.)

<rdar://problem/11997385> 

Modified:
    lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp

Modified: lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp?rev=161089&r1=161088&r2=161089&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp (original)
+++ lldb/trunk/source/Symbol/DWARFCallFrameInfo.cpp Tue Jul 31 17:42:30 2012
@@ -427,6 +427,9 @@
                         // value and adding (delta * code_align). All other
                         // values in the new row are initially identical to the current row.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset(extended_opcode * code_align);
                     }
                     break;
@@ -477,6 +480,9 @@
                         // are initially identical to the current row. The new location value
                         // should always be greater than the current one.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SetOffset(m_cfi_data.GetPointer(&offset) - startaddr.GetFileAddress());
                     }
                     break;
@@ -487,6 +493,9 @@
                         // This instruction is identical to DW_CFA_advance_loc except for the
                         // encoding and size of the delta argument.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset (m_cfi_data.GetU8(&offset) * code_align);
                     }
                     break;
@@ -497,6 +506,9 @@
                         // This instruction is identical to DW_CFA_advance_loc except for the
                         // encoding and size of the delta argument.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset (m_cfi_data.GetU16(&offset) * code_align);
                     }
                     break;
@@ -507,6 +519,9 @@
                         // This instruction is identical to DW_CFA_advance_loc except for the
                         // encoding and size of the delta argument.
                         unwind_plan.AppendRow(row);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
                         row->SlideOffset (m_cfi_data.GetU32(&offset) * code_align);
                     }
                     break;
@@ -570,14 +585,19 @@
                     break;
 
                 case DW_CFA_remember_state      : // 0xA
-                    // These instructions define a stack of information. Encountering the
-                    // DW_CFA_remember_state instruction means to save the rules for every
-                    // register on the current row on the stack. Encountering the
-                    // DW_CFA_restore_state instruction means to pop the set of rules off
-                    // 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);
+                    {
+                        // These instructions define a stack of information. Encountering the
+                        // DW_CFA_remember_state instruction means to save the rules for every
+                        // register on the current row on the stack. Encountering the
+                        // DW_CFA_restore_state instruction means to pop the set of rules off
+                        // 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);
+                        UnwindPlan::Row *newrow = new UnwindPlan::Row;
+                        *newrow = *row.get();
+                        row.reset (newrow);
+                    }
                     break;
 
                 case DW_CFA_restore_state       : // 0xB





More information about the lldb-commits mailing list