summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target/Process.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-11-17 01:23:07 +0000
committerGreg Clayton <gclayton@apple.com>2011-11-17 01:23:07 +0000
commit2637f82542071c5ce21aa79ae897c01d29c8f560 (patch)
tree12108f1cf911d90e23df87a73b612e2482a7b8b0 /lldb/source/Target/Process.cpp
parent78d614883f2f751ea9334f2a16b3bdedcf15be5a (diff)
downloadbcm5719-llvm-2637f82542071c5ce21aa79ae897c01d29c8f560.tar.gz
bcm5719-llvm-2637f82542071c5ce21aa79ae897c01d29c8f560.zip
Fixed an issue with the pthread_setspecific() where we weren't NULL-ing out
the thread specific data and were destroying the thread specfic data more than once. Also added the ability to ask a lldb::StateType if it is stopped with an additional paramter of "must_exist" which means that the state must be a stopped state for a process that still exists. This means that eStateExited and eStateUnloaded will no longer return true if "must_exist" is set to true. llvm-svn: 144875
Diffstat (limited to 'lldb/source/Target/Process.cpp')
-rw-r--r--lldb/source/Target/Process.cpp32
1 files changed, 18 insertions, 14 deletions
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index ff5d7182468..3d917a6f758 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -1179,16 +1179,20 @@ Process::UpdateThreadListIfNeeded ()
const uint32_t stop_id = GetStopID();
if (m_thread_list.GetSize(false) == 0 || stop_id != m_thread_list.GetStopID())
{
- Mutex::Locker locker (m_thread_list.GetMutex ());
- ThreadList new_thread_list(this);
- // Always update the thread list with the protocol specific
- // thread list
- UpdateThreadList (m_thread_list, new_thread_list);
- OperatingSystem *os = GetOperatingSystem ();
- if (os)
- os->UpdateThreadList (m_thread_list, new_thread_list);
- m_thread_list.Update (new_thread_list);
- m_thread_list.SetStopID (stop_id);
+ const StateType state = GetPrivateState();
+ if (StateIsStoppedState (state, true))
+ {
+ Mutex::Locker locker (m_thread_list.GetMutex ());
+ ThreadList new_thread_list(this);
+ // Always update the thread list with the protocol specific
+ // thread list
+ UpdateThreadList (m_thread_list, new_thread_list);
+ OperatingSystem *os = GetOperatingSystem ();
+ if (os)
+ os->UpdateThreadList (m_thread_list, new_thread_list);
+ m_thread_list.Update (new_thread_list);
+ m_thread_list.SetStopID (stop_id);
+ }
}
}
@@ -1236,7 +1240,7 @@ Process::SetPrivateState (StateType new_state)
if (state_changed)
{
m_private_state.SetValueNoLock (new_state);
- if (StateIsStoppedState(new_state))
+ if (StateIsStoppedState(new_state, false))
{
m_mod_id.BumpStopID();
m_memory_cache.Clear();
@@ -2167,7 +2171,7 @@ Process::WaitForProcessStopPrivate (const TimeValue *timeout, EventSP &event_sp)
event_sp.reset();
state = WaitForStateChangedEventsPrivate (timeout, event_sp);
- if (StateIsStoppedState(state))
+ if (StateIsStoppedState(state, false))
break;
// If state is invalid, then we timed out
@@ -2683,7 +2687,7 @@ Process::Halt ()
}
else
{
- if (StateIsStoppedState (state))
+ if (StateIsStoppedState (state, false))
{
// We caused the process to interrupt itself, so mark this
// as such in the stop event so clients can tell an interrupted
@@ -4247,7 +4251,7 @@ void
Process::GetStatus (Stream &strm)
{
const StateType state = GetState();
- if (StateIsStoppedState(state))
+ if (StateIsStoppedState(state, false))
{
if (state == eStateExited)
{
OpenPOWER on IntegriCloud