Add a new SBThread::GetQueue() method to get the queue that is

currently associated with a given thread, on relevant targets.

Change the queue detection code to verify that the queues 
associated with all live threads are included in the list.
<rdar://problem/16411314> 

llvm-svn: 207160
This commit is contained in:
Jason Molenda
2014-04-25 00:01:15 +00:00
parent 5ad11841f7
commit b9ffa98cab
11 changed files with 113 additions and 23 deletions

View File

@@ -23,6 +23,7 @@
#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Queue.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Target/StopInfo.h"
@@ -88,6 +89,42 @@ SBThread::~SBThread()
{
}
lldb::SBQueue
SBThread::GetQueue () const
{
SBQueue sb_queue;
QueueSP queue_sp;
Mutex::Locker api_locker;
ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (exe_ctx.HasThreadScope())
{
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
queue_sp = exe_ctx.GetThreadPtr()->GetQueue();
if (queue_sp)
{
sb_queue.SetQueue (queue_sp);
}
}
else
{
if (log)
log->Printf ("SBThread(%p)::GetQueueKind() => error: process is running",
static_cast<void*>(exe_ctx.GetThreadPtr()));
}
}
if (log)
log->Printf ("SBThread(%p)::GetQueueKind () => SBQueue(%p)",
static_cast<void*>(exe_ctx.GetThreadPtr()), static_cast<void*>(queue_sp.get()));
return sb_queue;
}
bool
SBThread::IsValid() const
{