summaryrefslogtreecommitdiffstats
path: root/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-01-18 19:36:39 +0000
committerGreg Clayton <gclayton@apple.com>2011-01-18 19:36:39 +0000
commitc4e411ffc09a77abe9957f83827fc1745d7e0408 (patch)
tree78a1107cecd93fdb0cda97b735d5ff23751f2c4a /lldb/tools/debugserver/source/MacOSX/MachThread.cpp
parent4dc73fa075db86bc6a07d755d972e9f8ad7336cc (diff)
downloadbcm5719-llvm-c4e411ffc09a77abe9957f83827fc1745d7e0408.tar.gz
bcm5719-llvm-c4e411ffc09a77abe9957f83827fc1745d7e0408.zip
Thread safety changes in debugserver and also in the process GDB remote plugin.
I added support for asking if the GDB remote server supports thread suffixes for packets that should be thread specific (register read/write packets) because the way the GDB remote protocol does it right now is to have a notion of a current thread for register and memory reads/writes (set via the "$Hg%x" packet) and a current thread for running ("$Hc%x"). Now we ask the remote GDB server if it supports adding the thread ID to the register packets and we enable that feature in LLDB if supported. This stops us from having to send a bunch of packets that update the current thread ID to some value which is prone to error, or extra packets. llvm-svn: 123762
Diffstat (limited to 'lldb/tools/debugserver/source/MacOSX/MachThread.cpp')
-rw-r--r--lldb/tools/debugserver/source/MacOSX/MachThread.cpp91
1 files changed, 40 insertions, 51 deletions
diff --git a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
index 7890c069a77..003a58b79d6 100644
--- a/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
+++ b/lldb/tools/debugserver/source/MacOSX/MachThread.cpp
@@ -339,6 +339,12 @@ MachThread::ThreadWillResume(const DNBThreadResumeAction *thread_action)
m_stop_exception.Clear();
}
+nub_break_t
+MachThread::CurrentBreakpoint()
+{
+ return m_process->Breakpoints().FindIDByAddress(GetPC());
+}
+
bool
MachThread::ShouldStop(bool &step_more)
{
@@ -394,14 +400,18 @@ 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()));
+ return ((state == eStateStepping) ||
+ (state == eStateRunning && NUB_BREAK_ID_IS_VALID(CurrentBreakpoint())));
+#else
+ return GetState() == eStateStepping;
+#endif
}
@@ -430,6 +440,7 @@ MachThread::ThreadDidStop()
// Update the basic information for a thread
MachThread::GetBasicInfo(m_tid, &m_basicInfo);
+#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();
@@ -469,10 +480,12 @@ MachThread::ThreadDidStop()
SetState(eStateStopped);
}
}
-
-
- SetCurrentBreakpoint(INVALID_NUB_BREAK_ID);
-
+#else
+ if (m_basicInfo.suspend_count > 0)
+ SetState(eStateSuspended);
+ else
+ SetState(eStateStopped);
+#endif
return true;
}
@@ -496,30 +509,27 @@ MachThread::NotifyException(MachException::Data& exc)
if (!handled)
{
handled = true;
- nub_addr_t pc = GetPC();
- nub_break_t breakID = m_process->Breakpoints().FindIDByAddress(pc);
- SetCurrentBreakpoint(breakID);
- switch (exc.exc_type)
- {
- case EXC_BAD_ACCESS:
- break;
- case EXC_BAD_INSTRUCTION:
- break;
- case EXC_ARITHMETIC:
- break;
- case EXC_EMULATION:
- break;
- case EXC_SOFTWARE:
- break;
- case EXC_BREAKPOINT:
- break;
- case EXC_SYSCALL:
- break;
- case EXC_MACH_SYSCALL:
- break;
- case EXC_RPC_ALERT:
- break;
- }
+// switch (exc.exc_type)
+// {
+// case EXC_BAD_ACCESS:
+// break;
+// case EXC_BAD_INSTRUCTION:
+// break;
+// case EXC_ARITHMETIC:
+// break;
+// case EXC_EMULATION:
+// break;
+// case EXC_SOFTWARE:
+// break;
+// case EXC_BREAKPOINT:
+// break;
+// case EXC_SYSCALL:
+// break;
+// case EXC_MACH_SYSCALL:
+// break;
+// case EXC_RPC_ALERT:
+// break;
+// }
}
return handled;
}
@@ -658,27 +668,6 @@ MachThread::DisableHardwareWatchpoint (const DNBBreakpoint *wp)
return false;
}
-
-void
-MachThread::NotifyBreakpointChanged (const DNBBreakpoint *bp)
-{
- nub_break_t breakID = bp->GetID();
- if (bp->IsEnabled())
- {
- if (bp->Address() == GetPC())
- {
- SetCurrentBreakpoint(breakID);
- }
- }
- else
- {
- if (CurrentBreakpoint() == breakID)
- {
- SetCurrentBreakpoint(INVALID_NUB_BREAK_ID);
- }
- }
-}
-
bool
MachThread::GetIdentifierInfo ()
{
OpenPOWER on IntegriCloud