forked from OSchip/llvm-project
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. llvm-svn: 189074
This commit is contained in:
parent
cbe9862305
commit
9f9c963e47
|
@ -580,32 +580,13 @@ ABIMacOSX_arm::SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObj
|
|||
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::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
|
|||
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);
|
||||
|
|
|
@ -833,37 +833,12 @@ ABIMacOSX_i386::GetReturnValueObjectImpl (Thread &thread,
|
|||
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::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
|
|||
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 &unwind_plan)
|
|||
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);
|
||||
|
|
|
@ -1085,33 +1085,12 @@ ABISysV_x86_64::GetReturnValueObjectImpl (Thread &thread, ClangASTType &return_c
|
|||
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::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan)
|
|||
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;
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
UnwindPlan::RowSP row(new UnwindPlan::Row);
|
||||
|
||||
const int32_t ptr_size = 8;
|
||||
|
|
Loading…
Reference in New Issue