The Threads created when requesting extended backtraces need to be owned by

something; add a new ExtendedThreadList to Process where they can be retained
for the duration of a public stop.
<rdar://problem/15314068> 

llvm-svn: 194366
This commit is contained in:
Jason Molenda
2013-11-11 05:19:34 +00:00
parent a8b685cd7b
commit 7a2f7904bf
2 changed files with 25 additions and 7 deletions

View File

@@ -1295,16 +1295,22 @@ SBThread::GetExtendedBacktrace (const char *type)
Process::StopLocker stop_locker;
if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
{
ThreadSP real_thread(exe_ctx.GetThreadPtr());
ThreadSP real_thread(exe_ctx.GetThreadSP());
if (real_thread)
{
ConstString type_const (type);
SystemRuntime *runtime = exe_ctx.GetProcessPtr()->GetSystemRuntime();
if (runtime)
Process *process = exe_ctx.GetProcessPtr();
if (process)
{
ThreadSP origin_thread = runtime->GetExtendedBacktrace (real_thread, type_const);
if (origin_thread && origin_thread->IsValid())
sb_origin_thread.SetThread (origin_thread);
SystemRuntime *runtime = process->GetSystemRuntime();
if (runtime)
{
ThreadSP new_thread_sp (runtime->GetExtendedBacktrace (real_thread, type_const));
// Save this in the Process' ExtendedThreadList so a strong pointer retains the
// object.
process->GetExtendedThreadList().AddThread (new_thread_sp);
sb_origin_thread.SetThread (new_thread_sp);
}
}
}
}