[Lldb-commits] [lldb] [lldb-vscode] Allow specifying a custom escape character for LLDB commands (PR #69238)
via lldb-commits
lldb-commits at lists.llvm.org
Mon Oct 16 12:22:22 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r f6f944e77f741861e641e1dd46c30dcbaf8c83b7..5b2da88825a14d3a0825b4372e6ca7ffe4255c5e lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py lldb/test/API/tools/lldb-vscode/console/TestVSCode_console.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 2023-10-16 19:11:02.000000 +0000
+++ packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 2023-10-16 19:22:15.171742 +0000
@@ -6,11 +6,11 @@
class VSCodeTestCaseBase(TestBase):
NO_DEBUG_INFO_TESTCASE = True
- def create_debug_adaptor(self, lldbVSCodeEnv=None, commandEscapeChar='`'):
+ def create_debug_adaptor(self, lldbVSCodeEnv=None, commandEscapeChar="`"):
"""Create the Visual Studio Code debug adaptor"""
self.assertTrue(
is_exe(self.lldbVSCodeExec), "lldb-vscode must exist and be executable"
)
log_file_path = self.getBuildArtifact("vscode.txt")
@@ -20,11 +20,11 @@
init_commands=self.setUpCommands(),
log_file=log_file_path,
env=lldbVSCodeEnv,
)
- def build_and_create_debug_adaptor(self, lldbVSCodeEnv=None, commandEscapeChar='`'):
+ def build_and_create_debug_adaptor(self, lldbVSCodeEnv=None, commandEscapeChar="`"):
self.build()
self.create_debug_adaptor(lldbVSCodeEnv, commandEscapeChar)
def set_source_breakpoints(self, source_path, lines, data=None):
"""Sets source breakpoints and returns an array of strings containing
@@ -424,16 +424,18 @@
disconnectAutomatically=True,
postRunCommands=None,
lldbVSCodeEnv=None,
enableAutoVariableSummaries=False,
enableSyntheticChildDebugging=False,
- commandEscapeChar='`',
+ commandEscapeChar="`",
):
"""Build the default Makefile target, create the VSCode debug adaptor,
and launch the process.
"""
- self.build_and_create_debug_adaptor(lldbVSCodeEnv, commandEscapeChar=commandEscapeChar)
+ self.build_and_create_debug_adaptor(
+ lldbVSCodeEnv, commandEscapeChar=commandEscapeChar
+ )
self.assertTrue(os.path.exists(program), "executable must exist")
return self.launch(
program,
args,
--- packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 2023-10-16 19:11:02.000000 +0000
+++ packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 2023-10-16 19:22:15.699616 +0000
@@ -1013,11 +1013,17 @@
# self.recv.close()
class DebugAdaptor(DebugCommunication):
def __init__(
- self, executable=None, args=[], port=None, init_commands=[], log_file=None, env=None
+ self,
+ executable=None,
+ args=[],
+ port=None,
+ init_commands=[],
+ log_file=None,
+ env=None,
):
self.process = None
if executable is not None:
adaptor_env = os.environ.copy()
if env is not None:
--- test/API/tools/lldb-vscode/console/TestVSCode_console.py 2023-10-16 19:11:02.000000 +0000
+++ test/API/tools/lldb-vscode/console/TestVSCode_console.py 2023-10-16 19:22:15.769222 +0000
@@ -8,12 +8,16 @@
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
class TestVSCode_console(lldbvscode_testcase.VSCodeTestCaseBase):
- def check_lldb_command(self, lldb_command, contains_string, assert_msg, command_escape_char='`'):
- response = self.vscode.request_evaluate(f"{command_escape_char}{lldb_command}", context="repl")
+ def check_lldb_command(
+ self, lldb_command, contains_string, assert_msg, command_escape_char="`"
+ ):
+ response = self.vscode.request_evaluate(
+ f"{command_escape_char}{lldb_command}", context="repl"
+ )
output = response["body"]["result"]
self.assertIn(
contains_string,
output,
(
@@ -65,17 +69,21 @@
# the "frame select" command with no frame index which will print the
# currently selected frame.
self.check_lldb_command("frame select", "frame #1", "frame 1 is selected")
-
@skipIfWindows
@skipIfRemote
def test_custom_escape_char(self):
program = self.getBuildArtifact("a.out")
self.build_and_launch(program, commandEscapeChar=":")
source = "main.cpp"
breakpoint1_line = line_number(source, "// breakpoint 1")
breakpoint_ids = self.set_source_breakpoints(source, [breakpoint1_line])
self.continue_to_breakpoints(breakpoint_ids)
- self.check_lldb_command("help", "For more information on any command", "Help can be invoked", command_escape_char=':')
+ self.check_lldb_command(
+ "help",
+ "For more information on any command",
+ "Help can be invoked",
+ command_escape_char=":",
+ )
``````````
</details>
https://github.com/llvm/llvm-project/pull/69238
More information about the lldb-commits
mailing list