5b9afe8a35
* cli/cli-decode.c (set_cmd_prefix): New. (lookup_cmd_for_prefixlist): New. (add_prefix_cmd): Call set_cmd_prefix and update field 'prefix' of each cmd_list_element in *prefixlist. (add_setshow_cmd_full): set_cmd_prefix. (add_alias_cmd): Likewise. * cli/cli-decode.h (struct cmd_list_element) <prefix>: New field. Declare 'auto_boolean_enums'. * cli/cli-setshow.c: Include "observer.h". (notify_command_param_changed_p): New. (add_setshow_auto_boolean_cmd): Move auto_boolean_enums out. Remove 'static'. (do_setshow_command): Split it to ... (do_set_command, do_show_command): ... them. New. (do_set_command): Call observer_notify_command_param_changed if notify_command_param_changed_p returns true. (cmd_show_list): Caller update. * auto-load.c (set_auto_load_cmd): Likewise. * remote.c (show_remote_cmd): Likewise. * cli/cli-setshow.h: Update declarations. * top.c (execute_command): Call do_set_command and do_show_command. * NEWS: Mention new MI notification. * mi/mi-interp.c: Declare mi_command_param_changed. (mi_interpreter_init): Attach mi_command_param_changed to observer command_param_changed. (mi_command_param_changed): New. Remove mi_suppress_breakpoint_notifications. Define global variable mi_suppress_notification. (mi_breakpoint_created): Update. (mi_breakpoint_deleted): Likewise. (mi_breakpoint_modified): Likewise. * mi/mi-main.c (mi_cmd_execute): Likewise. Check command 'gdb-set' and set mi_suppress_notification. * mi/mi-main.h: (mi_suppress_notification): New struct. gdb/doc/ * observer.texi: New observer command_param_changed. * gdb.texinfo (GDB/MI Async Records): Doc for '=cmd-param-changed'. gdb/testsuite/ * gdb.mi/mi-cmd-param-changed.exp: New. * gdb.mi/mi-cli.exp: Update for MI notification "=cmd-param-changed". * gdb.mi/mi-var-rtti.exp, gdb.mi/mi2-cli.exp: Likewise. * gdb.mi/mi2-prompt.exp: Likewise.
103 lines
3.6 KiB
Text
103 lines
3.6 KiB
Text
# Copyright 2012 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
load_lib mi-support.exp
|
|
set MIFLAGS "-i=mi"
|
|
|
|
standard_testfile basics.c
|
|
|
|
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
untested mi-cmd-param-changed.exp
|
|
return -1
|
|
}
|
|
|
|
proc test_command_param_changed { } { with_test_prefix "cmd param" {
|
|
if [mi_gdb_start] {
|
|
return
|
|
}
|
|
mi_run_to_main
|
|
|
|
foreach opt { "on" "off" "step" } {
|
|
mi_gdb_test "set scheduler-locking ${opt}" \
|
|
".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
|
|
"\"set scheduler-locking ${opt}\""
|
|
}
|
|
foreach opt { "on" "off" "step" } {
|
|
mi_gdb_test "interpreter-exec console \"set scheduler-locking ${opt}\"" \
|
|
".*=cmd-param-changed,param=\"scheduler-locking\",value=\"${opt}\".*\\^done" \
|
|
"interpreter-exec \"set scheduler-locking ${opt}\""
|
|
}
|
|
# Don't emit MI notification for request from MI.
|
|
mi_gdb_test "-gdb-set scheduler-locking on" \
|
|
{\^done} \
|
|
"\"set scheduler-locking on\" no event (requested by MI)"
|
|
|
|
mi_gdb_test "interpreter-exec mi \"-gdb-set scheduler-locking step\"" \
|
|
"\\&\"interpreter-exec mi .*\"-gdb-set scheduler-locking step.*\"\\\\n\"\r\n\\^done\r\n\\^done" \
|
|
"\"set scheduler-locking step\" no event (requested by MI interp)"
|
|
mi_gdb_test "set scheduler-locking step" \
|
|
"\\&\"set scheduler-locking step\\\\n\"\r\n\\^done" \
|
|
"\"set scheduler-locking stepr\" no event"
|
|
|
|
|
|
foreach command { "circular-trace-buffer" "check type" } {
|
|
|
|
# The default value of each command option may be different, so we first
|
|
# set it to 'off', and this may or may not trigger MI notification.
|
|
mi_gdb_test "set ${command} off" ".*\\^done" "\"set ${command}\" warmup"
|
|
|
|
foreach boolean_opt { "on" "off" } {
|
|
mi_gdb_test "set ${command} ${boolean_opt}" \
|
|
".*=cmd-param-changed,param=\"${command}\",value=\"${boolean_opt}\".*\\^done" \
|
|
"\"set ${command} ${boolean_opt}\""
|
|
}
|
|
mi_gdb_test "set ${command} off" \
|
|
"\\&\"set ${command} off\\\\n\"\r\n\\^done" \
|
|
"\"set ${command}\" no event"
|
|
}
|
|
|
|
|
|
foreach command { "trace-notes" "remote exec-file" } {
|
|
foreach str_opt { "foo" "bar" } {
|
|
mi_gdb_test "set ${command} ${str_opt}" \
|
|
".*=cmd-param-changed,param=\"${command}\",value=\"${str_opt}\".*\\^done" \
|
|
"\"set ${command} ${str_opt}\""
|
|
}
|
|
mi_gdb_test "set ${command} bar" \
|
|
"\\&\"set ${command} bar\\\\n\"\r\n(\\&\"warning.*|)\\^done" \
|
|
"\"set ${command} bar\" no event"
|
|
}
|
|
|
|
# No notification is emitted for 'maint set' commands.
|
|
foreach command { "profile" "show-debug-regs" } {
|
|
foreach boolean_opt { "on" "off" } {
|
|
mi_gdb_test "maint set ${command} ${boolean_opt}" \
|
|
"\\&\"maint set ${command} ${boolean_opt}\\\\n\"\r\n\\^done" \
|
|
"\"maint set ${command} ${boolean_opt}\""
|
|
}
|
|
}
|
|
|
|
# Full command parameters are included in the notification when a
|
|
# abbreviated one is typed.
|
|
mi_gdb_test "set ch type on" \
|
|
".*=cmd-param-changed,param=\"check type\",value=\"on\".*\\^done" \
|
|
"\"set ch type on\""
|
|
|
|
mi_gdb_exit
|
|
}}
|
|
|
|
test_command_param_changed
|
|
|
|
return 0
|