[Lldb-commits] [lldb] r189074 - Simplify the CreateFunctionEntryUnwindPlan () and CreateDefaultUnwindPlan()
Jason Molenda
jmolenda at apple.com
Thu Aug 22 16:13:43 PDT 2013
Author: jmolenda
Date: Thu Aug 22 18:13:43 2013
New Revision: 189074
URL: http://llvm.org/viewvc/llvm-project?rev=189074&view=rev
Log:
Simplify the CreateFunctionEntryUnwindPlan () and CreateDefaultUnwindPlan()
methods in the ABIs. Specify the register numbering of the UnwindPlan
we're creating and use those only register numbers.
Modified:
lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
Modified: lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp?rev=189074&r1=189073&r2=189074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp Thu Aug 22 18:13:43 2013
@@ -580,32 +580,13 @@ ABIMacOSX_arm::SetReturnValueObject(lldb
bool
ABIMacOSX_arm::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
{
- uint32_t reg_kind = unwind_plan.GetRegisterKind();
- uint32_t lr_reg_num = LLDB_INVALID_REGNUM;
- uint32_t sp_reg_num = LLDB_INVALID_REGNUM;
- uint32_t pc_reg_num = LLDB_INVALID_REGNUM;
-
- switch (reg_kind)
- {
- case eRegisterKindDWARF:
- case eRegisterKindGCC:
- lr_reg_num = dwarf_lr;
- sp_reg_num = dwarf_sp;
- pc_reg_num = dwarf_pc;
- break;
-
- case eRegisterKindGeneric:
- lr_reg_num = LLDB_REGNUM_GENERIC_RA;
- sp_reg_num = LLDB_REGNUM_GENERIC_SP;
- pc_reg_num = LLDB_REGNUM_GENERIC_PC;
- break;
- }
-
- if (lr_reg_num == LLDB_INVALID_REGNUM ||
- sp_reg_num == LLDB_INVALID_REGNUM ||
- pc_reg_num == LLDB_INVALID_REGNUM)
- return false;
+ unwind_plan.Clear();
+ unwind_plan.SetRegisterKind (eRegisterKindDWARF);
+ uint32_t lr_reg_num = dwarf_lr;
+ uint32_t sp_reg_num = dwarf_sp;
+ uint32_t pc_reg_num = dwarf_pc;
+
UnwindPlan::RowSP row(new UnwindPlan::Row);
// Our Call Frame Address is the stack pointer value
@@ -626,14 +607,15 @@ ABIMacOSX_arm::CreateFunctionEntryUnwind
bool
ABIMacOSX_arm::CreateDefaultUnwindPlan (UnwindPlan &unwind_plan)
{
- uint32_t fp_reg_num = dwarf_r7; // apple uses r7 for all frames. Normal arm uses r11;
+ unwind_plan.Clear ();
+ unwind_plan.SetRegisterKind (eRegisterKindDWARF);
+
+ uint32_t fp_reg_num = dwarf_r7; // apple uses r7 for all frames. Normal arm uses r11
uint32_t pc_reg_num = dwarf_pc;
UnwindPlan::RowSP row(new UnwindPlan::Row);
const int32_t ptr_size = 4;
- unwind_plan.Clear ();
- unwind_plan.SetRegisterKind (eRegisterKindDWARF);
row->SetCFARegister (fp_reg_num);
row->SetCFAOffset (2 * ptr_size);
row->SetOffset (0);
Modified: lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp?rev=189074&r1=189073&r2=189074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp Thu Aug 22 18:13:43 2013
@@ -833,37 +833,12 @@ ABIMacOSX_i386::GetReturnValueObjectImpl
bool
ABIMacOSX_i386::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
{
- uint32_t reg_kind = unwind_plan.GetRegisterKind();
- uint32_t sp_reg_num = LLDB_INVALID_REGNUM;
- uint32_t pc_reg_num = LLDB_INVALID_REGNUM;
-
- switch (reg_kind)
- {
- case eRegisterKindDWARF:
- sp_reg_num = dwarf_esp;
- pc_reg_num = dwarf_eip;
- break;
+ unwind_plan.Clear();
+ unwind_plan.SetRegisterKind (eRegisterKindDWARF);
- case eRegisterKindGCC:
- sp_reg_num = gcc_esp;
- pc_reg_num = gcc_eip;
- break;
-
- case eRegisterKindGDB:
- sp_reg_num = gdb_esp;
- pc_reg_num = gdb_eip;
- break;
-
- case eRegisterKindGeneric:
- sp_reg_num = LLDB_REGNUM_GENERIC_SP;
- pc_reg_num = LLDB_REGNUM_GENERIC_PC;
- break;
- }
+ uint32_t sp_reg_num = dwarf_esp;
+ uint32_t pc_reg_num = dwarf_eip;
- if (sp_reg_num == LLDB_INVALID_REGNUM ||
- pc_reg_num == LLDB_INVALID_REGNUM)
- return false;
-
UnwindPlan::RowSP row(new UnwindPlan::Row);
row->SetCFARegister (sp_reg_num);
row->SetCFAOffset (4);
@@ -877,6 +852,9 @@ ABIMacOSX_i386::CreateFunctionEntryUnwin
bool
ABIMacOSX_i386::CreateDefaultUnwindPlan (UnwindPlan &unwind_plan)
{
+ unwind_plan.Clear ();
+ unwind_plan.SetRegisterKind (eRegisterKindDWARF);
+
uint32_t fp_reg_num = dwarf_ebp;
uint32_t sp_reg_num = dwarf_esp;
uint32_t pc_reg_num = dwarf_eip;
@@ -884,8 +862,6 @@ ABIMacOSX_i386::CreateDefaultUnwindPlan
UnwindPlan::RowSP row(new UnwindPlan::Row);
const int32_t ptr_size = 4;
- unwind_plan.Clear ();
- unwind_plan.SetRegisterKind (eRegisterKindDWARF);
row->SetCFARegister (fp_reg_num);
row->SetCFAOffset (2 * ptr_size);
row->SetOffset (0);
Modified: lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp?rev=189074&r1=189073&r2=189074&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp (original)
+++ lldb/trunk/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp Thu Aug 22 18:13:43 2013
@@ -1085,33 +1085,12 @@ ABISysV_x86_64::GetReturnValueObjectImpl
bool
ABISysV_x86_64::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
{
- uint32_t reg_kind = unwind_plan.GetRegisterKind();
- uint32_t sp_reg_num = LLDB_INVALID_REGNUM;
- uint32_t pc_reg_num = LLDB_INVALID_REGNUM;
+ unwind_plan.Clear();
+ unwind_plan.SetRegisterKind (eRegisterKindDWARF);
+
+ uint32_t sp_reg_num = gcc_dwarf_rsp;
+ uint32_t pc_reg_num = gcc_dwarf_rip;
- switch (reg_kind)
- {
- case eRegisterKindDWARF:
- case eRegisterKindGCC:
- sp_reg_num = gcc_dwarf_rsp;
- pc_reg_num = gcc_dwarf_rip;
- break;
-
- case eRegisterKindGDB:
- sp_reg_num = gdb_rsp;
- pc_reg_num = gdb_rip;
- break;
-
- case eRegisterKindGeneric:
- sp_reg_num = LLDB_REGNUM_GENERIC_SP;
- pc_reg_num = LLDB_REGNUM_GENERIC_PC;
- break;
- }
-
- if (sp_reg_num == LLDB_INVALID_REGNUM ||
- pc_reg_num == LLDB_INVALID_REGNUM)
- return false;
-
UnwindPlan::RowSP row(new UnwindPlan::Row);
row->SetCFARegister (sp_reg_num);
row->SetCFAOffset (8);
@@ -1125,38 +1104,13 @@ ABISysV_x86_64::CreateFunctionEntryUnwin
bool
ABISysV_x86_64::CreateDefaultUnwindPlan (UnwindPlan &unwind_plan)
{
- uint32_t reg_kind = unwind_plan.GetRegisterKind();
- uint32_t fp_reg_num = LLDB_INVALID_REGNUM;
- uint32_t sp_reg_num = LLDB_INVALID_REGNUM;
- uint32_t pc_reg_num = LLDB_INVALID_REGNUM;
-
- switch (reg_kind)
- {
- case eRegisterKindDWARF:
- case eRegisterKindGCC:
- fp_reg_num = gcc_dwarf_rbp;
- sp_reg_num = gcc_dwarf_rsp;
- pc_reg_num = gcc_dwarf_rip;
- break;
-
- case eRegisterKindGDB:
- fp_reg_num = gdb_rbp;
- sp_reg_num = gdb_rsp;
- pc_reg_num = gdb_rip;
- break;
-
- case eRegisterKindGeneric:
- fp_reg_num = LLDB_REGNUM_GENERIC_FP;
- sp_reg_num = LLDB_REGNUM_GENERIC_SP;
- pc_reg_num = LLDB_REGNUM_GENERIC_PC;
- break;
- }
-
- if (fp_reg_num == LLDB_INVALID_REGNUM ||
- sp_reg_num == LLDB_INVALID_REGNUM ||
- pc_reg_num == LLDB_INVALID_REGNUM)
- return false;
+ unwind_plan.Clear();
+ unwind_plan.SetRegisterKind (eRegisterKindDWARF);
+ uint32_t fp_reg_num = gcc_dwarf_rbp;
+ uint32_t sp_reg_num = gcc_dwarf_rsp;
+ uint32_t pc_reg_num = gcc_dwarf_rip;
+
UnwindPlan::RowSP row(new UnwindPlan::Row);
const int32_t ptr_size = 8;
More information about the lldb-commits
mailing list