18from .events
import StopKinds, exec_and_expect_stop
19from .server
import capability, request
20from .startup
import in_gdb_thread, send_gdb, send_gdb_with_response
21from .state
import set_thread
29def _handle_thread_step(thread_id, single_thread, select=False):
42 gdb.execute(
"set scheduler-locking " + arg, from_tty=
True, to_string=
True)
48 gdb.newest_frame().select()
52@request("next", response=False)
54 *, threadId: int, singleThread: bool =
False, granularity: str =
"statement", **args
56 _handle_thread_step(threadId, singleThread)
58 if granularity ==
"instruction":
60 exec_and_expect_stop(cmd, StopKinds.STEP)
63@capability("supportsSteppingGranularity")
64@capability("supportsSingleThreadExecutionRequests")
65@request("stepIn", response=False)
67 *, threadId: int, singleThread: bool =
False, granularity: str =
"statement", **args
69 _handle_thread_step(threadId, singleThread)
71 if granularity ==
"instruction":
73 exec_and_expect_stop(cmd, StopKinds.STEP)
76@request("stepOut", response=False)
77def step_out(*, threadId: int, singleThread: bool =
False, **args):
78 _handle_thread_step(threadId, singleThread,
True)
79 exec_and_expect_stop(
"finish", StopKinds.STEP)
87@request("continue", on_dap_thread=True)
88def continue_request(*, threadId: int, singleThread: bool =
False, **args):
89 locked = send_gdb_with_response(
lambda: _handle_thread_step(threadId, singleThread))
90 send_gdb(
lambda: exec_and_expect_stop(
"continue",
None))
91 return {
"allThreadsContinued":
not locked}