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

Jason Molenda jmolenda at apple.com
Thu Sep 12 16:35:50 PDT 2013


(accidentally didn't cc the list)

This looks good, please commit when you have a chance.

On Sep 12, 2013, at 4:17 PM, Richard Mitton <richard at codersnotes.com> wrote:

> 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;
> <D1666.1.patch>_______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list