summaryrefslogtreecommitdiff
path: root/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-12-25 22:30:44 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-12-25 22:30:44 +0000
commit77fc4c146f0870ffb09c1afb823ccbe742c5e6ff (patch)
tree5c0eb39553003b9c75a901af6bc4ddabd6f2f28c /lldb/source/Breakpoint/BreakpointResolverScripted.cpp
parentf65dcba83ce5035ab88a85fe17628b447eb56e1b (diff)
Vendor import of llvm-project main llvmorg-14-init-13186-g0c553cc1af2e.vendor/llvm-project/llvmorg-14-init-13186-g0c553cc1af2e
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointResolverScripted.cpp')
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverScripted.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
index 92297fbc7c4b..308c3b987f58 100644
--- a/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverScripted.cpp
@@ -27,10 +27,9 @@ using namespace lldb_private;
// BreakpointResolverScripted:
BreakpointResolverScripted::BreakpointResolverScripted(
const BreakpointSP &bkpt, const llvm::StringRef class_name,
- lldb::SearchDepth depth, StructuredDataImpl *args_data)
+ lldb::SearchDepth depth, const StructuredDataImpl &args_data)
: BreakpointResolver(bkpt, BreakpointResolver::PythonResolver),
- m_class_name(std::string(class_name)), m_depth(depth),
- m_args_ptr(args_data) {
+ m_class_name(std::string(class_name)), m_depth(depth), m_args(args_data) {
CreateImplementationIfNeeded(bkpt);
}
@@ -52,7 +51,7 @@ void BreakpointResolverScripted::CreateImplementationIfNeeded(
return;
m_implementation_sp = script_interp->CreateScriptedBreakpointResolver(
- m_class_name.c_str(), m_args_ptr, breakpoint_sp);
+ m_class_name.c_str(), m_args, breakpoint_sp);
}
void BreakpointResolverScripted::NotifyBreakpointSet() {
@@ -75,14 +74,12 @@ BreakpointResolverScripted::CreateFromStructuredData(
// The Python function will actually provide the search depth, this is a
// placeholder.
lldb::SearchDepth depth = lldb::eSearchDepthTarget;
-
- StructuredDataImpl *args_data_impl = new StructuredDataImpl();
+
+ StructuredDataImpl args_data_impl;
StructuredData::Dictionary *args_dict = nullptr;
- success = options_dict.GetValueForKeyAsDictionary(
- GetKey(OptionNames::ScriptArgs), args_dict);
- if (success) {
- args_data_impl->SetObjectSP(args_dict->shared_from_this());
- }
+ if (options_dict.GetValueForKeyAsDictionary(GetKey(OptionNames::ScriptArgs),
+ args_dict))
+ args_data_impl.SetObjectSP(args_dict->shared_from_this());
return new BreakpointResolverScripted(bkpt, class_name, depth,
args_data_impl);
}
@@ -94,9 +91,9 @@ BreakpointResolverScripted::SerializeToStructuredData() {
options_dict_sp->AddStringItem(GetKey(OptionNames::PythonClassName),
m_class_name);
- if (m_args_ptr->IsValid())
- options_dict_sp->AddItem(GetKey(OptionNames::ScriptArgs),
- m_args_ptr->GetObjectSP());
+ if (m_args.IsValid())
+ options_dict_sp->AddItem(GetKey(OptionNames::ScriptArgs),
+ m_args.GetObjectSP());
return WrapOptionsDict(options_dict_sp);
}
@@ -151,10 +148,6 @@ void BreakpointResolverScripted::Dump(Stream *s) const {}
lldb::BreakpointResolverSP
BreakpointResolverScripted::CopyForBreakpoint(BreakpointSP &breakpoint) {
- // FIXME: Have to make a copy of the arguments from the m_args_ptr and then
- // pass that to the new resolver.
- lldb::BreakpointResolverSP ret_sp(
- new BreakpointResolverScripted(breakpoint, m_class_name, m_depth,
- nullptr));
- return ret_sp;
+ return std::make_shared<BreakpointResolverScripted>(breakpoint, m_class_name,
+ m_depth, m_args);
}