Skip to content

Commit c9dcfac

Browse files
qxy11github-actions[bot]
authored andcommitted
Automerge: [lldb-dap] Add breakpoints after debugger initialization in DExTer (#169744)
# Summary This is a forward fix for test errors from llvm/llvm-project#163653. The PR moved debugger initialization outside of InitializeRequestHandler, and into Launch/AttachRequestHandlers to support DAP sessions sharing debugger instances for dynamically created targets. However, DExTer's DAP class seemed to set breakpoints before the debugger was initialized, which caused the tests to hang waiting for a breakpoint to hit due to none of the breakpoints getting resolved. # Tests ``` bin/llvm-lit -v /home/qxy11/llvm/llvm-project/cross-project-tests/debuginfo-tests/dexter-tests/ ```
2 parents e2bd94f + fb18f75 commit c9dcfac

File tree

1 file changed

+15
-8
lines changed
  • cross-project-tests/debuginfo-tests/dexter/dex/debugger

1 file changed

+15
-8
lines changed

cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -763,20 +763,27 @@ def launch(self, cmdline):
763763

764764
launch_request = self._get_launch_params(cmdline)
765765

766-
# For some reason, we *must* submit in the order launch->configurationDone, and then we will receive responses
767-
# in the order configurationDone->launch.
768-
self._flush_breakpoints()
766+
# Per DAP protocol, the correct sequence is:
767+
# 1. Send launch request
768+
# 2. Wait for launch response and "initialized" event
769+
# 3. Set breakpoints
770+
# 4. Send configurationDone to start the process
769771
launch_req_id = self.send_message(self.make_request("launch", launch_request))
770-
config_done_req_id = self.send_message(self.make_request("configurationDone"))
771-
config_done_response = self._await_response(config_done_req_id)
772-
assert config_done_response["success"], "Should simply receive an affirmative?"
773772
launch_response = self._await_response(launch_req_id)
774773
if not launch_response["success"]:
775774
raise DebuggerException(
776775
f"failure launching debugger: \"{launch_response['body']['error']['format']}\""
777776
)
778-
# We can't interact meaningfully with the process until we have the thread ID and confirmation that the process
779-
# has finished launching.
777+
778+
# Set breakpoints after receiving launch response but before configurationDone.
779+
self._flush_breakpoints()
780+
781+
# Send configurationDone to allow the process to start running.
782+
config_done_req_id = self.send_message(self.make_request("configurationDone"))
783+
config_done_response = self._await_response(config_done_req_id)
784+
assert config_done_response["success"]
785+
786+
# Wait for the process to launch and obtain a thread ID.
780787
while self._debugger_state.thread is None or not self._debugger_state.launched:
781788
time.sleep(0.001)
782789

0 commit comments

Comments
 (0)