forked from OSchip/llvm-project
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
This commit is contained in:
parent
568a833f68
commit
a8ff543c28
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/lldb-enumerations.h"
|
||||
#include "lldb/lldb-forward.h"
|
||||
|
||||
#include "lldb/Core/Address.h"
|
||||
#include "lldb/Core/ConstString.h"
|
||||
|
@ -213,6 +214,9 @@ public:
|
|||
m_target_queue_label = queue_name;
|
||||
}
|
||||
|
||||
lldb::ProcessSP
|
||||
GetProcessSP ();
|
||||
|
||||
protected:
|
||||
lldb::QueueWP m_queue_wp;
|
||||
lldb::QueueItemKind m_kind;
|
||||
|
|
|
@ -153,7 +153,25 @@ public:
|
|||
static const ThreadPropertiesSP &
|
||||
GetGlobalProperties();
|
||||
|
||||
Thread (Process &process, lldb::tid_t tid);
|
||||
//------------------------------------------------------------------
|
||||
/// Constructor
|
||||
///
|
||||
/// @param [in] process
|
||||
///
|
||||
/// @param [in] tid
|
||||
///
|
||||
/// @param [in] use_invalid_index_id
|
||||
/// Optional parameter, defaults to false. The only subclass that
|
||||
/// is likely to set use_invalid_index_id == true is the HistoryThread
|
||||
/// class. In that case, the Thread we are constructing represents
|
||||
/// a thread from earlier in the program execution. We may have the
|
||||
/// tid of the original thread that they represent but we don't want
|
||||
/// to reuse the IndexID of that thread, or create a new one. If a
|
||||
/// client wants to know the original thread's IndexID, they should use
|
||||
/// Thread::GetExtendedBacktraceOriginatingIndexID().
|
||||
//------------------------------------------------------------------
|
||||
Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id = false);
|
||||
|
||||
virtual ~Thread();
|
||||
|
||||
lldb::ProcessSP
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -20,12 +20,14 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
// Constructor
|
||||
|
||||
HistoryThread::HistoryThread (lldb_private::Process &process,
|
||||
lldb::tid_t tid,
|
||||
std::vector<lldb::addr_t> pcs,
|
||||
uint32_t stop_id,
|
||||
bool stop_id_is_valid) :
|
||||
Thread (process, tid),
|
||||
Thread (process, tid, true),
|
||||
m_framelist_mutex(),
|
||||
m_framelist(),
|
||||
m_pcs (pcs),
|
||||
|
@ -43,6 +45,8 @@ HistoryThread::HistoryThread (lldb_private::Process &process,
|
|||
log->Printf ("%p HistoryThread::HistoryThread", this);
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
||||
HistoryThread::~HistoryThread ()
|
||||
{
|
||||
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
// Constructor
|
||||
|
||||
HistoryUnwind::HistoryUnwind (Thread &thread,
|
||||
std::vector<lldb::addr_t> pcs,
|
||||
uint32_t stop_id,
|
||||
|
@ -31,6 +33,8 @@ HistoryUnwind::HistoryUnwind (Thread &thread,
|
|||
{
|
||||
}
|
||||
|
||||
// Destructor
|
||||
|
||||
HistoryUnwind::~HistoryUnwind ()
|
||||
{
|
||||
}
|
||||
|
|
|
@ -75,3 +75,15 @@ QueueItem::GetExtendedBacktraceThread (ConstString type)
|
|||
}
|
||||
return return_thread;
|
||||
}
|
||||
|
||||
ProcessSP
|
||||
QueueItem::GetProcessSP()
|
||||
{
|
||||
ProcessSP process_sp;
|
||||
QueueSP queue_sp = m_queue_wp.lock ();
|
||||
if (queue_sp)
|
||||
{
|
||||
process_sp = queue_sp->GetProcess();
|
||||
}
|
||||
return process_sp;
|
||||
}
|
||||
|
|
|
@ -250,14 +250,14 @@ Thread::GetStaticBroadcasterClass ()
|
|||
return class_name;
|
||||
}
|
||||
|
||||
Thread::Thread (Process &process, lldb::tid_t tid) :
|
||||
Thread::Thread (Process &process, lldb::tid_t tid, bool use_invalid_index_id) :
|
||||
ThreadProperties (false),
|
||||
UserID (tid),
|
||||
Broadcaster(&process.GetTarget().GetDebugger(), Thread::GetStaticBroadcasterClass().AsCString()),
|
||||
m_process_wp (process.shared_from_this()),
|
||||
m_stop_info_sp (),
|
||||
m_stop_info_stop_id (0),
|
||||
m_index_id (process.GetNextThreadIndexID(tid)),
|
||||
m_index_id (use_invalid_index_id ? LLDB_INVALID_INDEX32 : process.GetNextThreadIndexID(tid)),
|
||||
m_reg_context_sp (),
|
||||
m_state (eStateUnloaded),
|
||||
m_state_mutex (Mutex::eMutexTypeRecursive),
|
||||
|
|
Loading…
Reference in New Issue