[Lldb-commits] [lldb] r184828 - Remove some unnecessary uses of nub_break_t in the arm specific

Jason Molenda jmolenda at apple.com
Mon Jun 24 23:01:20 PDT 2013


Author: jmolenda
Date: Tue Jun 25 01:01:20 2013
New Revision: 184828

URL: http://llvm.org/viewvc/llvm-project?rev=184828&view=rev
Log:
Remove some unnecessary uses of nub_break_t in the arm specific
support files for debugserver to fix a build failure for arm.  Also
remove some of the code used for software-driven single instruction
stepping; this is slowly being yanked out and these particular bits
overlap with the nub_break_t going away.


Modified:
    lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
    lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h

Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp?rev=184828&r1=184827&r2=184828&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Tue Jun 25 01:01:20 2013
@@ -453,18 +453,7 @@ MachThread::ShouldStop(bool &step_more)
 bool
 MachThread::IsStepping()
 {
-#if ENABLE_AUTO_STEPPING_OVER_BP
-    // Return true if this thread is currently being stepped.
-    // MachThread::ThreadWillResume currently determines this by looking if we
-    // have been asked to single step, or if we are at a breakpoint instruction
-    // and have been asked to resume. In the latter case we need to disable the
-    // breakpoint we are at, single step, re-enable and continue.
-    nub_state_t state = GetState();
-    return ((state == eStateStepping) ||
-            (state == eStateRunning && NUB_BREAK_ID_IS_VALID(CurrentBreakpoint())));
-#else
     return GetState() == eStateStepping;
-#endif
 }
 
 
@@ -493,52 +482,10 @@ MachThread::ThreadDidStop()
     // Update the basic information for a thread
     MachThread::GetBasicInfo(m_mach_port_number, &m_basic_info);
 
-#if ENABLE_AUTO_STEPPING_OVER_BP
-    // See if we were at a breakpoint when we last resumed that we disabled,
-    // re-enable it.
-    nub_break_t breakID = CurrentBreakpoint();
-
-    if (NUB_BREAK_ID_IS_VALID(breakID))
-    {
-        m_process->EnableBreakpoint(breakID);
-        if (m_basic_info.suspend_count > 0)
-        {
-            SetState(eStateSuspended);
-        }
-        else
-        {
-            // If we last were at a breakpoint and we single stepped, our state
-            // will be "running" to indicate we need to continue after stepping
-            // over the breakpoint instruction. If we step over a breakpoint
-            // instruction, we need to stop.
-            if (GetState() == eStateRunning)
-            {
-                // Leave state set to running so we will continue automatically
-                // from this breakpoint
-            }
-            else
-            {
-                SetState(eStateStopped);
-            }
-        }
-    }
-    else
-    {
-        if (m_basic_info.suspend_count > 0)
-        {
-            SetState(eStateSuspended);
-        }
-        else
-        {
-            SetState(eStateStopped);
-        }
-    }
-#else
     if (m_basic_info.suspend_count > 0)
         SetState(eStateSuspended);
     else
         SetState(eStateStopped);
