| 1 | # Copyright 2012-2016 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 "failed to compile" |
| 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 | mi_gdb_test "-exec-arguments foo" {\^done} \ |
| 48 | "\"-exec-arguments foo\" no event" |
| 49 | |
| 50 | mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \ |
| 51 | "\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \ |
| 52 | "\"set scheduler-locking step\" no event (requested by MI interp)" |
| 53 | mi_gdb_test "set scheduler-locking step" \ |
| 54 | "\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \ |
| 55 | "\"set scheduler-locking stepr\" no event" |
| 56 | |
| 57 | |
| 58 | foreach command { "remotecache" "check type" } { |
| 59 | |
| 60 | # The default value of each command option may be different, so we first |
| 61 | # set it to 'off', and this may or may not trigger MI notification. |
| 62 | mi_gdb_test "set ${command} off" ".*\\^done" "\"set ${command}\" warmup" |
| 63 | |
| 64 | foreach boolean_opt { "on" "off" } { |
| 65 | mi_gdb_test "set ${command} ${boolean_opt}" \ |
| 66 | ".*=cmd-param-changed,param=\"${command}\",value=\"${boolean_opt}\".*\\^done" \ |
| 67 | "\"set ${command} ${boolean_opt}\"" |
| 68 | } |
| 69 | mi_gdb_test "set ${command} off" \ |
| 70 | "\\&\"set ${command} off\\\\n\"\r\n\\^done" \ |
| 71 | "\"set ${command}\" no event" |
| 72 | } |
| 73 | |
| 74 | |
| 75 | foreach command { "trace-notes" "remote exec-file" } { |
| 76 | foreach str_opt { "foo" "bar" } { |
| 77 | mi_gdb_test "set ${command} ${str_opt}" \ |
| 78 | ".*=cmd-param-changed,param=\"${command}\",value=\"${str_opt}\".*\\^done" \ |
| 79 | "\"set ${command} ${str_opt}\"" |
| 80 | } |
| 81 | mi_gdb_test "set ${command} bar" \ |
| 82 | "\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \ |
| 83 | "\"set ${command} bar\" no event" |
| 84 | } |
| 85 | |
| 86 | # No notification is emitted for 'maint set' commands. |
| 87 | foreach boolean_opt { "on" "off" } { |
| 88 | mi_gdb_test "maint set dwarf always-disassemble ${boolean_opt}" \ |
| 89 | "\\&\"maint set dwarf always-disassemble ${boolean_opt}\\\\n\"\r\n\\^done" \ |
| 90 | "\"maint dwarf always-disassemble ${boolean_opt}\"" |
| 91 | } |
| 92 | |
| 93 | # Full command parameters are included in the notification when a |
| 94 | # abbreviated one is typed. |
| 95 | mi_gdb_test "set ch type on" \ |
| 96 | ".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \ |
| 97 | "\"set ch type on\"" |
| 98 | |
| 99 | mi_gdb_exit |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | test_command_param_changed |
| 104 | |
| 105 | return 0 |