This PR changes how we treat the launch sequence in lldb-dap. - Send the initialized event after we finish handling the initialize request, rather than after we finish attaching or launching. - Delay handling the launch and attach request until we have handled the configurationDone request. The latter is now largely a NO-OP and only exists to signal lldb-dap that it can handle the launch and attach requests. - Delay handling the initial threads requests until we have handled the launch or attach request. - Make all attaching and launching synchronous, including when we have attach or launch commands. This removes the need to synchronize between the request and event thread. Background: https://discourse.llvm.org/t/reliability-of-the-lldb-dap-tests/86125
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
"""
|
|
Test lldb-dap start-debugging reverse requests.
|
|
"""
|
|
|
|
from lldbsuite.test.decorators import *
|
|
from lldbsuite.test.lldbtest import *
|
|
import lldbdap_testcase
|
|
|
|
|
|
class TestDAP_startDebugging(lldbdap_testcase.DAPTestCaseBase):
|
|
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, stopOnEntry=True)
|
|
|
|
breakpoint_line = line_number(source, "// breakpoint")
|
|
|
|
self.set_source_breakpoints(source, [breakpoint_line])
|
|
self.continue_to_next_stop()
|
|
self.dap_server.request_evaluate(
|
|
"`lldb-dap start-debugging attach '{\"pid\":321}'", context="repl"
|
|
)
|
|
|
|
self.continue_to_exit()
|
|
|
|
self.assertEqual(
|
|
len(self.dap_server.reverse_requests),
|
|
1,
|
|
"make sure we got a reverse request",
|
|
)
|
|
|
|
request = self.dap_server.reverse_requests[0]
|
|
self.assertEqual(request["arguments"]["configuration"]["pid"], 321)
|
|
self.assertEqual(request["arguments"]["request"], "attach")
|