]>
Commit | Line | Data |
---|---|---|
3666a048 | 1 | # Copyright 2012-2021 Free Software Foundation, Inc. |
5b9afe8a YQ |
2 | |
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. | |
7 | # | |
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. | |
12 | # | |
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/>. | |
15 | ||
5bd18990 AB |
16 | # Do this here before we start GDB for the test. |
17 | set scheduler_locking_supported [target_supports_scheduler_locking] | |
18 | ||
5b9afe8a YQ |
19 | load_lib mi-support.exp |
20 | set MIFLAGS "-i=mi" | |
21 | ||
22 | standard_testfile basics.c | |
23 | ||
24 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
5b362f04 | 25 | untested "failed to compile" |
5b9afe8a YQ |
26 | return -1 |
27 | } | |
28 | ||
0a251e08 | 29 | proc test_command_param_changed { } { |
5bd18990 | 30 | global scheduler_locking_supported |
b75d55d4 | 31 | global binfile |
5bd18990 | 32 | |
0a251e08 | 33 | with_test_prefix "cmd param" { |
b75d55d4 PA |
34 | mi_clean_restart $binfile |
35 | mi_runto_main | |
5b9afe8a | 36 | |
5bd18990 AB |
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}\"" | |
42 | } | |
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}\"" | |
47 | } | |
48 | # Don't emit MI notification for request from MI. | |
49 | mi_gdb_test "-gdb-set scheduler-locking on" \ | |
50 | {\^done} \ | |
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" | |
0a251e08 | 58 | } |
5bd18990 | 59 | |
62a813cc YQ |
60 | mi_gdb_test "-exec-arguments foo" {\^done} \ |
61 | "\"-exec-arguments foo\" no event" | |
0a251e08 | 62 | |
0a251e08 YQ |
63 | foreach command { "remotecache" "check type" } { |
64 | ||
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" | |
68 | ||
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}\"" | |
73 | } | |
74 | mi_gdb_test "set ${command} off" \ | |
75 | "\\&\"set ${command} off\\\\n\"\r\n\\^done" \ | |
76 | "\"set ${command}\" no event" | |
77 | } | |
5b9afe8a | 78 | |
5b9afe8a | 79 | |
0a251e08 YQ |
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}\"" | |
85 | } | |
86 | mi_gdb_test "set ${command} bar" \ | |
87 | "\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \ | |
88 | "\"set ${command} bar\" no event" | |
89 | } | |
5b9afe8a | 90 | |
0a251e08 | 91 | # No notification is emitted for 'maint set' commands. |
5b9afe8a | 92 | foreach boolean_opt { "on" "off" } { |
b4f54984 DE |
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}\"" | |
5b9afe8a | 96 | } |
5b9afe8a | 97 | |
0a251e08 YQ |
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" \ | |
102 | "\"set ch type on\"" | |
5b9afe8a | 103 | |
f5c4b229 JV |
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" \ | |
113 | "\"directory\"" | |
114 | ||
0a251e08 | 115 | mi_gdb_exit |
5b9afe8a | 116 | } |
0a251e08 | 117 | } |
5b9afe8a YQ |
118 | |
119 | test_command_param_changed | |
120 | ||
121 | return 0 |