summaryrefslogtreecommitdiffstats
path: root/contrib/llvm/tools/lldb/source/API/SBThread.cpp
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2015-02-06 22:25:21 +0000
committeremaste <emaste@FreeBSD.org>2015-02-06 22:25:21 +0000
commitfa0e7b41694bc598cd3df2405d0384ea29d7537e (patch)
tree5e5b6a0774e0d93bb4cfa2f9f83b9c41b38c4448 /contrib/llvm/tools/lldb/source/API/SBThread.cpp
parentd2b9c88b24f95cd9f8e7bd621cfa454ce759c687 (diff)
parent0c2019f4ca6b2dc6d710f6bb16a0e3ed10271531 (diff)
downloadFreeBSD-src-fa0e7b41694bc598cd3df2405d0384ea29d7537e.zip
FreeBSD-src-fa0e7b41694bc598cd3df2405d0384ea29d7537e.tar.gz
Update LLDB snapshot to upstream r225923 (git 2b588ecd)
Sponsored by: DARPA, AFRL
Diffstat (limited to 'contrib/llvm/tools/lldb/source/API/SBThread.cpp')
-rw-r--r--contrib/llvm/tools/lldb/source/API/SBThread.cpp105
1 files changed, 94 insertions, 11 deletions
diff --git a/contrib/llvm/tools/lldb/source/API/SBThread.cpp b/contrib/llvm/tools/lldb/source/API/SBThread.cpp
index a0bfa43..6524d10 100644
--- a/contrib/llvm/tools/lldb/source/API/SBThread.cpp
+++ b/contrib/llvm/tools/lldb/source/API/SBThread.cpp
@@ -41,6 +41,7 @@
#include "lldb/API/SBEvent.h"
#include "lldb/API/SBFrame.h"
#include "lldb/API/SBProcess.h"
+#include "lldb/API/SBThreadPlan.h"
#include "lldb/API/SBValue.h"
using namespace lldb;
@@ -194,6 +195,7 @@ SBThread::GetStopReasonDataCount ()
case eStopReasonExec:
case eStopReasonPlanComplete:
case eStopReasonThreadExiting:
+ case eStopReasonInstrumentation:
// There is no data for these stop reasons.
return 0;
@@ -254,6 +256,7 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
case eStopReasonExec:
case eStopReasonPlanComplete:
case eStopReasonThreadExiting:
+ case eStopReasonInstrumentation:
// There is no data for these stop reasons.
return 0;
@@ -305,6 +308,26 @@ SBThread::GetStopReasonDataAtIndex (uint32_t idx)
return 0;
}
+bool
+SBThread::GetStopReasonExtendedInfoAsJSON (lldb::SBStream &stream)
+{
+ Stream &strm = stream.ref();
+
+ ExecutionContext exe_ctx (m_opaque_sp.get());
+ if (! exe_ctx.HasThreadScope())
+ return false;
+
+
+ StopInfoSP stop_info = exe_ctx.GetThreadPtr()->GetStopInfo();
+ StructuredData::ObjectSP info = stop_info->GetExtendedInfo();
+ if (! info)
+ return false;
+
+ info->Dump(strm);
+
+ return true;
+}
+
size_t
SBThread::GetStopDescription (char *dst, size_t dst_len)
{
@@ -687,15 +710,11 @@ SBThread::ResumeNewPlan (ExecutionContext &exe_ctx, ThreadPlan *new_plan)
// Why do we need to set the current thread by ID here???
process->GetThreadList().SetSelectedThreadByID (thread->GetID());
- sb_error.ref() = process->Resume();
-
- if (sb_error.Success())
- {
- // If we are doing synchronous mode, then wait for the
- // process to stop yet again!
- if (process->GetTarget().GetDebugger().GetAsyncExecution () == false)
- process->WaitForProcessToStop (NULL);
- }
+
+ if (process->GetTarget().GetDebugger().GetAsyncExecution ())
+ sb_error.ref() = process->Resume ();
+ else
+ sb_error.ref() = process->ResumeSynchronous (NULL);
return sb_error;
}
@@ -918,7 +937,9 @@ SBThread::RunToAddress (lldb::addr_t addr)
Thread *thread = exe_ctx.GetThreadPtr();
- ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress (abort_other_plans, target_addr, stop_other_threads));
+ ThreadPlanSP new_plan_sp(thread->QueueThreadPlanForRunToAddress (abort_other_plans,
+ target_addr,
+ stop_other_threads));
// This returns an error, we should use it!
ResumeNewPlan (exe_ctx, new_plan_sp.get());
@@ -1073,6 +1094,46 @@ SBThread::StepOverUntil (lldb::SBFrame &sb_frame,
}
SBError
+SBThread::StepUsingScriptedThreadPlan (const char *script_class_name)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ SBError sb_error;
+
+ Mutex::Locker api_locker;
+ ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker);
+
+ if (log)
+ {
+ log->Printf ("SBThread(%p)::StepUsingScriptedThreadPlan: class name: %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ script_class_name);
+ }
+
+
+ if (!exe_ctx.HasThreadScope())
+ {
+ sb_error.SetErrorString("this SBThread object is invalid");
+ return sb_error;
+ }
+
+ Thread *thread = exe_ctx.GetThreadPtr();
+ ThreadPlanSP thread_plan_sp = thread->QueueThreadPlanForStepScripted(false, script_class_name, false);
+
+ if (thread_plan_sp)
+ sb_error = ResumeNewPlan(exe_ctx, thread_plan_sp.get());
+ else
+ {
+ sb_error.SetErrorStringWithFormat("Error queuing thread plan for class: %s.", script_class_name);
+ if (log)
+ log->Printf ("SBThread(%p)::StepUsingScriptedThreadPlan: Error queuing thread plan for class: %s",
+ static_cast<void*>(exe_ctx.GetThreadPtr()),
+ script_class_name);
+ }
+
+ return sb_error;
+}
+
+SBError
SBThread::JumpToLine (lldb::SBFileSpec &file_spec, uint32_t line)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -1473,7 +1534,8 @@ SBThread::GetExtendedBacktraceThread (const char *type)
const char *queue_name = new_thread_sp->GetQueueName();
if (queue_name == NULL)
queue_name = "";
- log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread created (%p) with queue_id 0x%" PRIx64 " queue name '%s'",
+ log->Printf ("SBThread(%p)::GetExtendedBacktraceThread() => new extended Thread "
+ "created (%p) with queue_id 0x%" PRIx64 " queue name '%s'",
static_cast<void*>(exe_ctx.GetThreadPtr()),
static_cast<void*>(new_thread_sp.get()),
new_thread_sp->GetQueueID(),
@@ -1515,3 +1577,24 @@ SBThread::SafeToCallFunctions ()
return thread_sp->SafeToCallFunctions();
return true;
}
+
+lldb_private::Thread *
+SBThread::operator->()
+{
+ ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
+ if (thread_sp)
+ return thread_sp.get();
+ else
+ return NULL;
+}
+
+lldb_private::Thread *
+SBThread::get()
+{
+ ThreadSP thread_sp(m_opaque_sp->GetThreadSP());
+ if (thread_sp)
+ return thread_sp.get();
+ else
+ return NULL;
+}
+
OpenPOWER on IntegriCloud