Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1417,7 +1417,7 @@ bool ScriptInterpreterPythonImpl::GenerateScriptAliasFunction(
sstr.Printf("def %s (debugger, args, exe_ctx, result, internal_dict):",
auto_generated_function_name.c_str());

if (!GenerateFunction(sstr.GetData(), user_input, /*is_callback=*/true)
if (!GenerateFunction(sstr.GetData(), user_input, /*is_callback=*/false)
.Success())
return false;

Expand Down
14 changes: 14 additions & 0 deletions lldb/test/API/commands/command/script/TestCommandScript.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,17 @@ def test_persistence(self):
# The result object will be replaced by an empty result object (in the
# "Started" state).
self.expect("script str(persistence.result_copy)", substrs=["Started"])

def test_interactive(self):
"""
Test that we can add multiple lines interactively.
"""
interp = self.dbg.GetCommandInterpreter()
cmd_file = self.getSourcePath("cmd_file.lldb")
result = lldb.SBCommandReturnObject()
interp.HandleCommand(f"command source {cmd_file}", result)
self.assertCommandReturn(result, "Sourcing the command should cause no errors.")
self.assertTrue(interp.UserCommandExists("my_cmd"), "Command defined.")
interp.HandleCommand("my_cmd", result)
self.assertCommandReturn(result, "Running the command succeeds")
self.assertIn("My Command Result", result.GetOutput(), "Command was correct")
4 changes: 4 additions & 0 deletions lldb/test/API/commands/command/script/cmd_file.lldb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
command script add my_cmd
result.PutCString("My Command Result")
result.SetStatus(lldb.eReturnStatusSuccessFinishResult)
DONE