diff options
Diffstat (limited to 'lldb/source/API/SBBreakpointName.cpp')
-rw-r--r-- | lldb/source/API/SBBreakpointName.cpp | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/lldb/source/API/SBBreakpointName.cpp b/lldb/source/API/SBBreakpointName.cpp index 1c794fca8ca5..5bd7732ebb60 100644 --- a/lldb/source/API/SBBreakpointName.cpp +++ b/lldb/source/API/SBBreakpointName.cpp @@ -12,11 +12,13 @@ #include "lldb/API/SBError.h" #include "lldb/API/SBStream.h" #include "lldb/API/SBStringList.h" +#include "lldb/API/SBStructuredData.h" #include "lldb/API/SBTarget.h" #include "lldb/Breakpoint/BreakpointName.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/Debugger.h" +#include "lldb/Core/StructuredDataImpl.h" #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/ScriptInterpreter.h" #include "lldb/Target/Target.h" @@ -565,24 +567,41 @@ void SBBreakpointName::SetCallback(SBBreakpointHitCallback callback, } void SBBreakpointName::SetScriptCallbackFunction( - const char *callback_function_name) { - LLDB_RECORD_METHOD(void, SBBreakpointName, SetScriptCallbackFunction, - (const char *), callback_function_name); - + const char *callback_function_name) { +LLDB_RECORD_METHOD(void, SBBreakpointName, SetScriptCallbackFunction, + (const char *), callback_function_name); + SBStructuredData empty_args; + SetScriptCallbackFunction(callback_function_name, empty_args); +} + +SBError SBBreakpointName::SetScriptCallbackFunction( + const char *callback_function_name, + SBStructuredData &extra_args) { + LLDB_RECORD_METHOD(SBError, SBBreakpointName, SetScriptCallbackFunction, + (const char *, SBStructuredData &), + callback_function_name, extra_args); + SBError sb_error; BreakpointName *bp_name = GetBreakpointName(); - if (!bp_name) - return; + if (!bp_name) { + sb_error.SetErrorString("unrecognized breakpoint name"); + return LLDB_RECORD_RESULT(sb_error); + } std::lock_guard<std::recursive_mutex> guard( m_impl_up->GetTarget()->GetAPIMutex()); BreakpointOptions &bp_options = bp_name->GetOptions(); - m_impl_up->GetTarget() + Status error; + error = m_impl_up->GetTarget() ->GetDebugger() .GetScriptInterpreter() ->SetBreakpointCommandCallbackFunction(&bp_options, - callback_function_name); + callback_function_name, + extra_args.m_impl_up + ->GetObjectSP()); + sb_error.SetError(error); UpdateName(*bp_name); + return LLDB_RECORD_RESULT(sb_error); } SBError @@ -728,6 +747,8 @@ void RegisterMethods<SBBreakpointName>(Registry &R) { (lldb::SBStream &)); LLDB_REGISTER_METHOD(void, SBBreakpointName, SetScriptCallbackFunction, (const char *)); + LLDB_REGISTER_METHOD(SBError, SBBreakpointName, SetScriptCallbackFunction, + (const char *, SBStructuredData &)); LLDB_REGISTER_METHOD(lldb::SBError, SBBreakpointName, SetScriptCallbackBody, (const char *)); LLDB_REGISTER_METHOD_CONST(bool, SBBreakpointName, GetAllowList, ()); |