gdb/testsuite/
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / mi-cmd-param-changed.exp
1 # Copyright 2012-2013 Free Software Foundation, Inc.
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
16 load_lib mi-support.exp
17 set MIFLAGS "-i=mi"
18
19 standard_testfile basics.c
20
21 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
22 untested mi-cmd-param-changed.exp
23 return -1
24 }
25
26 proc test_command_param_changed { } {
27 with_test_prefix "cmd param" {
28 if [mi_gdb_start] {
29 return
30 }
31 mi_run_to_main
32
33 foreach opt { "on" "off" "step" } {
34 mi_gdb_test "set scheduler-locking ${opt}" \
35 ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
36 "\"set scheduler-locking ${opt}\""
37 }
38 foreach opt { "on" "off" "step" } {
39 mi_gdb_test "interpreter-exec console \"set scheduler-locking ${opt}\"" \
40 ".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
41 "interpreter-exec \"set scheduler-locking ${opt}\""
42 }
43 # Don't emit MI notification for request from MI.
44 mi_gdb_test "-gdb-set scheduler-locking on" \
45 {\^done} \
46 "\"set scheduler-locking on\" no event (requested by MI)"
47
48 mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \
49 "\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \
50 "\"set scheduler-locking step\" no event (requested by MI interp)"
51 mi_gdb_test "set scheduler-locking step" \
52 "\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \
53 "\"set scheduler-locking stepr\" no event"
54
55
56 foreach command { "remotecache" "check type" } {
57
58 # The default value of each command option may be different, so we first
59 # set it to 'off', and this may or may not trigger MI notification.
60 mi_gdb_test "set ${command} off" ".*\\^done" "\"set ${command}\" warmup"
61
62 foreach boolean_opt { "on" "off" } {
63 mi_gdb_test "set ${command} ${boolean_opt}" \
64 ".*=cmd-param-changed,param=\"${command}\",value=\"${boolean_opt}\".*\\^done" \
65 "\"set ${command} ${boolean_opt}\""
66 }
67 mi_gdb_test "set ${command} off" \
68 "\\&\"set ${command} off\\\\n\"\r\n\\^done" \
69 "\"set ${command}\" no event"
70 }
71
72
73 foreach command { "trace-notes" "remote exec-file" } {
74 foreach str_opt { "foo" "bar" } {
75 mi_gdb_test "set ${command} ${str_opt}" \
76 ".*=cmd-param-changed,param=\"${command}\",value=\"${str_opt}\".*\\^done" \
77 "\"set ${command} ${str_opt}\""
78 }
79 mi_gdb_test "set ${command} bar" \
80 "\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \
81 "\"set ${command} bar\" no event"
82 }
83
84 # No notification is emitted for 'maint set' commands.
85 foreach boolean_opt { "on" "off" } {
86 mi_gdb_test "maint set profile ${boolean_opt}" \
87 "\\&\"maint set profile ${boolean_opt}\\\\n\"\r\n\\^done" \
88 "\"maint set profile ${boolean_opt}\""
89 }
90
91 # Full command parameters are included in the notification when a
92 # abbreviated one is typed.
93 mi_gdb_test "set ch type on" \
94 ".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \
95 "\"set ch type on\""
96
97 mi_gdb_exit
98 }
99 }
100
101 test_command_param_changed
102
103 return 0
This page took 0.03558 seconds and 5 git commands to generate.