1 # Copyright
2019-2022 Free Software Foundation
, Inc.
3 # This
program is free software
; you can redistribute it and
/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation
; either version
3 of the License
, or
6 #
(at your option
) any later version.
8 # This
program is distributed in the hope that it will be useful
,
9 # but WITHOUT
ANY WARRANTY
; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License
for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this
program.
If not
, see
<http
://www.gnu.org
/licenses
/>.
16 # Ensure that CLI
"display"s aren't double-emitted in MI mode.
18 load_lib mi
-support.exp
27 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
28 untested
"failed to compile"
33 mi_gdb_reinitialize_dir $srcdir
/$subdir
34 mi_gdb_load $
{binfile
}
38 # A helper procedure that checks
for the display and the line number
,
39 # and the following
*stopped. X is the expected value of
"x" and is
40 # also used in test names.
41 proc check_cli_display
{x show_source
} {
44 # Now check
for the display and the source line. We don
't check
45 # the source line too closely, since it's not really important
46 # here
, but we
do check that the stop happened.
47 set stop
"\\*stopped,reason=.*\r\n$mi_gdb_prompt$"
49 set src
"~\"\[0-9\]+\[^\"\]*\\\\n\"\r\n"
53 set display
"~\"1: x = $x\\\\n\"\r\n"
55 -re
"^${display}${src}${display}${stop}" {
56 # This case is the bug
: the display is shown twice.
57 fail
"check display and source line x=$x"
59 -re
"^${src}${display}${stop}" {
60 verbose
-log "got <<<$expect_out(buffer)>>>"
61 pass
"check display and source line x=$x"
63 -re
".*\r\n$mi_gdb_prompt$" {
64 verbose
-log "got <<<$expect_out(buffer)>>>"
65 fail
"check display and source line x=$x (unexpected output)"
68 fail
"check display and source line x=$x (timeout)"
73 mi_gdb_test
"display x" \
74 "&\"display x\\\\n\"\r\n~\"1: x = 23\\\\n\"\r\n\\^done" \
77 if {![mi_send_resuming_command
"interpreter-exec console next" next]} {
80 check_cli_display
24 1
82 # Also check that displays are shown
for -exec
-next.
83 if {![mi_send_resuming_command exec
-next exec
-next
]} {
86 check_cli_display
25 0