diff options
author | Jim Ingham <jingham@apple.com> | 2014-08-29 17:34:17 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2014-08-29 17:34:17 +0000 |
commit | b5796cb40e6f7a5e504d8da41d0f31d4539d7110 (patch) | |
tree | dc2a15b5074282ded8d7907e54b42676ed35e07d /lldb/source/Interpreter | |
parent | 09366de7a3d183071400c175cb5cf7ddc2321358 (diff) | |
download | bcm5719-llvm-b5796cb40e6f7a5e504d8da41d0f31d4539d7110.tar.gz bcm5719-llvm-b5796cb40e6f7a5e504d8da41d0f31d4539d7110.zip |
Allow "breakpoint command add" to add commands to more than one breakpoint at a time.
<rdar://problem/13314462>
llvm-svn: 216747
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreter.cpp | 26 | ||||
-rw-r--r-- | lldb/source/Interpreter/ScriptInterpreterPython.cpp | 42 |
2 files changed, 48 insertions, 20 deletions
diff --git a/lldb/source/Interpreter/ScriptInterpreter.cpp b/lldb/source/Interpreter/ScriptInterpreter.cpp index 561e881ac3b..b6c46f83bd9 100644 --- a/lldb/source/Interpreter/ScriptInterpreter.cpp +++ b/lldb/source/Interpreter/ScriptInterpreter.cpp @@ -44,7 +44,7 @@ ScriptInterpreter::GetCommandInterpreter () void ScriptInterpreter::CollectDataForBreakpointCommandCallback ( - BreakpointOptions *bp_options, + std::vector<BreakpointOptions *> &bp_options_vec, CommandReturnObject &result ) { @@ -81,6 +81,30 @@ ScriptInterpreter::LanguageToString (lldb::ScriptLanguage language) return return_value; } +Error +ScriptInterpreter::SetBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec, + const char *callback_text) +{ + Error return_error; + for (BreakpointOptions *bp_options : bp_options_vec) + { + return_error = SetBreakpointCommandCallback(bp_options, callback_text); + if (return_error.Success()) + break; + } + return return_error; +} + +void +ScriptInterpreter::SetBreakpointCommandCallbackFunction (std::vector<BreakpointOptions *> &bp_options_vec, + const char *function_name) +{ + for (BreakpointOptions *bp_options : bp_options_vec) + { + SetBreakpointCommandCallbackFunction(bp_options, function_name); + } +} + std::unique_ptr<ScriptInterpreterLocker> ScriptInterpreter::AcquireInterpreterLock () { diff --git a/lldb/source/Interpreter/ScriptInterpreterPython.cpp b/lldb/source/Interpreter/ScriptInterpreterPython.cpp index dd5ee748938..1b24fea7c21 100644 --- a/lldb/source/Interpreter/ScriptInterpreterPython.cpp +++ b/lldb/source/Interpreter/ScriptInterpreterPython.cpp @@ -256,24 +256,30 @@ ScriptInterpreterPython::IOHandlerInputComplete (IOHandler &io_handler, std::str break; case eIOHandlerBreakpoint: { - BreakpointOptions *bp_options = (BreakpointOptions *)io_handler.GetUserData(); - std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData()); - if (data_ap.get()) + std::vector<BreakpointOptions *> *bp_options_vec = (std::vector<BreakpointOptions *> *)io_handler.GetUserData(); + for (auto bp_options : *bp_options_vec) { - data_ap->user_source.SplitIntoLines(data); - - if (GenerateBreakpointCommandCallbackData (data_ap->user_source, data_ap->script_source).Success()) - { - BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release())); - bp_options->SetCallback (ScriptInterpreterPython::BreakpointCallbackFunction, baton_sp); - } - else if (!batch_mode) + if (!bp_options) + continue; + + std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData()); + if (data_ap.get()) { - StreamFileSP error_sp = io_handler.GetErrorStreamFile(); - if (error_sp) + data_ap->user_source.SplitIntoLines(data); + + if (GenerateBreakpointCommandCallbackData (data_ap->user_source, data_ap->script_source).Success()) { - error_sp->Printf ("Warning: No command attached to breakpoint.\n"); - error_sp->Flush(); + BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release())); + bp_options->SetCallback (ScriptInterpreterPython::BreakpointCallbackFunction, baton_sp); + } + else if (!batch_mode) + { + StreamFileSP error_sp = io_handler.GetErrorStreamFile(); + if (error_sp) + { + error_sp->Printf ("Warning: No command attached to breakpoint.\n"); + error_sp->Flush(); + } } } } @@ -307,8 +313,6 @@ ScriptInterpreterPython::IOHandlerInputComplete (IOHandler &io_handler, std::str } break; } - - } @@ -1087,11 +1091,11 @@ ScriptInterpreterPython::ExecuteMultipleLines (const char *in_string, const Exec void -ScriptInterpreterPython::CollectDataForBreakpointCommandCallback (BreakpointOptions *bp_options, +ScriptInterpreterPython::CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec, CommandReturnObject &result) { m_active_io_handler = eIOHandlerBreakpoint; - m_interpreter.GetPythonCommandsFromIOHandler (" ", *this, true, bp_options); + m_interpreter.GetPythonCommandsFromIOHandler (" ", *this, true, &bp_options_vec); } void |