summaryrefslogtreecommitdiffstats
path: root/lldb/source/API/SBTarget.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2018-09-13 21:35:32 +0000
committerJim Ingham <jingham@apple.com>2018-09-13 21:35:32 +0000
commit3815e702e751efb14188c0f0beeb10e343d8f053 (patch)
tree26247d7b8a0c3b3df344225d770ef7e6d553419c /lldb/source/API/SBTarget.cpp
parentd2316d756e2f3827ec662aee05d786d039b3d568 (diff)
downloadbcm5719-llvm-3815e702e751efb14188c0f0beeb10e343d8f053.tar.gz
bcm5719-llvm-3815e702e751efb14188c0f0beeb10e343d8f053.zip
Add a "scripted" breakpoint type to lldb.
This change allows you to write a new breakpoint type where the logic for setting breakpoints is determined by a Python callback written using the SB API's. Differential Revision: https://reviews.llvm.org/D51830 llvm-svn: 342185
Diffstat (limited to 'lldb/source/API/SBTarget.cpp')
-rw-r--r--lldb/source/API/SBTarget.cpp38
1 files changed, 37 insertions, 1 deletions
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index b143d6ccdff..4d2417c711b 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -1044,7 +1044,7 @@ SBTarget::BreakpointCreateForException(lldb::LanguageType language,
}
if (log)
- log->Printf("SBTarget(%p)::BreakpointCreateByRegex (Language: %s, catch: "
+ log->Printf("SBTarget(%p)::BreakpointCreateForException (Language: %s, catch: "
"%s throw: %s) => SBBreakpoint(%p)",
static_cast<void *>(target_sp.get()),
Language::GetNameForLanguageType(language),
@@ -1054,6 +1054,42 @@ SBTarget::BreakpointCreateForException(lldb::LanguageType language,
return sb_bp;
}
+lldb::SBBreakpoint
+SBTarget::BreakpointCreateFromScript(const char *class_name,
+ SBStructuredData &extra_args,
+ const SBFileSpecList &module_list,
+ const SBFileSpecList &file_list,
+ bool request_hardware)
+{
+ Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API));
+
+ SBBreakpoint sb_bp;
+ TargetSP target_sp(GetSP());
+ if (target_sp) {
+ std::lock_guard<std::recursive_mutex> guard(target_sp->GetAPIMutex());
+ Status error;
+
+ StructuredData::ObjectSP obj_sp = extra_args.m_impl_up->GetObjectSP();
+ sb_bp =
+ target_sp->CreateScriptedBreakpoint(class_name,
+ module_list.get(),
+ file_list.get(),
+ false, /* internal */
+ request_hardware,
+ obj_sp,
+ &error);
+ }
+ if (log)
+ log->Printf("SBTarget(%p)::BreakpointCreateFromScript (class name: %s) "
+ " => SBBreakpoint(%p)",
+ static_cast<void *>(target_sp.get()),
+ class_name,
+ static_cast<void *>(sb_bp.GetSP().get()));
+
+ return sb_bp;
+}
+
+
uint32_t SBTarget::GetNumBreakpoints() const {
TargetSP target_sp(GetSP());
if (target_sp) {
OpenPOWER on IntegriCloud