diff options
| author | Jason Molenda <jmolenda@apple.com> | 2012-07-09 07:47:47 +0000 |
|---|---|---|
| committer | Jason Molenda <jmolenda@apple.com> | 2012-07-09 07:47:47 +0000 |
| commit | 75b9cfd1f091ab0597127567885bda154394f422 (patch) | |
| tree | eb2e856ddcdbb27db134f00845bd169a4bd2140d /lldb/source | |
| parent | c508a742f73f2fd76be9e01db28f9e9c7fcf77f6 (diff) | |
| download | bcm5719-llvm-75b9cfd1f091ab0597127567885bda154394f422.tar.gz bcm5719-llvm-75b9cfd1f091ab0597127567885bda154394f422.zip | |
Simplify the CreateDefaultUnwindPlan methods for the x86 and arm unwinders
a bit -- we're creating the UnwindPlan here, we can set the register set to
whatever is convenient for us, no need to handle different register sets.
A handful of small comment fixes I noticed while reading through the code.
llvm-svn: 159924
Diffstat (limited to 'lldb/source')
3 files changed, 17 insertions, 70 deletions
diff --git a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp index 9ec2e64e0e8..9ca35fa9506 100644 --- a/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp @@ -538,10 +538,10 @@ ABIMacOSX_arm::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) UnwindPlan::Row row; - // Our previous Call Frame Address is the stack pointer + // Our Call Frame Address is the stack pointer value row.SetCFARegister (sp_reg_num); - // Our previous PC is in the LR + // The previous PC is in the LR row.SetRegisterLocationToRegister(pc_reg_num, lr_reg_num, true); unwind_plan.AppendRow (row); @@ -554,36 +554,15 @@ ABIMacOSX_arm::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) bool ABIMacOSX_arm::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 = dwarf_r7; // apple uses r7 for all frames. Normal arm uses r11 - sp_reg_num = dwarf_sp; - pc_reg_num = dwarf_pc; - 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; + uint32_t fp_reg_num = dwarf_r7; // apple uses r7 for all frames. Normal arm uses r11; + uint32_t sp_reg_num = dwarf_sp; + uint32_t pc_reg_num = dwarf_pc; UnwindPlan::Row row; const int32_t ptr_size = 4; - unwind_plan.SetRegisterKind (eRegisterKindGeneric); + unwind_plan.Clear (); + unwind_plan.SetRegisterKind (eRegisterKindDWARF); row.SetCFARegister (fp_reg_num); row.SetCFAOffset (2 * ptr_size); row.SetOffset (0); @@ -601,7 +580,7 @@ ABIMacOSX_arm::RegisterIsVolatile (const RegisterInfo *reg_info) { if (reg_info) { - // Volatile registers include: ebx, ebp, esi, edi, esp, eip + // Volatile registers include: r0, r1, r2, r3, r9, r12, r13 const char *name = reg_info->name; if (name[0] == 'r') { diff --git a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp index f5cd7ca7dff..2998e6bbf82 100644 --- a/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp +++ b/lldb/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp @@ -820,47 +820,15 @@ ABIMacOSX_i386::CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) bool ABIMacOSX_i386::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; + uint32_t fp_reg_num = dwarf_ebp; + uint32_t sp_reg_num = dwarf_esp; + uint32_t pc_reg_num = dwarf_eip; - switch (reg_kind) - { - case eRegisterKindDWARF: - fp_reg_num = dwarf_ebp; - sp_reg_num = dwarf_esp; - pc_reg_num = dwarf_eip; - break; - - case eRegisterKindGCC: - fp_reg_num = gcc_ebp; - sp_reg_num = gcc_esp; - pc_reg_num = gcc_eip; - break; - - case eRegisterKindGDB: - fp_reg_num = gdb_ebp; - sp_reg_num = gdb_esp; - pc_reg_num = gdb_eip; - 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::Row row; const int32_t ptr_size = 4; - unwind_plan.SetRegisterKind (eRegisterKindGeneric); + unwind_plan.Clear (); + unwind_plan.SetRegisterKind (eRegisterKindDWARF); row.SetCFARegister (fp_reg_num); row.SetCFAOffset (2 * ptr_size); row.SetOffset (0); diff --git a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp index 37ddfb1a998..6d2b0a54b6a 100644 --- a/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp +++ b/lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp @@ -30,7 +30,7 @@ using namespace lldb_private; //----------------------------------------------------------------------------------------------- -// UnwindAssemblyParser_x86 method definitions +// UnwindAssemblyInstEmulation method definitions //----------------------------------------------------------------------------------------------- bool @@ -71,9 +71,6 @@ UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly (AddressRange& const uint32_t addr_byte_size = m_arch.GetAddressByteSize(); const bool show_address = true; const bool show_bytes = true; - // Initialize the CFA with a known value. In the 32 bit case - // it will be 0x80000000, and in the 64 bit case 0x8000000000000000. - // We use the address byte size to be safe for any future addresss sizes m_inst_emulator_ap->GetRegisterInfo (unwind_plan.GetRegisterKind(), unwind_plan.GetInitialCFARegister(), m_cfa_reg_info); @@ -82,6 +79,9 @@ UnwindAssemblyInstEmulation::GetNonCallSiteUnwindPlanFromAssembly (AddressRange& m_register_values.clear(); m_pushed_regs.clear(); + // Initialize the CFA with a known value. In the 32 bit case + // it will be 0x80000000, and in the 64 bit case 0x8000000000000000. + // We use the address byte size to be safe for any future addresss sizes m_initial_sp = (1ull << ((addr_byte_size * 8) - 1)); RegisterValue cfa_reg_value; cfa_reg_value.SetUInt (m_initial_sp, m_cfa_reg_info.byte_size); |

