Skip to content

Commit 8c7e1ab

Browse files
authored
[Dexter] Add DAP stepNext and stepOut support (#152717)
1 parent dece902 commit 8c7e1ab

File tree

1 file changed

+20
-4
lines changed
  • cross-project-tests/debuginfo-tests/dexter/dex/debugger

1 file changed

+20
-4
lines changed

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

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,10 @@ def _handle_message(
361361
# response or the event, since the DAP does not specify an order in which they are sent. May need revisiting
362362
# if there turns out to be some odd ordering issues, e.g. if we can receive messages in the order
363363
# ["response: continued", "event: stopped", "event: continued"].
364-
if message["command"] == "continue" and message["success"] == True:
364+
if (
365+
message["command"] in ["continue", "stepIn", "next", "stepOut"]
366+
and message["success"] == True
367+
):
365368
debugger_state.is_running = True
366369
# Reset all state that is invalidated upon program continue.
367370
debugger_state.stopped_reason = None
@@ -677,21 +680,34 @@ def launch(self, cmdline):
677680
def _post_step_hook(self):
678681
"""Hook to be executed after completing a step request."""
679682

680-
def step_in(self):
683+
def _step(self, step_request_string):
681684
self._flush_breakpoints()
682685
step_req_id = self.send_message(
683-
self.make_request("stepIn", {"threadId": self._debugger_state.thread})
686+
self.make_request(
687+
step_request_string, {"threadId": self._debugger_state.thread}
688+
)
684689
)
685690
response = self._await_response(step_req_id)
686691
if not response["success"]:
687-
raise DebuggerException("failed to step")
692+
raise DebuggerException(
693+
f"failed to perform debugger action: '{step_request_string}'"
694+
)
688695
# If we've "stepped" to a breakpoint, then continue to hit the breakpoint properly.
689696
# NB: This is an issue that only seems relevant to LLDB, but is also harmless outside of LLDB; if it turns out
690697
# to cause issues for other debuggers, we can move it to a post-step hook.
691698
while self._debugger_state.is_running:
692699
time.sleep(0.001)
693700
self._post_step_hook()
694701

702+
def step_in(self):
703+
self._step("stepIn")
704+
705+
def step_next(self):
706+
self._step("next")
707+
708+
def step_out(self):
709+
self._step("stepOut")
710+
695711
def go(self) -> ReturnCode:
696712
self._flush_breakpoints()
697713
continue_req_id = self.send_message(

0 commit comments

Comments
 (0)