Commit | Line | Data |
---|---|---|
42a4f53d | 1 | # Copyright 2012-2019 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 AB |
30 | global scheduler_locking_supported |
31 | ||
0a251e08 YQ |
32 | with_test_prefix "cmd param" { |
33 | if [mi_gdb_start] { | |
34 | return | |
35 | } | |
36 | mi_run_to_main | |
5b9afe8a | 37 | |
5bd18990 AB |
38 | if { $scheduler_locking_supported } { |
39 | foreach opt { "on" "off" "step" } { | |
40 | mi_gdb_test "set scheduler-locking ${opt}" \ | |
41 | ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \ | |
42 | "\"set scheduler-locking ${opt}\"" | |
43 | } | |
44 | foreach opt { "on" "off" "step" } { | |
45 | mi_gdb_test "interpreter-exec console \"set scheduler-locking ${opt}\"" \ | |
46 | ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \ | |
47 | "interpreter-exec \"set scheduler-locking ${opt}\"" | |
48 | } | |
49 | # Don't emit MI notification for request from MI. | |
50 | mi_gdb_test "-gdb-set scheduler-locking on" \ | |
51 | {\^done} \ | |
52 | "\"set scheduler-locking on\" no event (requested by MI)" | |
53 | mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \ | |
54 | "\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \ | |
55 | "\"set scheduler-locking step\" no event (requested by MI interp)" | |
56 | mi_gdb_test "set scheduler-locking step" \ | |
57 | "\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \ | |
58 | "\"set scheduler-locking stepr\" no event" | |
0a251e08 | 59 | } |
5bd18990 | 60 | |
62a813cc YQ |
61 | mi_gdb_test "-exec-arguments foo" {\^done} \ |
62 | "\"-exec-arguments foo\" no event" | |
0a251e08 | 63 | |
0a251e08 YQ |
64 | foreach command { "remotecache" "check type" } { |
65 | ||
66 | # The default value of each command option may be different, so we first | |
67 | # set it to 'off', and this may or may not trigger MI notification. | |
68 | mi_gdb_test "set ${command} off" ".*\\^done" "\"set ${command}\" warmup" | |
69 | ||
70 | foreach boolean_opt { "on" "off" } { | |
71 | mi_gdb_test "set ${command} ${boolean_opt}" \ | |
72 | ".*=cmd-param-changed,param=\"${command}\",value=\"${boolean_opt}\".*\\^done" \ | |
73 | "\"set ${command} ${boolean_opt}\"" | |
74 | } | |
75 | mi_gdb_test "set ${command} off" \ | |
76 | "\\&\"set ${command} off\\\\n\"\r\n\\^done" \ | |
77 | "\"set ${command}\" no event" | |
78 | } | |
5b9afe8a | 79 | |
5b9afe8a | 80 | |
0a251e08 YQ |
81 | foreach command { "trace-notes" "remote exec-file" } { |
82 | foreach str_opt { "foo" "bar" } { | |
83 | mi_gdb_test "set ${command} ${str_opt}" \ | |
84 | ".*=cmd-param-changed,param=\"${command}\",value=\"${str_opt}\".*\\^done" \ | |
85 | "\"set ${command} ${str_opt}\"" | |
86 | } | |
87 | mi_gdb_test "set ${command} bar" \ | |
88 | "\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \ | |
89 | "\"set ${command} bar\" no event" | |
90 | } | |
5b9afe8a | 91 | |
0a251e08 | 92 | # No notification is emitted for 'maint set' commands. |
5b9afe8a | 93 | foreach boolean_opt { "on" "off" } { |
b4f54984 DE |
94 | mi_gdb_test "maint set dwarf always-disassemble ${boolean_opt}" \ |
95 | "\\&\"maint set dwarf always-disassemble ${boolean_opt}\\\\n\"\r\n\\^done" \ | |
96 | "\"maint dwarf always-disassemble ${boolean_opt}\"" | |
5b9afe8a | 97 | } |
5b9afe8a | 98 | |
0a251e08 YQ |
99 | # Full command parameters are included in the notification when a |
100 | # abbreviated one is typed. | |
101 | mi_gdb_test "set ch type on" \ | |
102 | ".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \ | |
103 | "\"set ch type on\"" | |
5b9afe8a | 104 | |
0a251e08 | 105 | mi_gdb_exit |
5b9afe8a | 106 | } |
0a251e08 | 107 | } |
5b9afe8a YQ |
108 | |
109 | test_command_param_changed | |
110 | ||
111 | return 0 |