Files
clang-p2996/lldb/test/API/tools/lldb-vscode/startDebugging/TestVSCode_startDebugging.py
John Harrison 3d1f89c2e3 [lldb-vscode] Creating a new flag for adjusting the behavior of evaluation repl expressions to allow users to more easily invoke lldb commands.
This adds a new flag and lldb runtime command to allow users to manage the behavior of the lldb-vscode evaluate repl request.

When evaluating a repl context this now has runtime managed flag for control how the repl behaviors with the follow values:

* `variable` - the existing behavior, with this mode requests are evaluted in the current frame context as variable expressions. To trigger a lldb command prefix an expression with ` and it will be evaluted as an lldb command.
* `command` - all expressions are evaluated as lldb commands.
* `auto` - An alternative mode that will attempt to determine if the expression is an lldb command or a variable expression. Based off the intepreted results the expression will be evaluted either as a command or an expression.

Additionally, I enabled completions and ensured they work with the new repl expression behavior to provide auto-completes.

This commit includes updates to the tests to verify the new behavior after the previous failures from submitting https://reviews.llvm.org/D154030.

Differential Revision: https://reviews.llvm.org/D155248
2023-07-19 21:04:12 +00:00

40 lines
1.2 KiB
Python

"""
Test lldb-vscode startDebugging reverse request
"""
import vscode
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
import lldbvscode_testcase
class TestVSCode_startDebugging(lldbvscode_testcase.VSCodeTestCaseBase):
def test_startDebugging(self):
"""
Tests the "startDebugging" reverse request. It makes sure that the IDE can
start a child debug session.
"""
program = self.getBuildArtifact("a.out")
source = "main.c"
self.build_and_launch(program)
breakpoint_line = line_number(source, "// breakpoint")
self.set_source_breakpoints(source, [breakpoint_line])
self.continue_to_next_stop()
self.vscode.request_evaluate(
"`lldb-vscode startDebugging attach '{\"pid\":321}'", context="repl"
)
self.continue_to_exit()
self.assertEqual(
len(self.vscode.reverse_requests), 1, "make sure we got a reverse request"
)
request = self.vscode.reverse_requests[0]
self.assertEqual(request["arguments"]["configuration"]["pid"], 321)
self.assertEqual(request["arguments"]["request"], "attach")