Skip to content

Commit 73804d1

Browse files
committed
[Dexter] Add DAP stepNext and stepOut support
1 parent 5ae3f45 commit 73804d1

File tree

1 file changed

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

1 file changed

+18
-4
lines changed

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ def _handle_message(
365365
# response or the event, since the DAP does not specify an order in which they are sent. May need revisiting
366366
# if there turns out to be some odd ordering issues, e.g. if we can receive messages in the order
367367
# ["response: continued", "event: stopped", "event: continued"].
368-
if message["command"] == "continue" and message["success"] == True:
368+
if (
369+
message["command"] in ["continue", "stepIn", "next", "stepOut"]
370+
and message["success"] == True
371+
):
369372
debugger_state.is_running = True
370373
# Reset all state that is invalidated upon program continue.
371374
debugger_state.stopped_reason = None
@@ -683,21 +686,32 @@ def launch(self, cmdline):
683686
def _post_step_hook(self):
684687
"""Hook to be executed after completing a step request."""
685688

686-
def step_in(self):
689+
def _step(self, step_request_string):
687690
self._flush_breakpoints()
688691
step_req_id = self.send_message(
689-
self.make_request("stepIn", {"threadId": self._debugger_state.thread})
692+
self.make_request(
693+
step_request_string, {"threadId": self._debugger_state.thread}
694+
)
690695
)
691696
response = self._await_response(step_req_id)
692697
if not response["success"]:
693-
raise DebuggerException("failed to step")
698+
raise DebuggerException(f"failed to {step_request_string}")
694699
# If we've "stepped" to a breakpoint, then continue to hit the breakpoint properly.
695700
# NB: This is an issue that only seems relevant to LLDB, but is also harmless outside of LLDB; if it turns out
696701
# to cause issues for other debuggers, we can move it to a post-step hook.
697702
while self._debugger_state.is_running:
698703
time.sleep(0.001)
699704
self._post_step_hook()
700705

706+
def step_in(self):
707+
self._step("stepIn")
708+
709+
def step_next(self):
710+
self._step("next")
711+
712+
def step_out(self):
713+
self._step("stepOut")
714+
701715
def go(self) -> ReturnCode:
702716
self._flush_breakpoints()
703717
continue_req_id = self.send_message(

0 commit comments

Comments
 (0)