summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-10-21 23:52:54 +0000
committerJason Molenda <jmolenda@apple.com>2013-10-21 23:52:54 +0000
commit4fdb5863b93c73150eac3e708514b1b15f4300f4 (patch)
tree6a250084709426c991d1cfe1fc2d161def442be3
parent2fb40ce1dc6543cdd667dcdf9e0a933c88657aef (diff)
downloadbcm5719-llvm-4fdb5863b93c73150eac3e708514b1b15f4300f4.tar.gz
bcm5719-llvm-4fdb5863b93c73150eac3e708514b1b15f4300f4.zip
Expose the Thread::GetQueueID() method through the SBThread API, similar to
the existing SBThread::GetQueueName() method. llvm-svn: 193132
-rw-r--r--lldb/include/lldb/API/SBThread.h3
-rw-r--r--lldb/scripts/Python/interface/SBThread.i6
-rw-r--r--lldb/source/API/SBThread.cpp28
3 files changed, 37 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBThread.h b/lldb/include/lldb/API/SBThread.h
index 9da75ac1102..3d8770c8671 100644
--- a/lldb/include/lldb/API/SBThread.h
+++ b/lldb/include/lldb/API/SBThread.h
@@ -94,6 +94,9 @@ public:
const char *
GetQueueName() const;
+ lldb::queue_id_t
+ GetQueueID() const;
+
void
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
diff --git a/lldb/scripts/Python/interface/SBThread.i b/lldb/scripts/Python/interface/SBThread.i
index 484000496a9..15bb562c6cc 100644
--- a/lldb/scripts/Python/interface/SBThread.i
+++ b/lldb/scripts/Python/interface/SBThread.i
@@ -133,6 +133,9 @@ public:
const char *
GetQueueName() const;
+ lldb::queue_id_t
+ GetQueueID() const;
+
void
StepOver (lldb::RunMode stop_other_threads = lldb::eOnlyDuringStepping);
@@ -281,6 +284,9 @@ public:
__swig_getmethods__["queue"] = GetQueueName
if _newclass: queue = property(GetQueueName, None, doc='''A read only property that returns the dispatch queue name of this thread as a string.''')
+ __swig_getmethods__["queue_id"] = GetQueueID
+ if _newclass: queue = property(GetQueueID, None, doc='''A read only property that returns the dispatch queue id of this thread as an integer.''')
+
__swig_getmethods__["stop_reason"] = GetStopReason
if _newclass: stop_reason = property(GetStopReason, None, doc='''A read only property that returns an lldb enumeration value (see enumerations that start with "lldb.eStopReason") that represents the reason this thread stopped.''')
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index ceaaa34b2bb..0c3a17e0df8 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -507,6 +507,34 @@ SBThread::GetQueueName () const
return name;
}
+lldb::queue_id_t
+SBThread::GetQueueID () const
+{
+ queue_id_t id = LLDB_INVALID_QUEUE_ID;
+ 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()))
+ {
+ id = exe_ctx.GetThreadPtr()->GetQueueID();
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueID() => error: process is running", exe_ctx.GetThreadPtr());
+ }
+ }
+
+ if (log)
+ log->Printf ("SBThread(%p)::GetQueueID () => 0x%" PRIx64, exe_ctx.GetThreadPtr(), id);
+
+ return id;
+}
+
SBError
SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan)
{
OpenPOWER on IntegriCloud