summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2019-10-03 22:50:18 +0000
committerJim Ingham <jingham@apple.com>2019-10-03 22:50:18 +0000
commit27a14f19c810f494adddb8aaff960336ab4492e7 (patch)
treea7eae222175b77917ee9ccfd1b0f21555d7118f4 /lldb/source/Target
parent145cdad11925194ec41949b5c8f0cb037f9e7941 (diff)
downloadbcm5719-llvm-27a14f19c810f494adddb8aaff960336ab4492e7.tar.gz
bcm5719-llvm-27a14f19c810f494adddb8aaff960336ab4492e7.zip
Pass an SBStructuredData to scripted ThreadPlans on use.
This will allow us to write reusable scripted ThreadPlans, since you can use key/value pairs with known keys in the plan to parametrize its behavior. Differential Revision: https://reviews.llvm.org/D68366 llvm-svn: 373675
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Thread.cpp14
-rw-r--r--lldb/source/Target/ThreadPlanPython.cpp8
2 files changed, 17 insertions, 5 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index ce4c4aa4bc0..be6150630c3 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Debugger.h"
#include "lldb/Core/FormatEntity.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Core/ValueObject.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
@@ -1482,9 +1483,18 @@ ThreadPlanSP Thread::QueueThreadPlanForStepUntil(
}
lldb::ThreadPlanSP Thread::QueueThreadPlanForStepScripted(
- bool abort_other_plans, const char *class_name, bool stop_other_threads,
+ bool abort_other_plans, const char *class_name,
+ StructuredData::ObjectSP extra_args_sp, bool stop_other_threads,
Status &status) {
- ThreadPlanSP thread_plan_sp(new ThreadPlanPython(*this, class_name));
+
+ StructuredDataImpl *extra_args_impl = nullptr;
+ if (extra_args_sp) {
+ extra_args_impl = new StructuredDataImpl();
+ extra_args_impl->SetObjectSP(extra_args_sp);
+ }
+
+ ThreadPlanSP thread_plan_sp(new ThreadPlanPython(*this, class_name,
+ extra_args_impl));
status = QueueThreadPlan(thread_plan_sp, abort_other_plans);
return thread_plan_sp;
diff --git a/lldb/source/Target/ThreadPlanPython.cpp b/lldb/source/Target/ThreadPlanPython.cpp
index ff57e0a25ff..df432a0af3d 100644
--- a/lldb/source/Target/ThreadPlanPython.cpp
+++ b/lldb/source/Target/ThreadPlanPython.cpp
@@ -25,10 +25,11 @@ using namespace lldb_private;
// ThreadPlanPython
-ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name)
+ThreadPlanPython::ThreadPlanPython(Thread &thread, const char *class_name,
+ StructuredDataImpl *args_data)
: ThreadPlan(ThreadPlan::eKindPython, "Python based Thread Plan", thread,
eVoteNoOpinion, eVoteNoOpinion),
- m_class_name(class_name), m_did_push(false) {
+ m_class_name(class_name), m_args_data(args_data), m_did_push(false) {
SetIsMasterPlan(true);
SetOkayToDiscard(true);
SetPrivate(false);
@@ -65,7 +66,8 @@ void ThreadPlanPython::DidPush() {
.GetScriptInterpreter();
if (script_interp) {
m_implementation_sp = script_interp->CreateScriptedThreadPlan(
- m_class_name.c_str(), m_error_str, this->shared_from_this());
+ m_class_name.c_str(), m_args_data, m_error_str,
+ this->shared_from_this());
}
}
}
OpenPOWER on IntegriCloud