aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2023-05-09 14:29:45 -0600
committerTom Tromey <tromey@adacore.com>2023-06-12 12:09:28 -0600
commit3eb64586f07e41bd6b6ef2276bd24b92b0ed4d91 (patch)
treeeb893cd437ae683689c5a84b0161921d82e44213 /gdb
parentd01f36bdfabaae60fa90134b70e2945bb530fa05 (diff)
downloadbinutils-3eb64586f07e41bd6b6ef2276bd24b92b0ed4d91.zip
binutils-3eb64586f07e41bd6b6ef2276bd24b92b0ed4d91.tar.gz
binutils-3eb64586f07e41bd6b6ef2276bd24b92b0ed4d91.tar.bz2
Implement DAP stepOut request
This implements the DAP "stepOut" request.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/python/lib/gdb/dap/next.py6
-rw-r--r--gdb/testsuite/gdb.dap/basic-dap.c10
-rw-r--r--gdb/testsuite/gdb.dap/basic-dap.exp5
3 files changed, 20 insertions, 1 deletions
diff --git a/gdb/python/lib/gdb/dap/next.py b/gdb/python/lib/gdb/dap/next.py
index 636dfce..232b152 100644
--- a/gdb/python/lib/gdb/dap/next.py
+++ b/gdb/python/lib/gdb/dap/next.py
@@ -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))
diff --git a/gdb/testsuite/gdb.dap/basic-dap.c b/gdb/testsuite/gdb.dap/basic-dap.c
index a832714..2570b8b 100644
--- a/gdb/testsuite/gdb.dap/basic-dap.c
+++ b/gdb/testsuite/gdb.dap/basic-dap.c
@@ -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 ();
+}
diff --git a/gdb/testsuite/gdb.dap/basic-dap.exp b/gdb/testsuite/gdb.dap/basic-dap.exp
index f28239d..d4dbdac 100644
--- a/gdb/testsuite/gdb.dap/basic-dap.exp
+++ b/gdb/testsuite/gdb.dap/basic-dap.exp
@@ -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] \