aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.mi/mi-cli.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.mi/mi-cli.exp')
-rw-r--r--gdb/testsuite/gdb.mi/mi-cli.exp18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.mi/mi-cli.exp b/gdb/testsuite/gdb.mi/mi-cli.exp
index 08c8f02..5f75bef 100644
--- a/gdb/testsuite/gdb.mi/mi-cli.exp
+++ b/gdb/testsuite/gdb.mi/mi-cli.exp
@@ -156,6 +156,24 @@ if {[regexp "A + B" "$output"]} {
mi_expect_stop "end-stepping-range" "callee4" "" ".*basics.c" $line_callee4_next_step \
"" "check *stopped from CLI command 2"
+# Test that CLI's "finish" command prints the function's return value
+# to both the CLI and MI streams, and that the same result variable is
+# printed to both streams.
+with_test_prefix "CLI finish" {
+ mi_send_resuming_command "interpreter-exec console finish" "send CLI command"
+
+ set output [mi_gdb_expect_cli_output "\\*stopped" "collect CLI output"]
+ gdb_assert {[regexp \
+ "callee3 .* at .*basics.c:.*.*Value returned is .1 = 0\\\\n" \
+ $output]} \
+ "check CLI output"
+
+ mi_expect_stop "function-finished" "callee3" ".*" \
+ ".*basics.c" ".*" \
+ ",gdb-result-var=\".1\",return-value=\"0\"" \
+ "check MI output"
+}
+
mi_gdb_test "600-break-insert -t basics.c:$line_main_hello" \
{600\^done,bkpt=.number="3",type="breakpoint".*\}} \
"-break-insert -t basics.c:\$line_main_hello"