diff options
Diffstat (limited to 'lldb/source/Plugins')
4 files changed, 55 insertions, 9 deletions
diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp index bb8d312fdac..521136295fd 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryThread.cpp +++ b/lldb/source/Plugins/Process/Utility/HistoryThread.cpp @@ -34,7 +34,8 @@ HistoryThread::HistoryThread (lldb_private::Process &process, m_extended_unwind_token (LLDB_INVALID_ADDRESS), m_queue_name (), m_thread_name (), - m_originating_unique_thread_id (tid) + m_originating_unique_thread_id (tid), + m_queue_id (LLDB_INVALID_QUEUE_ID) { m_unwinder_ap.reset (new HistoryUnwind (*this, pcs, stop_id, stop_id_is_valid)); Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); diff --git a/lldb/source/Plugins/Process/Utility/HistoryThread.h b/lldb/source/Plugins/Process/Utility/HistoryThread.h index e6f46e27237..01fdd160870 100644 --- a/lldb/source/Plugins/Process/Utility/HistoryThread.h +++ b/lldb/source/Plugins/Process/Utility/HistoryThread.h @@ -65,6 +65,18 @@ public: m_queue_name = name; } + lldb::queue_id_t + GetQueueID () + { + return m_queue_id; + } + + void + SetQueueID (lldb::queue_id_t queue) + { + m_queue_id = queue; + } + const char * GetThreadName () { @@ -94,6 +106,7 @@ protected: std::string m_queue_name; std::string m_thread_name; lldb::tid_t m_originating_unique_thread_id; + lldb::queue_id_t m_queue_id; }; } // namespace lldb_private diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp index 73f24550fb4..388264a2d95 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp @@ -198,7 +198,15 @@ SystemRuntimeMacOSX::ParseLdiHeaders () m_ldi_header.item_offsets.pthread_id = ldi_extractor.GetU16(&offset); m_ldi_header.item_offsets.enqueueing_thread_dispatch_queue_t = ldi_extractor.GetU16(&offset); m_ldi_header.item_offsets.enqueueing_thread_dispatch_block_ptr = ldi_extractor.GetU16(&offset); - + + if (ldi_header.GetByteSize () > offset) + { + m_ldi_header.item_offsets.queue_id_from_thread_info = ldi_extractor.GetU16(&offset); + } + else + { + m_ldi_header.item_offsets.queue_id_from_thread_info = 0xffff; + } } } } @@ -376,8 +384,28 @@ SystemRuntimeMacOSX::SetNewThreadExtendedBacktraceToken (ThreadSP original_threa } } +void +SystemRuntimeMacOSX::SetNewThreadQueueID (ThreadSP original_thread_sp, ThreadSP new_extended_thread_sp) +{ + queue_id_t queue_id = LLDB_INVALID_QUEUE_ID; + addr_t enqueued_item_ptr = GetThreadCreatorItem (original_thread_sp); + if (enqueued_item_ptr != LLDB_INVALID_ADDRESS && m_ldi_header.item_offsets.queue_id_from_thread_info != 0xffff) + { + Error error; + queue_id = m_process->ReadUnsignedIntegerFromMemory (enqueued_item_ptr + m_ldi_header.item_offsets.queue_id_from_thread_info, 8, LLDB_INVALID_QUEUE_ID, error); + if (!error.Success()) + queue_id = LLDB_INVALID_QUEUE_ID; + } + + if (queue_id != LLDB_INVALID_QUEUE_ID) + { + new_extended_thread_sp->SetQueueID (queue_id); + } +} + + lldb::tid_t -SystemRuntimeMacOSX::GetNewThreadUniquethreadID (ThreadSP original_thread_sp) +SystemRuntimeMacOSX::GetNewThreadUniqueThreadID (ThreadSP original_thread_sp) { tid_t ret = LLDB_INVALID_THREAD_ID; addr_t enqueued_item_ptr = GetThreadCreatorItem (original_thread_sp); @@ -404,14 +432,14 @@ SystemRuntimeMacOSX::GetExtendedBacktraceThread (ThreadSP original_thread_sp, Co if (bt.pcs.size() == 0) return new_extended_thread_sp; - tid_t unique_thread_id = GetNewThreadUniquethreadID (original_thread_sp); + tid_t unique_thread_id = GetNewThreadUniqueThreadID (original_thread_sp); new_extended_thread_sp.reset (new HistoryThread (*m_process, unique_thread_id, bt.pcs, bt.stop_id, bt.stop_id_is_valid)); - SetNewThreadThreadName(original_thread_sp, new_extended_thread_sp); - SetNewThreadQueueName(original_thread_sp, new_extended_thread_sp); - SetNewThreadExtendedBacktraceToken(original_thread_sp, new_extended_thread_sp); - + SetNewThreadThreadName (original_thread_sp, new_extended_thread_sp); + SetNewThreadQueueName (original_thread_sp, new_extended_thread_sp); + SetNewThreadQueueID (original_thread_sp, new_extended_thread_sp); + SetNewThreadExtendedBacktraceToken (original_thread_sp, new_extended_thread_sp); return new_extended_thread_sp; } diff --git a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h index 24029d78996..c472bee8572 100644 --- a/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h +++ b/lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.h @@ -126,7 +126,7 @@ private: GetThreadCreatorItem (lldb::ThreadSP thread); lldb::tid_t - GetNewThreadUniquethreadID (lldb::ThreadSP original_thread_sp); + GetNewThreadUniqueThreadID (lldb::ThreadSP original_thread_sp); void SetNewThreadThreadName (lldb::ThreadSP original_thread_sp, lldb::ThreadSP new_extended_thread_sp); @@ -137,6 +137,9 @@ private: void SetNewThreadExtendedBacktraceToken (lldb::ThreadSP original_thread_sp, lldb::ThreadSP new_extended_thread_sp); + void + SetNewThreadQueueID (lldb::ThreadSP original_thread_sp, lldb::ThreadSP new_extended_thread_sp); + struct ldi_queue_offsets { uint16_t next; uint16_t prev; @@ -158,6 +161,7 @@ private: uint16_t pthread_id; uint16_t enqueueing_thread_dispatch_queue_t; uint16_t enqueueing_thread_dispatch_block_ptr; + uint16_t queue_id_from_thread_info; }; struct ldi_header { |