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"