[Lldb-commits] [lldb] [lldb-dap] Add external terminal support (PR #146950)
@@ -235,7 +235,8 @@ contain the following key/value pairs: | **cwd** | string | | The program working directory. | **env** | dictionary | | Environment variables to set when launching the program. The format of each environment variable string is "VAR=VALUE" for environment variables with values or just "VAR" for environment variables with no values. | **stopOnEntry** | boolean | | Whether to stop program immediately after launching. -| **runInTerminal** | boolean | | Launch the program inside an integrated terminal in the IDE. Useful for debugging interactive command line programs. +| **runInTerminal** (deprecated)| boolean | | Launch the program inside an integrated terminal in the IDE. Useful for debugging interactive command line programs. +| **console** | string | | Specify where to launch the program: internal console (`internalConsole`), integrated terminal (`integratedTerminal`) or external terminal (`externalTerminal`). DrSergei wrote: Just to clarify, which version do you mean? I see the extension version (0.2.15), but I don’t see a separate lldb-dap version. Running `lldb-dap --version` only reports the full LLVM version. https://github.com/llvm/llvm-project/pull/146950 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Add external terminal support (PR #146950)
https://github.com/DrSergei updated https://github.com/llvm/llvm-project/pull/146950 >From 155c6ee3d65d33de5640cfc961ebcb4cbb3ddfbc Mon Sep 17 00:00:00 2001 From: Druzhkov Sergei Date: Wed, 2 Jul 2025 23:29:26 +0300 Subject: [PATCH] [lldb-dap] Add external terminal support --- .../test/tools/lldb-dap/dap_server.py | 5 ++- .../tools/lldb-dap/launch/TestDAP_launch.py | 25 ++--- .../lldb-dap/Handler/LaunchRequestHandler.cpp | 5 +-- .../tools/lldb-dap/Handler/RequestHandler.cpp | 5 +-- lldb/tools/lldb-dap/JSONUtils.cpp | 12 --- lldb/tools/lldb-dap/JSONUtils.h | 6 +++- .../lldb-dap/Protocol/ProtocolRequests.cpp| 36 +-- .../lldb-dap/Protocol/ProtocolRequests.h | 12 +-- lldb/tools/lldb-dap/README.md | 3 +- lldb/tools/lldb-dap/package.json | 18 +- 10 files changed, 105 insertions(+), 22 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 0fe36cd4bc71f..b15c1cb8d8440 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -894,7 +894,8 @@ def request_launch( disableASLR=False, disableSTDIO=False, shellExpandArguments=False, -runInTerminal=False, +runInTerminal=False, # deprecated +console: Optional[str] = None, enableAutoVariableSummaries=False, displayExtendedBacktrace=False, enableSyntheticChildDebugging=False, @@ -946,6 +947,8 @@ def request_launch( args_dict["sourceMap"] = sourceMap if runInTerminal: args_dict["runInTerminal"] = runInTerminal +if console: +args_dict["console"] = console if postRunCommands: args_dict["postRunCommands"] = postRunCommands if customFrameFormat: diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py index ae8142ae4f484..a611cc30c1897 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py @@ -44,22 +44,39 @@ def test_failing_launch_program(self): "'{0}' does not exist".format(program), response["body"]["error"]["format"] ) -def test_failing_launch_commands_and_run_in_terminal(self): +def test_failing_launch_commands_and_console(self): """ -Tests launching with an invalid program. +Tests launching with launch commands in an integrated terminal. """ program = self.getBuildArtifact("a.out") self.create_debug_adapter() response = self.launch( -program, launchCommands=["a b c"], runInTerminal=True, expectFailure=True +program, +launchCommands=["a b c"], +console="integratedTerminal", +expectFailure=True, ) self.assertFalse(response["success"]) self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) self.assertEqual( -"'launchCommands' and 'runInTerminal' are mutually exclusive", +"'launchCommands' and non-internal 'console' are mutually exclusive", self.get_dict_value(response, ["body", "error", "format"]), ) +def test_failing_console(self): +""" +Tests launching in console with an invalid terminal type. +""" +program = self.getBuildArtifact("a.out") +self.create_debug_adapter() +response = self.launch(program, console="invalid", expectFailure=True) +self.assertFalse(response["success"]) +self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) +self.assertRegex( +response["body"]["error"]["format"], +r"unexpected value, expected 'internalConsole\', 'integratedTerminal\' or 'externalTerminal\' at arguments.console", +) + @skipIfWindows def test_termination(self): """ diff --git a/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp index 1d7b4b7009462..553cbeaf849e2 100644 --- a/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp @@ -23,9 +23,10 @@ namespace lldb_dap { /// Launch request; value of command field is 'launch'. Error LaunchRequestHandler::Run(const LaunchRequestArguments &arguments) const { // Validate that we have a well formed launch request. - if (!arguments.launchCommands.empty() && arguments.runInTerminal) + if (!arguments.launchCommands.empty() && + arguments.console != protocol::eConsoleInternal) return make_error( -"'launchCommands' and 'runInTerminal' are mutually exclusive"); +
[Lldb-commits] [lldb] [lldb-dap] Add external terminal support (PR #146950)
https://github.com/DrSergei updated https://github.com/llvm/llvm-project/pull/146950 >From 913a9d09a38da0097c8e931806921f4a0bbbe087 Mon Sep 17 00:00:00 2001 From: Druzhkov Sergei Date: Wed, 2 Jul 2025 23:29:26 +0300 Subject: [PATCH] [lldb-dap] Add external terminal support --- .../test/tools/lldb-dap/dap_server.py | 5 ++- .../tools/lldb-dap/launch/TestDAP_launch.py | 25 ++--- .../lldb-dap/Handler/LaunchRequestHandler.cpp | 5 +-- .../tools/lldb-dap/Handler/RequestHandler.cpp | 5 +-- lldb/tools/lldb-dap/JSONUtils.cpp | 12 --- lldb/tools/lldb-dap/JSONUtils.h | 6 +++- .../lldb-dap/Protocol/ProtocolRequests.cpp| 36 +-- .../lldb-dap/Protocol/ProtocolRequests.h | 12 +-- lldb/tools/lldb-dap/README.md | 3 +- lldb/tools/lldb-dap/package.json | 18 +- 10 files changed, 105 insertions(+), 22 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 0fe36cd4bc71f..b15c1cb8d8440 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -894,7 +894,8 @@ def request_launch( disableASLR=False, disableSTDIO=False, shellExpandArguments=False, -runInTerminal=False, +runInTerminal=False, # deprecated +console: Optional[str] = None, enableAutoVariableSummaries=False, displayExtendedBacktrace=False, enableSyntheticChildDebugging=False, @@ -946,6 +947,8 @@ def request_launch( args_dict["sourceMap"] = sourceMap if runInTerminal: args_dict["runInTerminal"] = runInTerminal +if console: +args_dict["console"] = console if postRunCommands: args_dict["postRunCommands"] = postRunCommands if customFrameFormat: diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py index ae8142ae4f484..a611cc30c1897 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py @@ -44,22 +44,39 @@ def test_failing_launch_program(self): "'{0}' does not exist".format(program), response["body"]["error"]["format"] ) -def test_failing_launch_commands_and_run_in_terminal(self): +def test_failing_launch_commands_and_console(self): """ -Tests launching with an invalid program. +Tests launching with launch commands in an integrated terminal. """ program = self.getBuildArtifact("a.out") self.create_debug_adapter() response = self.launch( -program, launchCommands=["a b c"], runInTerminal=True, expectFailure=True +program, +launchCommands=["a b c"], +console="integratedTerminal", +expectFailure=True, ) self.assertFalse(response["success"]) self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) self.assertEqual( -"'launchCommands' and 'runInTerminal' are mutually exclusive", +"'launchCommands' and non-internal 'console' are mutually exclusive", self.get_dict_value(response, ["body", "error", "format"]), ) +def test_failing_console(self): +""" +Tests launching in console with an invalid terminal type. +""" +program = self.getBuildArtifact("a.out") +self.create_debug_adapter() +response = self.launch(program, console="invalid", expectFailure=True) +self.assertFalse(response["success"]) +self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) +self.assertRegex( +response["body"]["error"]["format"], +r"unexpected value, expected 'internalConsole\', 'integratedTerminal\' or 'externalTerminal\' at arguments.console", +) + @skipIfWindows def test_termination(self): """ diff --git a/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp b/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp index 1d7b4b7009462..553cbeaf849e2 100644 --- a/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/LaunchRequestHandler.cpp @@ -23,9 +23,10 @@ namespace lldb_dap { /// Launch request; value of command field is 'launch'. Error LaunchRequestHandler::Run(const LaunchRequestArguments &arguments) const { // Validate that we have a well formed launch request. - if (!arguments.launchCommands.empty() && arguments.runInTerminal) + if (!arguments.launchCommands.empty() && + arguments.console != protocol::eConsoleInternal) return make_error( -"'launchCommands' and 'runInTerminal' are mutually exclusive"); +
[Lldb-commits] [lldb] [lldb-dap] Add external terminal support (PR #146950)
https://github.com/DrSergei updated https://github.com/llvm/llvm-project/pull/146950 >From 72921a4039666d58ff68ca2e91d155f91150c7be Mon Sep 17 00:00:00 2001 From: Druzhkov Sergei Date: Wed, 2 Jul 2025 23:29:26 +0300 Subject: [PATCH] [lldb-dap] Add external terminal support --- .../test/tools/lldb-dap/dap_server.py | 6 ++-- .../tools/lldb-dap/launch/TestDAP_launch.py | 25 +++--- ...Terminal.py => TestDAP_restart_console.py} | 8 ++--- .../runInTerminal/TestDAP_runInTerminal.py| 6 ++-- .../lldb-dap/Handler/LaunchRequestHandler.cpp | 5 +-- .../tools/lldb-dap/Handler/RequestHandler.cpp | 5 +-- lldb/tools/lldb-dap/JSONUtils.cpp | 14 +--- lldb/tools/lldb-dap/JSONUtils.h | 6 +++- .../lldb-dap/Protocol/ProtocolRequests.cpp| 33 +-- .../lldb-dap/Protocol/ProtocolRequests.h | 12 +-- lldb/tools/lldb-dap/README.md | 3 +- lldb/tools/lldb-dap/package.json | 18 +- 12 files changed, 109 insertions(+), 32 deletions(-) rename lldb/test/API/tools/lldb-dap/restart/{TestDAP_restart_runInTerminal.py => TestDAP_restart_console.py} (92%) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index 0fe36cd4bc71f..0a1424d2f320c 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -894,7 +894,7 @@ def request_launch( disableASLR=False, disableSTDIO=False, shellExpandArguments=False, -runInTerminal=False, +console: Optional[str] = None, enableAutoVariableSummaries=False, displayExtendedBacktrace=False, enableSyntheticChildDebugging=False, @@ -944,8 +944,8 @@ def request_launch( args_dict["launchCommands"] = launchCommands if sourceMap: args_dict["sourceMap"] = sourceMap -if runInTerminal: -args_dict["runInTerminal"] = runInTerminal +if console: +args_dict["console"] = console if postRunCommands: args_dict["postRunCommands"] = postRunCommands if customFrameFormat: diff --git a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py index ae8142ae4f484..a611cc30c1897 100644 --- a/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py +++ b/lldb/test/API/tools/lldb-dap/launch/TestDAP_launch.py @@ -44,22 +44,39 @@ def test_failing_launch_program(self): "'{0}' does not exist".format(program), response["body"]["error"]["format"] ) -def test_failing_launch_commands_and_run_in_terminal(self): +def test_failing_launch_commands_and_console(self): """ -Tests launching with an invalid program. +Tests launching with launch commands in an integrated terminal. """ program = self.getBuildArtifact("a.out") self.create_debug_adapter() response = self.launch( -program, launchCommands=["a b c"], runInTerminal=True, expectFailure=True +program, +launchCommands=["a b c"], +console="integratedTerminal", +expectFailure=True, ) self.assertFalse(response["success"]) self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) self.assertEqual( -"'launchCommands' and 'runInTerminal' are mutually exclusive", +"'launchCommands' and non-internal 'console' are mutually exclusive", self.get_dict_value(response, ["body", "error", "format"]), ) +def test_failing_console(self): +""" +Tests launching in console with an invalid terminal type. +""" +program = self.getBuildArtifact("a.out") +self.create_debug_adapter() +response = self.launch(program, console="invalid", expectFailure=True) +self.assertFalse(response["success"]) +self.assertTrue(self.get_dict_value(response, ["body", "error", "showUser"])) +self.assertRegex( +response["body"]["error"]["format"], +r"unexpected value, expected 'internalConsole\', 'integratedTerminal\' or 'externalTerminal\' at arguments.console", +) + @skipIfWindows def test_termination(self): """ diff --git a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_console.py similarity index 92% rename from lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py rename to lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_console.py index 35810feb48366..67483798f2265 100644 --- a/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_runInTerminal.py +++ b/lldb/test/API/tools/lldb-dap/restart/TestDAP_restart_console.py @@ -