[Lldb-commits] [lldb] r123815 - in /lldb/trunk: source/Expression/ClangUserExpression.cpp tools/debugserver/source/DNBBreakpoint.cpp tools/debugserver/source/MacOSX/MachProcess.cpp tools/debugserver/source/MacOSX/MachProcess.h tools/debugserver/source/MacOSX/MachThread.cpp tools/debugserver/source/MacOSX/MachThreadList.cpp tools/debugserver/source/MacOSX/MachThreadList.h tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp tools/debugserver/source/RNBRemote.cpp
Greg Clayton
gclayton at apple.com
Tue Jan 18 23:54:15 PST 2011
Author: gclayton
Date: Wed Jan 19 01:54:15 2011
New Revision: 123815
URL: http://llvm.org/viewvc/llvm-project?rev=123815&view=rev
Log:
Took the timeout for a ClangUserExpression down from a 10 second timeout to
500 ms.
Make MachThreadList more threadsafe.
Added code to make sure the thread register state was properly flushed for x86_64.
Fixed an missing return code for the current thread in the new thread suffix code.
Improved debugserver logging.
Modified:
lldb/trunk/source/Expression/ClangUserExpression.cpp
lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h
lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
lldb/trunk/tools/debugserver/source/RNBRemote.cpp
Modified: lldb/trunk/source/Expression/ClangUserExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangUserExpression.cpp?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangUserExpression.cpp (original)
+++ lldb/trunk/source/Expression/ClangUserExpression.cpp Wed Jan 19 01:54:15 2011
@@ -512,7 +512,7 @@
call_plan_sp->SetPrivate(true);
- uint32_t single_thread_timeout_usec = 10000000;
+ uint32_t single_thread_timeout_usec = 500000;
if (log)
log->Printf("-- [ClangUserExpression::Execute] Execution of expression begins --");
Modified: lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp (original)
+++ lldb/trunk/tools/debugserver/source/DNBBreakpoint.cpp Wed Jan 19 01:54:15 2011
@@ -148,10 +148,10 @@
DNBBreakpoint *bp = FindByAddress (addr);
if (bp)
{
- DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBBreakpointList::%s ( addr = 0x%8.8llx ) => %u", __FUNCTION__, (uint64_t)addr, bp->GetID());
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBBreakpointList::%s ( addr = 0x%16.16llx ) => %u", __FUNCTION__, (uint64_t)addr, bp->GetID());
return bp->GetID();
}
- DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBBreakpointList::%s ( addr = 0x%8.8llx ) => NONE", __FUNCTION__, (uint64_t)addr);
+ DNBLogThreadedIf(LOG_BREAKPOINTS, "DNBBreakpointList::%s ( addr = 0x%16.16llx ) => NONE", __FUNCTION__, (uint64_t)addr);
return INVALID_NUB_BREAK_ID;
}
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.cpp Wed Jan 19 01:54:15 2011
@@ -170,12 +170,6 @@
return m_thread_list.ThreadIDAtIndex(thread_idx);
}
-uint32_t
-MachProcess::GetThreadIndexFromThreadID (nub_thread_t tid)
-{
- return m_thread_list.GetThreadIndexByID(tid);
-}
-
nub_thread_t
MachProcess::GetCurrentThread ()
{
@@ -207,12 +201,12 @@
}
const DNBRegisterSetInfo *
-MachProcess::GetRegisterSetInfo(nub_thread_t tid, nub_size_t *num_reg_sets ) const
+MachProcess::GetRegisterSetInfo (nub_thread_t tid, nub_size_t *num_reg_sets) const
{
- MachThread *thread = m_thread_list.GetThreadByID (tid);
- if (thread)
+ MachThreadSP thread_sp (m_thread_list.GetThreadByID (tid));
+ if (thread_sp)
{
- DNBArchProtocol *arch = thread->GetArchProtocol();
+ DNBArchProtocol *arch = thread_sp->GetArchProtocol();
if (arch)
return arch->GetRegisterSetInfo (num_reg_sets);
}
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Wed Jan 19 01:54:15 2011
@@ -139,7 +139,6 @@
nub_state_t ThreadGetState (nub_thread_t tid);
nub_size_t GetNumThreads () const;
nub_thread_t GetThreadAtIndex (nub_size_t thread_idx) const;
- uint32_t GetThreadIndexFromThreadID (nub_thread_t tid);
nub_thread_t GetCurrentThread ();
nub_thread_t SetCurrentThread (nub_thread_t tid);
MachThreadList & GetThreadList() { return m_thread_list; }
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=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThread.cpp Wed Jan 19 01:54:15 2011
@@ -297,14 +297,14 @@
default: thread_run_state = "???"; break;
}
- DNBLogThreaded("thread[%u] %4.4x (%u): pc: 0x%8.8llx sp: 0x%8.8llx breakID: %d user: %d.%06.6d system: %d.%06.6d cpu: %d policy: %d run_state: %d (%s) flags: %d suspend_count: %d (current %d) sleep_time: %d",
+ DNBLogThreaded("[%3u] #%3u tid: 0x%4.4x, pc: 0x%16.16llx, sp: 0x%16.16llx, breakID: %3d, user: %d.%06.6d, system: %d.%06.6d, cpu: %2d, policy: %2d, run_state: %2d (%s), flags: %2d, suspend_count: %2d (current %2d), sleep_time: %d",
index,
- m_tid,
m_seq_id,
+ m_tid,
GetPC(INVALID_NUB_ADDRESS),
GetSP(INVALID_NUB_ADDRESS),
m_breakID,
- m_basicInfo.user_time.seconds, m_basicInfo.user_time.microseconds,
+ m_basicInfo.user_time.seconds, m_basicInfo.user_time.microseconds,
m_basicInfo.system_time.seconds, m_basicInfo.system_time.microseconds,
m_basicInfo.cpu_usage,
m_basicInfo.policy,
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.cpp Wed Jan 19 01:54:15 2011
@@ -29,47 +29,33 @@
{
}
-// Not thread safe, must lock m_threads_mutex prior to using this function.
-uint32_t
-MachThreadList::GetThreadIndexByID(thread_t tid) const
-{
- uint32_t idx = 0;
- const uint32_t num_threads = m_threads.size();
- for (idx = 0; idx < num_threads; ++idx)
- {
- if (m_threads[idx]->ThreadID() == tid)
- return idx;
- }
- return ~((uint32_t)0);
-}
-
nub_state_t
MachThreadList::GetState(thread_t tid)
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->GetState();
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->GetState();
return eStateInvalid;
}
const char *
MachThreadList::GetName (thread_t tid)
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->GetName();
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->GetName();
return NULL;
}
nub_thread_t
MachThreadList::SetCurrentThread(thread_t tid)
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- m_current_thread = m_threads[idx];
-
- if (m_current_thread.get())
- return m_current_thread->ThreadID();
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ {
+ m_current_thread = thread_sp;
+ return tid;
+ }
return INVALID_NUB_THREAD;
}
@@ -77,9 +63,9 @@
bool
MachThreadList::GetThreadStoppedReason(nub_thread_t tid, struct DNBThreadStopInfo *stop_info) const
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->GetStopException().GetStopInfo(stop_info);
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->GetStopException().GetStopInfo(stop_info);
return false;
}
@@ -91,37 +77,45 @@
}
void
-MachThreadList::DumpThreadStoppedReason(nub_thread_t tid) const
+MachThreadList::DumpThreadStoppedReason (nub_thread_t tid) const
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- m_threads[idx]->GetStopException().DumpStopReason();
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ thread_sp->GetStopException().DumpStopReason();
}
const char *
-MachThreadList::GetThreadInfo(nub_thread_t tid) const
+MachThreadList::GetThreadInfo (nub_thread_t tid) const
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->GetBasicInfoAsString();
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->GetBasicInfoAsString();
return NULL;
}
-MachThread *
+MachThreadSP
MachThreadList::GetThreadByID (nub_thread_t tid) const
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx].get();
- return NULL;
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
+ MachThreadSP thread_sp;
+ const size_t num_threads = m_threads.size();
+ for (size_t idx = 0; idx < num_threads; ++idx)
+ {
+ if (m_threads[idx]->ThreadID() == tid)
+ {
+ thread_sp = m_threads[idx];
+ break;
+ }
+ }
+ return thread_sp;
}
bool
MachThreadList::GetRegisterValue ( nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value ) const
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->GetRegisterValue(reg_set_idx, reg_idx, reg_value);
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->GetRegisterValue(reg_set_idx, reg_idx, reg_value);
return false;
}
@@ -129,9 +123,9 @@
bool
MachThreadList::SetRegisterValue ( nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, const DNBRegisterValue *reg_value ) const
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->SetRegisterValue(reg_set_idx, reg_idx, reg_value);
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->SetRegisterValue(reg_set_idx, reg_idx, reg_value);
return false;
}
@@ -139,30 +133,32 @@
nub_size_t
MachThreadList::GetRegisterContext (nub_thread_t tid, void *buf, size_t buf_len)
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->GetRegisterContext (buf, buf_len);
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->GetRegisterContext (buf, buf_len);
return 0;
}
nub_size_t
MachThreadList::SetRegisterContext (nub_thread_t tid, const void *buf, size_t buf_len)
{
- uint32_t idx = GetThreadIndexByID(tid);
- if (idx < m_threads.size())
- return m_threads[idx]->SetRegisterContext (buf, buf_len);
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
+ return thread_sp->SetRegisterContext (buf, buf_len);
return 0;
}
nub_size_t
-MachThreadList::NumThreads() const
+MachThreadList::NumThreads () const
{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
return m_threads.size();
}
nub_thread_t
-MachThreadList::ThreadIDAtIndex(nub_size_t idx) const
+MachThreadList::ThreadIDAtIndex (nub_size_t idx) const
{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
if (idx < m_threads.size())
return m_threads[idx]->ThreadID();
return INVALID_NUB_THREAD;
@@ -171,42 +167,29 @@
nub_thread_t
MachThreadList::CurrentThreadID ( )
{
- MachThreadSP threadSP;
- CurrentThread(threadSP);
- if (threadSP.get())
- return threadSP->ThreadID();
+ MachThreadSP thread_sp;
+ CurrentThread(thread_sp);
+ if (thread_sp.get())
+ return thread_sp->ThreadID();
return INVALID_NUB_THREAD;
}
bool
MachThreadList::NotifyException(MachException::Data& exc)
{
- uint32_t idx = GetThreadIndexByID(exc.thread_port);
- if (idx < m_threads.size())
+ MachThreadSP thread_sp (GetThreadByID (exc.thread_port));
+ if (thread_sp)
{
- m_threads[idx]->NotifyException(exc);
+ thread_sp->NotifyException(exc);
return true;
}
return false;
}
-/*
-MachThreadList::const_iterator
-MachThreadList::FindThreadByID(thread_t tid) const
-{
- const_iterator pos;
- const_iterator end = m_threads.end();
- for (pos = m_threads.begin(); pos != end; ++pos)
- {
- if (pos->ThreadID() == tid)
- return pos;
- }
- return NULL;
-}
-*/
void
MachThreadList::Clear()
{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
m_threads.clear();
}
@@ -249,29 +232,28 @@
if (err.Error() == KERN_SUCCESS && thread_list_count > 0)
{
MachThreadList::collection currThreads;
- const size_t numOldThreads = m_threads.size();
size_t idx;
// Iterator through the current thread list and see which threads
// we already have in our list (keep them), which ones we don't
// (add them), and which ones are not around anymore (remove them).
for (idx = 0; idx < thread_list_count; ++idx)
{
- uint32_t existing_idx = 0;
- if (numOldThreads > 0)
- existing_idx = GetThreadIndexByID(thread_list[idx]);
- if (existing_idx < numOldThreads)
+ const thread_t tid = thread_list[idx];
+
+ MachThreadSP thread_sp (GetThreadByID (tid));
+ if (thread_sp)
{
// Keep the existing thread class
- currThreads.push_back(m_threads[existing_idx]);
+ currThreads.push_back(thread_sp);
}
else
{
// We don't have this thread, lets add it.
- MachThreadSP threadSP(new MachThread(process, thread_list[idx]));
+ thread_sp.reset(new MachThread(process, tid));
// Make sure the thread is ready to be displayed and shown to users
// before we add this thread to our list...
- if (threadSP->IsUserReady())
- currThreads.push_back(threadSP);
+ if (thread_sp->IsUserReady())
+ currThreads.push_back(thread_sp);
}
}
@@ -290,7 +272,7 @@
void
-MachThreadList::CurrentThread(MachThreadSP& threadSP)
+MachThreadList::CurrentThread (MachThreadSP& thread_sp)
{
// locker will keep a mutex locked until it goes out of scope
PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
@@ -299,49 +281,25 @@
// Figure out which thread is going to be our current thread.
// This is currently done by finding the first thread in the list
// that has a valid exception.
- const size_t num_threads = m_threads.size();
- size_t idx;
- for (idx = 0; idx < num_threads; ++idx)
+ const uint32_t num_threads = m_threads.size();
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
{
- MachThread *thread = m_threads[idx].get();
- if (thread->GetStopException().IsValid())
+ if (m_threads[idx]->GetStopException().IsValid())
{
m_current_thread = m_threads[idx];
break;
}
}
}
- threadSP = m_current_thread;
-}
-
-void
-MachThreadList::GetRegisterState(int flavor, bool force)
-{
- uint32_t idx = 0;
- const uint32_t num_threads = m_threads.size();
- for (idx = 0; idx < num_threads; ++idx)
- {
- m_threads[idx]->GetRegisterState(flavor, force);
- }
-}
-
-void
-MachThreadList::SetRegisterState(int flavor)
-{
- uint32_t idx = 0;
- const uint32_t num_threads = m_threads.size();
- for (idx = 0; idx < num_threads; ++idx)
- {
- m_threads[idx]->SetRegisterState(flavor);
- }
+ thread_sp = m_current_thread;
}
void
MachThreadList::Dump() const
{
- uint32_t idx = 0;
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
const uint32_t num_threads = m_threads.size();
- for (idx = 0; idx < num_threads; ++idx)
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
{
m_threads[idx]->Dump(idx);
}
@@ -351,10 +309,9 @@
void
MachThreadList::ProcessWillResume(MachProcess *process, const DNBThreadResumeActions &thread_actions)
{
- uint32_t idx = 0;
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
const uint32_t num_threads = m_threads.size();
-
- for (idx = 0; idx < num_threads; ++idx)
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
{
MachThread *thread = m_threads[idx].get();
@@ -368,10 +325,10 @@
uint32_t
MachThreadList::ProcessDidStop(MachProcess *process)
{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
// Update our thread list
const uint32_t num_threads = UpdateThreadList(process, true);
- uint32_t idx = 0;
- for (idx = 0; idx < num_threads; ++idx)
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
{
m_threads[idx]->ThreadDidStop();
}
@@ -392,10 +349,10 @@
bool
MachThreadList::ShouldStop(bool &step_more)
{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
uint32_t should_stop = false;
const uint32_t num_threads = m_threads.size();
- uint32_t idx = 0;
- for (idx = 0; !should_stop && idx < num_threads; ++idx)
+ for (uint32_t idx = 0; !should_stop && idx < num_threads; ++idx)
{
should_stop = m_threads[idx]->ShouldStop(step_more);
}
@@ -406,9 +363,9 @@
void
MachThreadList::NotifyBreakpointChanged (const DNBBreakpoint *bp)
{
- uint32_t idx = 0;
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
const uint32_t num_threads = m_threads.size();
- for (idx = 0; idx < num_threads; ++idx)
+ for (uint32_t idx = 0; idx < num_threads; ++idx)
{
m_threads[idx]->NotifyBreakpointChanged(bp);
}
@@ -420,9 +377,9 @@
{
if (bp != NULL)
{
- uint32_t idx = GetThreadIndexByID(bp->ThreadID());
- if (idx < m_threads.size())
- return m_threads[idx]->EnableHardwareBreakpoint(bp);
+ MachThreadSP thread_sp (GetThreadByID (bp->ThreadID()));
+ if (thread_sp)
+ return thread_sp->EnableHardwareBreakpoint(bp);
}
return INVALID_NUB_HW_INDEX;
}
@@ -432,9 +389,9 @@
{
if (bp != NULL)
{
- uint32_t idx = GetThreadIndexByID(bp->ThreadID());
- if (idx < m_threads.size())
- return m_threads[idx]->DisableHardwareBreakpoint(bp);
+ MachThreadSP thread_sp (GetThreadByID (bp->ThreadID()));
+ if (thread_sp)
+ return thread_sp->DisableHardwareBreakpoint(bp);
}
return false;
}
@@ -444,9 +401,9 @@
{
if (wp != NULL)
{
- uint32_t idx = GetThreadIndexByID(wp->ThreadID());
- if (idx < m_threads.size())
- return m_threads[idx]->EnableHardwareWatchpoint(wp);
+ MachThreadSP thread_sp (GetThreadByID (wp->ThreadID()));
+ if (thread_sp)
+ return thread_sp->EnableHardwareWatchpoint(wp);
}
return INVALID_NUB_HW_INDEX;
}
@@ -456,9 +413,9 @@
{
if (wp != NULL)
{
- uint32_t idx = GetThreadIndexByID(wp->ThreadID());
- if (idx < m_threads.size())
- return m_threads[idx]->DisableHardwareWatchpoint(wp);
+ MachThreadSP thread_sp (GetThreadByID (wp->ThreadID()));
+ if (thread_sp)
+ return thread_sp->DisableHardwareWatchpoint(wp);
}
return false;
}
@@ -466,10 +423,10 @@
uint32_t
MachThreadList::GetThreadIndexForThreadStoppedWithSignal (const int signo) const
{
+ PTHREAD_MUTEX_LOCKER (locker, m_threads_mutex);
uint32_t should_stop = false;
const uint32_t num_threads = m_threads.size();
- uint32_t idx = 0;
- for (idx = 0; !should_stop && idx < num_threads; ++idx)
+ for (uint32_t idx = 0; !should_stop && idx < num_threads; ++idx)
{
if (m_threads[idx]->GetStopException().SoftSignal () == signo)
return idx;
Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/MachThreadList.h Wed Jan 19 01:54:15 2011
@@ -26,8 +26,6 @@
void Clear ();
void Dump () const;
- void GetRegisterState (int flavor, bool force);
- void SetRegisterState (int flavor);
bool GetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, DNBRegisterValue *reg_value) const;
bool SetRegisterValue (nub_thread_t tid, uint32_t reg_set_idx, uint32_t reg_idx, const DNBRegisterValue *reg_value) const;
nub_size_t GetRegisterContext (nub_thread_t tid, void *buf, size_t buf_len);
@@ -46,7 +44,6 @@
nub_size_t NumThreads () const;
nub_thread_t ThreadIDAtIndex (nub_size_t idx) const;
nub_thread_t CurrentThreadID ();
- uint32_t GetThreadIndexByID (thread_t tid) const;
void CurrentThread (MachThreadSP& threadSP);
void NotifyBreakpointChanged (const DNBBreakpoint *bp);
uint32_t EnableHardwareBreakpoint (const DNBBreakpoint *bp) const;
@@ -55,7 +52,7 @@
bool DisableHardwareWatchpoint (const DNBBreakpoint *wp) const;
uint32_t GetThreadIndexForThreadStoppedWithSignal (const int signo) const;
- MachThread * GetThreadByID (nub_thread_t tid) const;
+ MachThreadSP GetThreadByID (nub_thread_t tid) const;
protected:
typedef std::vector<MachThreadSP> collection;
@@ -66,7 +63,7 @@
// const_iterator FindThreadByID (thread_t tid) const;
collection m_threads;
- PThreadMutex m_threads_mutex;
+ mutable PThreadMutex m_threads_mutex;
MachThreadSP m_current_thread;
};
Modified: lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp (original)
+++ lldb/trunk/tools/debugserver/source/MacOSX/x86_64/DNBArchImplX86_64.cpp Wed Jan 19 01:54:15 2011
@@ -19,6 +19,7 @@
#include "DNBLog.h"
#include "MachThread.h"
#include "MachProcess.h"
+#include <mach/mach.h>
uint64_t
DNBArchImplX86_64::GetPC(uint64_t failValue)
@@ -59,6 +60,9 @@
{
if (force || m_state.GetError(e_regSetGPR, Read))
{
+ kern_return_t kret = ::thread_abort_safely(m_thread->ThreadID());
+ DNBLogThreaded("thread = 0x%4.4x calling thread_abort_safely (tid) => %u (GetGPRState() for stop_count = %u)", m_thread->ThreadID(), kret, m_thread->Process()->StopCount());
+
#if DEBUG_GPR_VALUES
m_state.context.gpr.__rax = ('a' << 8) + 'x';
m_state.context.gpr.__rbx = ('b' << 8) + 'x';
@@ -247,6 +251,9 @@
kern_return_t
DNBArchImplX86_64::SetGPRState()
{
+ kern_return_t kret = ::thread_abort_safely(m_thread->ThreadID());
+ DNBLogThreaded("thread = 0x%4.4x calling thread_abort_safely (tid) => %u (SetGPRState() for stop_count = %u)", m_thread->ThreadID(), kret, m_thread->Process()->StopCount());
+
m_state.SetError(e_regSetGPR, Write, ::thread_set_state(m_thread->ThreadID(), x86_THREAD_STATE64, (thread_state_t)&m_state.context.gpr, x86_THREAD_STATE64_COUNT));
DNBLogThreadedIf (LOG_THREAD, "::thread_set_state (0x%4.4x, %u, &gpr, %u) => 0x%8.8x"
"\n\trax = %16.16llx rbx = %16.16llx rcx = %16.16llx rdx = %16.16llx"
Modified: lldb/trunk/tools/debugserver/source/RNBRemote.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/RNBRemote.cpp?rev=123815&r1=123814&r2=123815&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/RNBRemote.cpp (original)
+++ lldb/trunk/tools/debugserver/source/RNBRemote.cpp Wed Jan 19 01:54:15 2011
@@ -2894,8 +2894,8 @@
tid_cstr += strlen ("thread:");
tid = strtoul(tid_cstr, NULL, 16);
}
- DNBLogThreadedIf (LOG_RNB_PACKETS, "RNBRemote::ExtractThreadIDFromThreadSuffix(%s) got thread 0x%4.4x", p, tid);
}
+ return tid;
}
return GetCurrentThread();
More information about the lldb-commits
mailing list