summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
diff options
context:
space:
mode:
authorJim Ingham <jingham@apple.com>2016-09-12 23:10:56 +0000
committerJim Ingham <jingham@apple.com>2016-09-12 23:10:56 +0000
commite14dc26857470f248e5fc1dd14d89314eae47fa5 (patch)
tree4233b63c194167caeb8d013fa04bbbb88441b55d /lldb/source/Commands/CommandObjectBreakpointCommand.cpp
parent9db7948e90133938079bc9bdb02b16cfd22f0015 (diff)
downloadbcm5719-llvm-e14dc26857470f248e5fc1dd14d89314eae47fa5.tar.gz
bcm5719-llvm-e14dc26857470f248e5fc1dd14d89314eae47fa5.zip
This is the main part of a change to add breakpoint save and restore to lldb.
Still to come: 1) SB API's 2) Testcases 3) Loose ends: a) serialize Thread options b) serialize Exception resolvers 4) "break list --file" should list breakpoints contained in a file and "break read -f 1 3 5" should then read in only those breakpoints. <rdar://problem/12611863> llvm-svn: 281273
Diffstat (limited to 'lldb/source/Commands/CommandObjectBreakpointCommand.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectBreakpointCommand.cpp67
1 files changed, 10 insertions, 57 deletions
diff --git a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
index 557cb5f13a9..7884728e478 100644
--- a/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
+++ b/lldb/source/Commands/CommandObjectBreakpointCommand.cpp
@@ -215,14 +215,10 @@ are no syntax errors may indicate that a function was declared but never called.
if (!bp_options)
continue;
- std::unique_ptr<BreakpointOptions::CommandData> data_ap(
- new BreakpointOptions::CommandData());
- if (data_ap) {
- data_ap->user_source.SplitIntoLines(line.c_str(), line.size());
- BatonSP baton_sp(
- new BreakpointOptions::CommandBaton(data_ap.release()));
- bp_options->SetCallback(BreakpointOptionsCallbackFunction, baton_sp);
- }
+ BreakpointOptions::CommandData *cmd_data =
+ new BreakpointOptions::CommandData();
+ cmd_data->user_source.SplitIntoLines(line.c_str(), line.size());
+ bp_options->SetCommandDataCallback(cmd_data);
}
}
@@ -242,8 +238,8 @@ are no syntax errors may indicate that a function was declared but never called.
SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec,
const char *oneliner) {
for (auto bp_options : bp_options_vec) {
- std::unique_ptr<BreakpointOptions::CommandData> data_ap(
- new BreakpointOptions::CommandData());
+ BreakpointOptions::CommandData *cmd_data =
+ new BreakpointOptions::CommandData();
// It's necessary to set both user_source and script_source to the
// oneliner.
@@ -251,55 +247,12 @@ are no syntax errors may indicate that a function was declared but never called.
// command list)
// while the latter is used for Python to interpret during the actual
// callback.
- data_ap->user_source.AppendString(oneliner);
- data_ap->script_source.assign(oneliner);
- data_ap->stop_on_error = m_options.m_stop_on_error;
+ cmd_data->user_source.AppendString(oneliner);
+ cmd_data->script_source.assign(oneliner);
+ cmd_data->stop_on_error = m_options.m_stop_on_error;
- BatonSP baton_sp(new BreakpointOptions::CommandBaton(data_ap.release()));
- bp_options->SetCallback(BreakpointOptionsCallbackFunction, baton_sp);
- }
- }
-
- static bool BreakpointOptionsCallbackFunction(
- void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
- lldb::user_id_t break_loc_id) {
- bool ret_value = true;
- if (baton == nullptr)
- return true;
-
- BreakpointOptions::CommandData *data =
- (BreakpointOptions::CommandData *)baton;
- StringList &commands = data->user_source;
-
- if (commands.GetSize() > 0) {
- ExecutionContext exe_ctx(context->exe_ctx_ref);
- Target *target = exe_ctx.GetTargetPtr();
- if (target) {
- CommandReturnObject result;
- Debugger &debugger = target->GetDebugger();
- // Rig up the results secondary output stream to the debugger's, so the
- // output will come out synchronously
- // if the debugger is set up that way.
-
- StreamSP output_stream(debugger.GetAsyncOutputStream());
- StreamSP error_stream(debugger.GetAsyncErrorStream());
- result.SetImmediateOutputStream(output_stream);
- result.SetImmediateErrorStream(error_stream);
-
- CommandInterpreterRunOptions options;
- options.SetStopOnContinue(true);
- options.SetStopOnError(data->stop_on_error);
- options.SetEchoCommands(true);
- options.SetPrintResults(true);
- options.SetAddToHistory(false);
-
- debugger.GetCommandInterpreter().HandleCommands(commands, &exe_ctx,
- options, result);
- result.GetImmediateOutputStream()->Flush();
- result.GetImmediateErrorStream()->Flush();
- }
+ bp_options->SetCommandDataCallback(cmd_data);
}
- return ret_value;
}
class CommandOptions : public Options {
OpenPOWER on IntegriCloud