1 # Copyright
2012-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 #
Do this here before we start GDB
for the test.
17 set scheduler_locking_supported
[target_supports_scheduler_locking
]
19 load_lib mi
-support.exp
22 standard_testfile basics.c
24 if { [gdb_compile
"${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
25 untested
"failed to compile"
29 proc test_command_param_changed
{ } {
30 global scheduler_locking_supported
33 with_test_prefix
"cmd param" {
34 mi_clean_restart $binfile
37 if { $scheduler_locking_supported
} {
38 foreach opt
{ "on" "off" "step" } {
39 mi_gdb_test
"set scheduler-locking ${opt}" \
40 ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
41 "\"set scheduler-locking ${opt}\""
43 foreach opt
{ "on" "off" "step" } {
44 mi_gdb_test
"interpreter-exec console \"set scheduler-locking ${opt}\"" \
45 ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
46 "interpreter-exec \"set scheduler-locking ${opt}\""
48 # Don
't emit MI notification for request from MI.
49 mi_gdb_test "-gdb-set scheduler-locking on" \
51 "\"set scheduler-locking on\" no event (requested by MI)"
52 mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \
53 "\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \
54 "\"set scheduler-locking step\" no event (requested by MI interp)"
55 mi_gdb_test "set scheduler-locking step" \
56 "\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \
57 "\"set scheduler-locking stepr\" no event"
60 mi_gdb_test "-exec-arguments foo" {\^done} \
61 "\"-exec-arguments foo\" no event"
63 foreach command { "remotecache" "check type" } {
65 # The default value of each command option may be different, so we first
66 # set it to 'off', and this may or may not trigger MI notification.
67 mi_gdb_test "set ${command} off" ".*\\^done" "\"set ${command}\" warmup"
69 foreach boolean_opt { "on" "off" } {
70 mi_gdb_test "set ${command} ${boolean_opt}" \
71 ".*=cmd-param-changed,param=\"${command}\",value=\"${boolean_opt}\".*\\^done" \
72 "\"set ${command} ${boolean_opt}\""
74 mi_gdb_test "set ${command} off" \
75 "\\&\"set ${command} off\\\\n\"\r\n\\^done" \
76 "\"set ${command}\" no event"
80 foreach command { "trace-notes" "remote exec-file" } {
81 foreach str_opt { "foo" "bar" } {
82 mi_gdb_test "set ${command} ${str_opt}" \
83 ".*=cmd-param-changed,param=\"${command}\",value=\"${str_opt}\".*\\^done" \
84 "\"set ${command} ${str_opt}\""
86 mi_gdb_test "set ${command} bar" \
87 "\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \
88 "\"set ${command} bar\" no event"
91 # No notification is emitted for 'maint
set' commands.
92 foreach boolean_opt { "on" "off" } {
93 mi_gdb_test "maint set dwarf always-disassemble ${boolean_opt}" \
94 "\\&\"maint set dwarf always-disassemble ${boolean_opt}\\\\n\"\r\n\\^done" \
95 "\"maint dwarf always-disassemble ${boolean_opt}\""
98 # Full command parameters are included in the notification when a
99 # abbreviated one is typed.
100 mi_gdb_test "set ch type on" \
101 ".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \
104 # Notification is emitted for both 'set directories
' and 'directory
'.
105 mi_gdb_test "set directories \$cdir:\$cwd:/tmp" \
106 ".*=cmd-param-changed,param=\"directories\",value=\".*\".*\\^done" \
107 "\"set directories \$cdir:\$cwd:/tmp\""
108 mi_gdb_test "directory /usr/src/gdb" \
109 ".*=cmd-param-changed,param=\"directories\",value=\".*\".*\\^done" \
110 "\"directory /usr/src/gdb\""
111 mi_gdb_test "directory" \
112 ".*=cmd-param-changed,param=\"directories\",value=\".*\".*\\^done" \
119 test_command_param_changed