[lldb/Commands] Honor the scripting language passed
authorJonas Devlieghere <jonas@devlieghere.com>
Sun, 22 Dec 2019 01:28:36 +0000 (17:28 -0800)
committerJonas Devlieghere <jonas@devlieghere.com>
Sun, 22 Dec 2019 01:35:29 +0000 (17:35 -0800)
This ensures that breakpoint command honors the scripting language
passed with `-s`. Currently the argument ignores the actual language and
only uses it to differentiate between lldb and script commands.

lldb/source/Commands/CommandObjectBreakpointCommand.cpp
lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint.test [new file with mode: 0644]

index 0cc46a9..73153cf 100644 (file)
@@ -19,7 +19,6 @@
 #include "lldb/Interpreter/OptionGroupPythonClassWithDict.h"
 #include "lldb/Target/Target.h"
 
-
 using namespace lldb;
 using namespace lldb_private;
 
@@ -415,7 +414,8 @@ protected:
       // to set or collect command callback.  Otherwise, call the methods
       // associated with this object.
       if (m_options.m_use_script_language) {
-        ScriptInterpreter *script_interp = GetDebugger().GetScriptInterpreter();
+        ScriptInterpreter *script_interp = GetDebugger().GetScriptInterpreter(
+            /*can_create=*/true, m_options.m_script_language);
         // Special handling for one-liner specified inline.
         if (m_options.m_use_one_liner) {
           script_interp->SetBreakpointCommandCallback(
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint.test b/lldb/test/Shell/ScriptInterpreter/Python/scripted_breakpoint.test
new file mode 100644 (file)
index 0000000..c49124a
--- /dev/null
@@ -0,0 +1,11 @@
+# REQUIRES: python
+#
+# Test that the scripting language argument to "breakpoint command" is honored
+# even if the global scripting language is different.
+#
+# RUN: cat %s | %lldb --script-language none 2>&1 | FileCheck %s
+b main
+breakpoint command add -s python
+print("foo")
+DONE
+# CHECK: Enter your Python command(s). Type 'DONE' to end.