-#endif
     return true;
 }
 

Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp?rev=184828&r1=184827&r2=184828&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.cpp Tue Jun 25 01:01:20 2013
@@ -422,51 +422,7 @@ DNBArchMachARM::ThreadDidStop()
         // We are single stepping, was this the primary thread?
         if (m_thread->IsStepping())
         {
-            // Are we software single stepping?
-            if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id) || m_sw_single_step_itblock_break_count)
-            {
-                // Remove any software single stepping breakpoints that we have set
-
-                // Do we have a normal software single step breakpoint?
-                if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_break_id))
-                {
-                    DNBLogThreadedIf(LOG_STEP, "%s: removing software single step breakpoint (breakID=%d)", __FUNCTION__, m_sw_single_step_break_id);
-                    success = m_thread->Process()->DisableBreakpoint(m_sw_single_step_break_id, true);
-                    m_sw_single_step_break_id = INVALID_NUB_BREAK_ID;
-                }
-
-                // Do we have any Thumb IT breakpoints?
-                if (m_sw_single_step_itblock_break_count > 0)
-                {
-                    // See if we hit one of our Thumb IT breakpoints?
-                    DNBBreakpoint *step_bp = m_thread->Process()->Breakpoints().FindByAddress(m_state.context.gpr.__pc);
-
-                    if (step_bp)
-                    {
-                        // We did hit our breakpoint, tell the breakpoint it was
-                        // hit so that it can run its callback routine and fixup
-                        // the PC.
-                        DNBLogThreadedIf(LOG_STEP, "%s: IT software single step breakpoint hit (breakID=%u)", __FUNCTION__, step_bp->GetID());
-                        step_bp->BreakpointHit(m_thread->Process()->ProcessID(), m_thread->ThreadID());
-                    }
-
-                    // Remove all Thumb IT breakpoints
-                    for (int i = 0; i < m_sw_single_step_itblock_break_count; i++)
-                    {
-                        if (NUB_BREAK_ID_IS_VALID(m_sw_single_step_itblock_break_id[i]))
-                        {
-                            DNBLogThreadedIf(LOG_STEP, "%s: removing IT software single step breakpoint (breakID=%d)", __FUNCTION__, m_sw_single_step_itblock_break_id[i]);
-                            success = m_thread->Process()->DisableBreakpoint(m_sw_single_step_itblock_break_id[i], true);
-                            m_sw_single_step_itblock_break_id[i] = INVALID_NUB_BREAK_ID;
-                        }
-                    }
-                    m_sw_single_step_itblock_break_count = 0;
-
-                }
-
-            }
-            else
-                success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
+            success = EnableHardwareSingleStep(false) == KERN_SUCCESS;
         }
         else
         {
@@ -701,18 +657,6 @@ DNBArchMachARM::ConditionPassed(uint8_t
     return false;
 }
 
-nub_bool_t
-DNBArchMachARM::BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton)
-{
-    nub_addr_t bkpt_pc = (nub_addr_t)baton;
-    DNBLogThreadedIf(LOG_STEP | LOG_VERBOSE, "%s(pid = %i, tid = %4.4x, breakID = %u, baton = %p): Setting PC to 0x%8.8x", __FUNCTION__, pid, tid, breakID, baton, bkpt_pc);
-    
-    DNBRegisterValue pc_value;
-    DNBThreadGetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
-    pc_value.value.uint32 = bkpt_pc;
-    return DNBThreadSetRegisterValueByID (pid, tid, REGISTER_SET_GENERIC, GENERIC_REGNUM_PC, &pc_value);
-}
-
 uint32_t
 DNBArchMachARM::NumSupportedHardwareBreakpoints()
 {

Modified: lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h?rev=184828&r1=184827&r2=184828&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/arm/DNBArchImpl.h Tue Jun 25 01:01:20 2013
@@ -29,9 +29,6 @@ public:
         m_thread(thread),
         m_state(),
         m_hw_single_chained_step_addr(INVALID_NUB_ADDRESS),
-        m_sw_single_step_next_pc(INVALID_NUB_ADDRESS),
-        m_sw_single_step_break_id(INVALID_NUB_BREAK_ID),
-        m_sw_single_step_itblock_break_count(0),
         m_last_decode_pc(INVALID_NUB_ADDRESS),
         m_watchpoint_hw_index(-1),
         m_watchpoint_did_occur(false),
@@ -41,8 +38,6 @@ public:
 #if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
         ThumbStaticsInit(&m_last_decode_thumb);
 #endif
-        for (int i = 0; i < kMaxNumThumbITBreakpoints; i++)
-            m_sw_single_step_itblock_break_id[i] = INVALID_NUB_BREAK_ID;
     }
 
     virtual ~DNBArchMachARM()
@@ -100,7 +95,6 @@ protected:
     void                    DecodeITBlockInstructions(nub_addr_t curr_pc);
 #endif
     void                    EvaluateNextInstructionForSoftwareBreakpointSetup(nub_addr_t currentPC, uint32_t cpsr, bool currentPCIsThumb, nub_addr_t *nextPC, bool *nextPCIsThumb);
-    static nub_bool_t       BreakpointHit (nub_process_t pid, nub_thread_t tid, nub_break_t breakID, void *baton);
 
     typedef enum RegisterSetTag
     {
@@ -249,16 +243,6 @@ protected:
     State           m_state;
     DBG             m_dbg_save;
     nub_addr_t      m_hw_single_chained_step_addr;
-    // Software single stepping support
-    nub_addr_t      m_sw_single_step_next_pc;
-    nub_break_t     m_sw_single_step_break_id;
-    nub_break_t     m_sw_single_step_itblock_break_id[kMaxNumThumbITBreakpoints];
-    nub_addr_t      m_sw_single_step_itblock_break_count;
-    // Disassembler state
-#if defined (USE_ARM_DISASSEMBLER_FRAMEWORK)
-    thumb_static_data_t m_last_decode_thumb;
-    arm_decoded_instruction_t m_last_decode_arm;
-#endif
     nub_addr_t      m_last_decode_pc;
 
     // The following member variables should be updated atomically.





More information about the lldb-commits mailing list