Implement DAP stepOut request
authorTom Tromey <tromey@adacore.com>
Tue, 9 May 2023 20:29:45 +0000 (14:29 -0600)
committerTom Tromey <tromey@adacore.com>
Mon, 12 Jun 2023 18:09:28 +0000 (12:09 -0600)
This implements the DAP "stepOut" request.

gdb/python/lib/gdb/dap/next.py
gdb/testsuite/gdb.dap/basic-dap.c
gdb/testsuite/gdb.dap/basic-dap.exp

index 636dfce997deba148def5e56568efa1893af52d1..232b1529fe594cdd26284f71520ad2308e6a9afd 100644 (file)
@@ -44,6 +44,12 @@ def stepIn(*, threadId, granularity="statement", **args):
     send_gdb(ExecutionInvoker(cmd, StopKinds.STEP))
 
 
+@request("stepOut")
+def step_out(*, threadId):
+    _handle_thread_step(threadId)
+    send_gdb(ExecutionInvoker("finish", StopKinds.STEP))
+
+
 @request("continue")
 def continue_request(**args):
     send_gdb(ExecutionInvoker("continue", None))
index a8327141fb055c29dc81e561f75373ac2c5caeb2..2570b8b07020d1732d2c20c843ae03097c08511c 100644 (file)
@@ -35,10 +35,18 @@ address_breakpoint_here ()
 {
 }
 
-int main ()
+int
+line_breakpoint_here ()
 {
   do_not_stop_here ();
   function_breakpoint_here ();
   address_breakpoint_here ();
   return 0;                    /* BREAK */
 }
+
+
+int
+main ()
+{
+  return line_breakpoint_here ();
+}
index f28239d8268778e579d66da2f154fa62d1579fe8..d4dbdac70ff68087238a0f534a09f77dc32d5e78 100644 (file)
@@ -146,6 +146,11 @@ dap_wait_for_event_and_check "stopped at line breakpoint" stopped \
     "body reason" breakpoint \
     "body hitBreakpointIds" $line_bpno
 
+dap_check_request_and_response "return from function" stepOut \
+    {o threadId [i 1]}
+dap_wait_for_event_and_check "stopped after return" stopped \
+    "body reason" step
+
 set obj [dap_check_request_and_response "evaluate global in main" \
             evaluate {o expression [s global_variable]}]
 dap_match_values "global value in main" [lindex $obj 0] \