From 2bb714e21768469d6ef04e1478a1464fc6420103 Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Thu, 7 Aug 2025 12:06:46 +0100 Subject: [PATCH 1/3] [Dexter] Add DAP stepNext and stepOut support --- .../dexter/dex/debugger/DAP.py | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py index 3921e7f407f06..bb5880821224a 100644 --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py @@ -325,7 +325,10 @@ def _handle_message( # response or the event, since the DAP does not specify an order in which they are sent. May need revisiting # if there turns out to be some odd ordering issues, e.g. if we can receive messages in the order # ["response: continued", "event: stopped", "event: continued"]. - if message["command"] == "continue" and message["success"] == True: + if ( + message["command"] in ["continue", "stepIn", "next", "stepOut"] + and message["success"] == True + ): debugger_state.is_running = True # Reset all state that is invalidated upon program continue. debugger_state.stopped_reason = None @@ -635,14 +638,16 @@ def launch(self, cmdline): def _post_step_hook(self): """Hook to be executed after completing a step request.""" - def step_in(self): + def _step(self, step_request_string): self._flush_breakpoints() step_req_id = self.send_message( - self.make_request("stepIn", {"threadId": self._debugger_state.thread}) + self.make_request( + step_request_string, {"threadId": self._debugger_state.thread} + ) ) response = self._await_response(step_req_id) if not response["success"]: - raise DebuggerException("failed to step") + raise DebuggerException(f"failed to {step_request_string}") # If we've "stepped" to a breakpoint, then continue to hit the breakpoint properly. # NB: This is an issue that only seems relevant to LLDB, but is also harmless outside of LLDB; if it turns out # to cause issues for other debuggers, we can move it to a post-step hook. @@ -650,6 +655,15 @@ def step_in(self): time.sleep(0.001) self._post_step_hook() + def step_in(self): + self._step("stepIn") + + def step_next(self): + self._step("next") + + def step_out(self): + self._step("stepOut") + def go(self) -> ReturnCode: self._flush_breakpoints() continue_req_id = self.send_message( From 3d096c621722d23bb2ec1defd8c4a3745d94de37 Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Tue, 12 Aug 2025 12:04:39 +0100 Subject: [PATCH 2/3] improve exception msg --- cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py index bb5880821224a..a19dc2abd1eaa 100644 --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py @@ -647,7 +647,7 @@ def _step(self, step_request_string): ) response = self._await_response(step_req_id) if not response["success"]: - raise DebuggerException(f"failed to {step_request_string}") + raise DebuggerException(f"failed to perform debugger action: '{step_request_string}'") # If we've "stepped" to a breakpoint, then continue to hit the breakpoint properly. # NB: This is an issue that only seems relevant to LLDB, but is also harmless outside of LLDB; if it turns out # to cause issues for other debuggers, we can move it to a post-step hook. From 91f36417a1cf6c7027b43b741acd7d40cc1a064b Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams Date: Tue, 12 Aug 2025 12:12:32 +0100 Subject: [PATCH 3/3] fmt --- .../debuginfo-tests/dexter/dex/debugger/DAP.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py index a19dc2abd1eaa..0e25e84683cff 100644 --- a/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py +++ b/cross-project-tests/debuginfo-tests/dexter/dex/debugger/DAP.py @@ -647,7 +647,9 @@ def _step(self, step_request_string): ) response = self._await_response(step_req_id) if not response["success"]: - raise DebuggerException(f"failed to perform debugger action: '{step_request_string}'") + raise DebuggerException( + f"failed to perform debugger action: '{step_request_string}'" + ) # If we've "stepped" to a breakpoint, then continue to hit the breakpoint properly. # NB: This is an issue that only seems relevant to LLDB, but is also harmless outside of LLDB; if it turns out # to cause issues for other debuggers, we can move it to a post-step hook.