Fix one-liner Python breakpoint commands to be wrapped up in an automatically
generated Python function, and passed the stoppoint context frame and
bp_loc as parameters.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114894 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Interpreter/ScriptInterpreterPython.cpp b/source/Interpreter/ScriptInterpreterPython.cpp
index b5ef735..a7e34d2 100644
--- a/source/Interpreter/ScriptInterpreterPython.cpp
+++ b/source/Interpreter/ScriptInterpreterPython.cpp
@@ -627,7 +627,7 @@
}
}
else
- ::fprintf (out_fh, "Warning: No command attached to breakpoint.\n");
+ ::fprintf (out_fh, "Warning: No command attached to breakpoint.\n");
}
else
{
@@ -684,12 +684,18 @@
// It's necessary to set both user_source and script_source to the oneliner.
// The former is used to generate callback description (as in breakpoint 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.AppendString (oneliner);
- BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
- bp_options->SetCallback (ScriptInterpreterPython::BreakpointCallbackFunction, baton_sp);
-
+ if (GenerateBreakpointCommandCallbackData (data_ap->user_source, data_ap->script_source))
+ {
+ if (data_ap->script_source.GetSize() == 1)
+ {
+ BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
+ bp_options->SetCallback (ScriptInterpreterPython::BreakpointCallbackFunction, baton_sp);
+ }
+ }
+
return;
}