[Lldb-commits] [lldb] r305687 - Tweak SysV_arm64 function entry unwind plan

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 19 05:39:34 PDT 2017

Author: labath
Date: Mon Jun 19 07:39:34 2017
New Revision: 305687

URL: http://llvm.org/viewvc/llvm-project?rev=305687&view=rev
Tweak SysV_arm64 function entry unwind plan

The motivation for this is to make sure the first row of the plan
compares equal to the first row of a generic debug_frame unwind plan.
Right now, the code in FuncUnwinders::GetUnwindPlanAtNonCallSite
considers them unequal because they specify the return address in a
different way (SetReturnAddressRegister(LR) vs. an explicit PC=LR rule).
This means that FuncUnwinders would always choose the debug_frame unwind
plan, which is not correct, as that one is usually not correct at all

Right now this is basically a noop because we don't have parse any
debug_frame plans, but it fixes some test failures when merging D33504

I have to say I don't understand the full implications of the switch to
SetReturnAddressRegister() way of doing things, but given that all of
our other unwind plans (eh_frame, instruction profiling) do it this way,
it sounds like the right thing to do.

Reviewers: tberghammer, jasonmolenda, omjavaid

Subscribers: aemerson, javed.absar, kristof.beyls, lldb-commits

Differential Revision: https://reviews.llvm.org/D34199


Modified: lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp?rev=305687&r1=305686&r2=305687&view=diff
--- lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp Mon Jun 19 07:39:34 2017
@@ -1951,22 +1951,20 @@ bool ABISysV_arm64::CreateFunctionEntryU
   uint32_t lr_reg_num = arm64_dwarf::lr;
   uint32_t sp_reg_num = arm64_dwarf::sp;
-  uint32_t pc_reg_num = arm64_dwarf::pc;
   UnwindPlan::RowSP row(new UnwindPlan::Row);
   // Our previous Call Frame Address is the stack pointer
   row->GetCFAValue().SetIsRegisterPlusOffset(sp_reg_num, 0);
-  // Our previous PC is in the LR
-  row->SetRegisterLocationToRegister(pc_reg_num, lr_reg_num, true);
+  unwind_plan.SetReturnAddressRegister(lr_reg_num);
   // All other registers are the same.
   unwind_plan.SetSourceName("arm64 at-func-entry default");
+  unwind_plan.SetUnwindPlanValidAtAllInstructions(eLazyBoolNo);
   return true;

More information about the lldb-commits mailing list