summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBThread.cpp
diff options
context:
space:
mode:
authorJason Molenda <jmolenda@apple.com>2013-11-06 00:04:44 +0000
committerJason Molenda <jmolenda@apple.com>2013-11-06 00:04:44 +0000
commit5dd4916f63f9820244d9fdd8d4bdd0f884f0e766 (patch)
treed80234e1dc1c4414a27f8b35b8474a184f00b985 /lldb/source/API/SBThread.cpp
parent7e77a294dc420cbf16cefa5775bbf1070991f582 (diff)
downloadbcm5719-llvm-5dd4916f63f9820244d9fdd8d4bdd0f884f0e766.tar.gz
bcm5719-llvm-5dd4916f63f9820244d9fdd8d4bdd0f884f0e766.zip
Add a new GetThreadOriginExtendedBacktrace method to the
SystemRuntime and SBThread classes. <rdar://problem/15314369> llvm-svn: 194111
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
-rw-r--r--lldb/source/API/SBThread.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 0c3a17e0df8..8a7877d39c9 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -20,6 +20,7 @@
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Target/SystemRuntime.h"
#include "lldb/Target/Thread.h"
#include "lldb/Target/Process.h"
#include "lldb/Symbol/SymbolContext.h"
@@ -1280,3 +1281,38 @@ SBThread::GetDescription (SBStream &description) const
return true;
}
+
+SBThread
+SBThread::GetThreadOriginExtendedBacktrace (const char *type)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+ SBThread sb_origin_thread;
+
+ if (exe_ctx.HasThreadScope())
+ {
+ Process::StopLocker stop_locker;
+ if (stop_locker.TryLock(&exe_ctx.GetProcessPtr()->GetRunLock()))
+ {
+ ThreadSP real_thread(exe_ctx.GetThreadPtr());
+ if (real_thread)
+ {
+ ConstString type_const (type);
+ SystemRuntime *runtime = exe_ctx.GetProcessPtr()->GetSystemRuntime();
+ if (runtime)
+ {
+ ThreadSP origin_thread = runtime->GetThreadOriginExtendedBacktrace (real_thread, type_const);
+ sb_origin_thread.SetThread (origin_thread);
+ }
+ }
+ }
+ else
+ {
+ if (log)
+ log->Printf ("SBThread(%p)::GetThreadOriginExtendedBacktrace() => error: process is running", exe_ctx.GetThreadPtr());
+ }
+ }
+
+ return sb_origin_thread;
+}
OpenPOWER on IntegriCloud