summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/API/SBQueue.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm/tools/lldb/source/API/SBQueue.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/API/SBQueue.cpp136
1 files changed, 110 insertions, 26 deletions
diff --git a/contrib/llvm/tools/lldb/source/API/SBQueue.cpp b/contrib/llvm/tools/lldb/source/API/SBQueue.cpp
index 8d67a48..b19ed72 100644
--- a/contrib/llvm/tools/lldb/source/API/SBQueue.cpp
+++ b/contrib/llvm/tools/lldb/source/API/SBQueue.cpp
@@ -9,10 +9,14 @@
#include "lldb/lldb-python.h"
+#include <inttypes.h>
+
#include "lldb/API/SBQueue.h"
#include "lldb/API/SBProcess.h"
#include "lldb/API/SBThread.h"
+#include "lldb/API/SBQueueItem.h"
+
#include "lldb/Core/Log.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/Queue.h"
@@ -96,7 +100,8 @@ namespace lldb_private
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64, this, result);
+ log->Printf ("SBQueue(%p)::GetQueueID () => 0x%" PRIx64,
+ static_cast<const void*>(this), result);
return result;
}
@@ -111,10 +116,11 @@ namespace lldb_private
}
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d", this, result);
+ log->Printf ("SBQueueImpl(%p)::GetIndexID () => %d",
+ static_cast<const void*>(this), result);
return result;
}
-
+
const char *
GetName () const
{
@@ -124,14 +130,16 @@ namespace lldb_private
{
name = queue_sp->GetName();
}
-
+
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBQueueImpl(%p)::GetName () => %s", this, name ? name : "NULL");
-
+ log->Printf ("SBQueueImpl(%p)::GetName () => %s",
+ static_cast<const void*>(this),
+ name ? name : "NULL");
+
return name;
}
-
+
void
FetchThreads ()
{
@@ -158,7 +166,7 @@ namespace lldb_private
}
}
}
-
+
void
FetchItems ()
{
@@ -185,12 +193,12 @@ namespace lldb_private
}
}
}
-
+
uint32_t
GetNumThreads ()
{
uint32_t result = 0;
-
+
FetchThreads();
if (m_thread_list_fetched)
{
@@ -198,12 +206,12 @@ namespace lldb_private
}
return result;
}
-
+
lldb::SBThread
GetThreadAtIndex (uint32_t idx)
{
FetchThreads();
-
+
SBThread sb_thread;
QueueSP queue_sp = m_queue_wp.lock();
if (queue_sp && idx < m_threads.size())
@@ -220,21 +228,24 @@ namespace lldb_private
}
return sb_thread;
}
-
-
+
uint32_t
GetNumPendingItems ()
{
uint32_t result = 0;
- FetchItems();
-
- if (m_pending_items_fetched)
+
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (m_pending_items_fetched == false && queue_sp)
+ {
+ result = queue_sp->GetNumPendingWorkItems();
+ }
+ else
{
result = m_pending_items.size();
}
return result;
}
-
+
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t idx)
{
@@ -246,7 +257,17 @@ namespace lldb_private
}
return result;
}
-
+
+ uint32_t
+ GetNumRunningItems ()
+ {
+ uint32_t result = 0;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ result = queue_sp->GetNumRunningWorkItems();
+ return result;
+ }
+
lldb::SBProcess
GetProcess ()
{
@@ -259,6 +280,17 @@ namespace lldb_private
return result;
}
+ lldb::QueueKind
+ GetKind ()
+ {
+ lldb::QueueKind kind = eQueueKindUnknown;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ kind = queue_sp->GetKind();
+
+ return kind;
+ }
+
private:
lldb::QueueWP m_queue_wp;
std::vector<lldb::ThreadWP> m_threads; // threads currently executing this queue's items
@@ -301,13 +333,21 @@ SBQueue::~SBQueue()
bool
SBQueue::IsValid() const
{
- return m_opaque_sp->IsValid();
+ bool is_valid = m_opaque_sp->IsValid ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::IsValid() == %s", m_opaque_sp->GetQueueID(),
+ is_valid ? "true" : "false");
+ return is_valid;
}
void
SBQueue::Clear ()
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::Clear()", m_opaque_sp->GetQueueID());
m_opaque_sp->Clear();
}
@@ -321,48 +361,92 @@ SBQueue::SetQueue (const QueueSP& queue_sp)
lldb::queue_id_t
SBQueue::GetQueueID () const
{
- return m_opaque_sp->GetQueueID ();
+ lldb::queue_id_t qid = m_opaque_sp->GetQueueID ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetQueueID() == 0x%" PRIx64, m_opaque_sp->GetQueueID(), (uint64_t) qid);
+ return qid;
}
uint32_t
SBQueue::GetIndexID () const
{
- return m_opaque_sp->GetIndexID ();
+ uint32_t index_id = m_opaque_sp->GetIndexID ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetIndexID() == 0x%" PRIx32, m_opaque_sp->GetQueueID(), index_id);
+ return index_id;
}
const char *
SBQueue::GetName () const
{
- return m_opaque_sp->GetName ();
+ const char *name = m_opaque_sp->GetName ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetName() == %s", m_opaque_sp->GetQueueID(),
+ name ? name : "");
+ return name;
}
uint32_t
SBQueue::GetNumThreads ()
{
- return m_opaque_sp->GetNumThreads ();
+ uint32_t numthreads = m_opaque_sp->GetNumThreads ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumThreads() == %d", m_opaque_sp->GetQueueID(), numthreads);
+ return numthreads;
}
SBThread
SBQueue::GetThreadAtIndex (uint32_t idx)
{
- return m_opaque_sp->GetThreadAtIndex (idx);
+ SBThread th = m_opaque_sp->GetThreadAtIndex (idx);
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetThreadAtIndex(%d)", m_opaque_sp->GetQueueID(), idx);
+ return th;
}
uint32_t
SBQueue::GetNumPendingItems ()
{
- return m_opaque_sp->GetNumPendingItems ();
+ uint32_t pending_items = m_opaque_sp->GetNumPendingItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumPendingItems() == %d", m_opaque_sp->GetQueueID(), pending_items);
+ return pending_items;
}
SBQueueItem
SBQueue::GetPendingItemAtIndex (uint32_t idx)
{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetPendingItemAtIndex(%d)", m_opaque_sp->GetQueueID(), idx);
return m_opaque_sp->GetPendingItemAtIndex (idx);
}
+uint32_t
+SBQueue::GetNumRunningItems ()
+{
+ uint32_t running_items = m_opaque_sp->GetNumRunningItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumRunningItems() == %d", m_opaque_sp->GetQueueID(), running_items);
+ return running_items;
+}
+
SBProcess
SBQueue::GetProcess ()
{
return m_opaque_sp->GetProcess();
}
+
+lldb::QueueKind
+SBQueue::GetKind ()
+{
+ return m_opaque_sp->GetKind();
+}
OpenPOWER on IntegriCloud