[Lldb-commits] [lldb] r198648 - Update the checks in EmulateInstructionARM::GetFramePointerRegisterNumber
Jason Molenda
jmolenda at apple.com
Mon Jan 6 15:39:35 PST 2014
Author: jmolenda
Date: Mon Jan 6 17:39:35 2014
New Revision: 198648
URL: http://llvm.org/viewvc/llvm-project?rev=198648&view=rev
Log:
Update the checks in EmulateInstructionARM::GetFramePointerRegisterNumber
and EmulateInstructionARM::GetFramePointerDWARFRegisterNumber to recognize
the Apple arm convention (of using r7 for the frame pointer, regardless of
thumb or arm) even if the OS does not match Darwin/MacOSX/iOS. Also
corrects the behavior for thumb code on non-Apple platforms.
<rdar://problem/14661537>
Modified:
lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp?rev=198648&r1=198647&r2=198648&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Mon Jan 6 17:39:35 2014
@@ -289,37 +289,65 @@ EmulateInstructionARM::GetRegisterInfo (
uint32_t
EmulateInstructionARM::GetFramePointerRegisterNumber () const
{
- if (m_opcode_mode == eModeThumb)
+ bool is_apple = false;
+ if (m_arch.GetTriple().getVendor() == llvm::Triple::Apple)
+ is_apple = true;
+ switch (m_arch.GetTriple().getOS())
{
- switch (m_arch.GetTriple().getOS())
- {
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
- return 7;
+ is_apple = true;
+ break;
default:
break;
- }
}
- return 11;
+
+ /* On Apple iOS et al, the frame pointer register is always r7.
+ * Typically on other ARM systems, thumb code uses r7; arm code uses r11.
+ */
+
+ uint32_t fp_regnum = 11;
+
+ if (is_apple)
+ fp_regnum = 7;
+
+ if (m_opcode_mode == eModeThumb)
+ fp_regnum = 7;
+
+ return fp_regnum;
}
uint32_t
EmulateInstructionARM::GetFramePointerDWARFRegisterNumber () const
{
- if (m_opcode_mode == eModeThumb)
+ bool is_apple = false;
+ if (m_arch.GetTriple().getVendor() == llvm::Triple::Apple)
+ is_apple = true;
+ switch (m_arch.GetTriple().getOS())
{
- switch (m_arch.GetTriple().getOS())
- {
case llvm::Triple::Darwin:
case llvm::Triple::MacOSX:
case llvm::Triple::IOS:
- return dwarf_r7;
+ is_apple = true;
+ break;
default:
break;
- }
}
- return dwarf_r11;
+
+ /* On Apple iOS et al, the frame pointer register is always r7.
+ * Typically on other ARM systems, thumb code uses r7; arm code uses r11.
+ */
+
+ uint32_t fp_regnum = dwarf_r11;
+
+ if (is_apple)
+ fp_regnum = dwarf_r7;
+
+ if (m_opcode_mode == eModeThumb)
+ fp_regnum = dwarf_r7;
+
+ return fp_regnum;
}
// Push Multiple Registers stores multiple registers to the stack, storing to
More information about the lldb-commits
mailing list