diff options
author | Jason Molenda <jmolenda@apple.com> | 2014-03-06 06:31:18 +0000 |
---|---|---|
committer | Jason Molenda <jmolenda@apple.com> | 2014-03-06 06:31:18 +0000 |
commit | a8ff543c280f9f2eee2fac4c5cdacd97b21ea1a1 (patch) | |
tree | fcc91283836c03a11857d4c0903f398c12451301 /lldb/source/API/SBQueueItem.cpp | |
parent | 568a833f68def7b1dddd4de06c0dd2a7510a0723 (diff) | |
download | bcm5719-llvm-a8ff543c280f9f2eee2fac4c5cdacd97b21ea1a1.tar.gz bcm5719-llvm-a8ff543c280f9f2eee2fac4c5cdacd97b21ea1a1.zip |
When a client asks for a queue pending item's extended backtrace,
hold a strong pointer to that extended backtrace thread in the Process
just like we do for asking a thread's extended backtrace.
Also, give extended backtrace threads an invalid ThreadIndexID number.
We'll still give them valid thread_id's. Clients who want to know the
original thread's IndexID can call GetExtendedBacktraceOriginatingIndexID().
<rdar://problem/16126034>
llvm-svn: 203088
Diffstat (limited to 'lldb/source/API/SBQueueItem.cpp')
-rw-r--r-- | lldb/source/API/SBQueueItem.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lldb/source/API/SBQueueItem.cpp b/lldb/source/API/SBQueueItem.cpp index 481d51e5542..5cc37da7990 100644 --- a/lldb/source/API/SBQueueItem.cpp +++ b/lldb/source/API/SBQueueItem.cpp @@ -14,6 +14,7 @@ #include "lldb/API/SBQueueItem.h" #include "lldb/API/SBThread.h" #include "lldb/Core/Address.h" +#include "lldb/Target/Process.h" #include "lldb/Target/QueueItem.h" #include "lldb/Target/Thread.h" @@ -108,12 +109,20 @@ SBQueueItem::GetExtendedBacktraceThread (const char *type) SBThread result; if (m_queue_item_sp) { - ThreadSP thread_sp; - ConstString type_const (type); - thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const); - if (thread_sp) + ProcessSP process_sp = m_queue_item_sp->GetProcessSP(); + Process::StopLocker stop_locker; + if (process_sp && stop_locker.TryLock(&process_sp->GetRunLock())) { - result.SetThread (thread_sp); + ThreadSP thread_sp; + ConstString type_const (type); + thread_sp = m_queue_item_sp->GetExtendedBacktraceThread (type_const); + if (thread_sp) + { + // Save this in the Process' ExtendedThreadList so a strong pointer retains the + // object + process_sp->GetExtendedThreadList().AddThread (thread_sp); + result.SetThread (thread_sp); + } } } return result; |