[Lldb-commits] [lldb] r125244 - in /lldb/trunk/source/Plugins/Instruction/ARM: EmulateInstructionARM.cpp EmulateInstructionARM.h

Johnny Chen johnny.chen at apple.com
Wed Feb 9 15:59:18 PST 2011


Author: johnny
Date: Wed Feb  9 17:59:17 2011
New Revision: 125244

URL: http://llvm.org/viewvc/llvm-project?rev=125244&view=rev
Log:
Add a new member variable m_new_inst_cpsr to catch the to-be-updated state
of the CPSR during the course of executing an opcode, and modified SelectInstrSet()
to update this variable instead of the original m_inst_cpsr, which should be
the cached copy of the CPSR at the beginning of executing the opcode.

Modified:
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp
    lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h

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=125244&r1=125243&r2=125244&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp Wed Feb  9 17:59:17 2011
@@ -2373,7 +2373,7 @@
 
     if (cpsr_changed)
     {
-        if (!WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS, m_inst_cpsr))
+        if (!WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_FLAGS, m_new_inst_cpsr))
             return false;
     }
     if (!WriteRegisterUnsigned (context, eRegisterKindGeneric, LLDB_REGNUM_GENERIC_PC, target))
@@ -2409,21 +2409,23 @@
 }
 
 // Set the 'T' bit of our CPSR.  The m_inst_mode gets updated when the next
-// ReadInstruction() is performed.
+// ReadInstruction() is performed.  This function has a side effect of updating
+// the m_new_inst_cpsr member variable if necessary.
 bool
 EmulateInstructionARM::SelectInstrSet (Mode arm_or_thumb)
 {
+    m_new_inst_cpsr = m_inst_cpsr;
     switch (arm_or_thumb)
     {
     default:
         return false;
     eModeARM:
         // Clear the T bit.
-        m_inst_cpsr &= ~MASK_CPSR_T;
+        m_new_inst_cpsr &= ~MASK_CPSR_T;
         break;
     eModeThumb:
         // Set the T bit.
-        m_inst_cpsr |= MASK_CPSR_T;
+        m_new_inst_cpsr |= MASK_CPSR_T;
         break;
     }
     return true;

Modified: lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h?rev=125244&r1=125243&r2=125244&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h (original)
+++ lldb/trunk/source/Plugins/Instruction/ARM/EmulateInstructionARM.h Wed Feb  9 17:59:17 2011
@@ -270,6 +270,7 @@
     uint32_t m_arm_isa;
     Mode m_inst_mode;
     uint32_t m_inst_cpsr;
+    uint32_t m_new_inst_cpsr; // This can get updated by the opcode.
     ITSession m_it_session;
 };
 





More information about the lldb-commits mailing list