diff options
author | Pedro Alves <palves@redhat.com> | 2019-06-13 00:06:52 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2019-06-13 00:17:58 +0100 |
commit | dee7b4c83a636471ee321fb4fe1c3be0a16a9ea7 (patch) | |
tree | 7cca7c8f9d80b735aab6746745c9b13b68faba55 /gdb/testsuite | |
parent | dca0f6c0a4bafff9039d8bdb2a7efec9f70ce82f (diff) | |
download | gdb-dee7b4c83a636471ee321fb4fe1c3be0a16a9ea7.zip gdb-dee7b4c83a636471ee321fb4fe1c3be0a16a9ea7.tar.gz gdb-dee7b4c83a636471ee321fb4fe1c3be0a16a9ea7.tar.bz2 |
boolean/auto-boolean commands, make "o" ambiguous
We currently accept "o" with boolean/auto-boolean commands, taking it
to mean "on". But "o" is ambiguous, between "on" and "off". I can't
imagine why assuming the user wanted to type "on" is a good idea, it
might have been a typo.
This commit makes gdb error out. We now get:
(gdb) maint test-settings set boolean o
"on" or "off" expected.
(gdb) maint test-settings set auto-boolean o
"on", "off" or "auto" expected.
gdb/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* cli/cli-setshow.c (parse_auto_binary_operation)
(parse_cli_boolean_value): Don't allow "o".
gdb/testsuite/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.base/settings.exp (test-boolean, test-auto-boolean): Check
that "o" is ambiguous.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/settings.exp | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 85fa7e0..1c362f7 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2019-06-13 Pedro Alves <palves@redhat.com> + * gdb.base/settings.exp (test-boolean, test-auto-boolean): Check + that "o" is ambiguous. + +2019-06-13 Pedro Alves <palves@redhat.com> + * gdb.base/settings.c: New file. * gdb.base/settings.exp: New file. diff --git a/gdb/testsuite/gdb.base/settings.exp b/gdb/testsuite/gdb.base/settings.exp index f96e9f6..4a7319d 100644 --- a/gdb/testsuite/gdb.base/settings.exp +++ b/gdb/testsuite/gdb.base/settings.exp @@ -194,13 +194,16 @@ proc_with_prefix test-boolean {} { gdb_test "$set_cmd auto" \ "\"on\" or \"off\" expected\\." + # "o" is ambiguous. + gdb_test "$set_cmd o" \ + "\"on\" or \"off\" expected\\." + # Various valid values. Test both full value names and # abbreviations. # Note that unlike with auto-bool, empty value implies "on". foreach_with_prefix value { "" - "o" "on" "1" "y" @@ -278,11 +281,14 @@ proc_with_prefix test-auto-boolean {} { gdb_test "$set_cmd on 1" \ "\"on\", \"off\" or \"auto\" expected\\." + # "o" is ambiguous. + gdb_test "$set_cmd o" \ + "\"on\", \"off\" or \"auto\" expected\\." + # Various valid values. Test both full value names and # abbreviations. foreach_with_prefix value { - "o" "on" "1" "y" |