Skip to content

Commit 2bb714e

Browse files
committed
[Dexter] Add DAP stepNext and stepOut support
1 parent 2d33b79 commit 2bb714e

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
@@ -325,7 +325,10 @@ def _handle_message(
325325
# response or the event, since the DAP does not specify an order in which they are sent. May need revisiting
326326
# if there turns out to be some odd ordering issues, e.g. if we can receive messages in the order
327327
# ["response: continued", "event: stopped", "event: continued"].
328-
if message["command"] == "continue" and message["success"] == True:
328+
if (
329+
message["command"] in ["continue", "stepIn", "next", "stepOut"]
330+
and message["success"] == True
331+
):
329332
debugger_state.is_running = True
330333
# Reset all state that is invalidated upon program continue.
331334
debugger_state.stopped_reason = None
@@ -635,21 +638,32 @@ def launch(self, cmdline):
635638
def _post_step_hook(self):
636639
"""Hook to be executed after completing a step request."""
637640

638-
def step_in(self):
641+
def _step(self, step_request_string):
639642
self._flush_breakpoints()
640643
step_req_id = self.send_message(
641-
self.make_request("stepIn", {"threadId": self._debugger_state.thread})
644+
self.make_request(
645+
step_request_string, {"threadId": self._debugger_state.thread}
646+
)
642647
)
643648
response = self._await_response(step_req_id)
644649
if not response["success"]:
645-
raise DebuggerException("failed to step")
650+
raise DebuggerException(f"failed to {step_request_string}")
646651
# If we've "stepped" to a breakpoint, then continue to hit the breakpoint properly.
647652
# NB: This is an issue that only seems relevant to LLDB, but is also harmless outside of LLDB; if it turns out
648653
# to cause issues for other debuggers, we can move it to a post-step hook.
649654
while self._debugger_state.is_running:
650655
time.sleep(0.001)
651656
self._post_step_hook()
652657

658+
def step_in(self):
659+
self._step("stepIn")
660+
661+
def step_next(self):
662+
self._step("next")
663+
664+
def step_out(self):
665+
self._step("stepOut")
666+
653667
def go(self) -> ReturnCode:
654668
self._flush_breakpoints()
655669
continue_req_id = self.send_message(

0 commit comments

Comments
 (0)