diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-12-08 17:32:34 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2020-12-11 22:10:50 +0000 |
commit | 1536146f30900b77c8381930669532f4073df196 (patch) | |
tree | 5d743ff450de62eb026bb9dbb99ffe4dc2abee14 /gdb/testsuite/gdb.base | |
parent | 966484941738b7a474fb7e4fe29eb5693fc9096c (diff) | |
download | gdb-1536146f30900b77c8381930669532f4073df196.zip gdb-1536146f30900b77c8381930669532f4073df196.tar.gz gdb-1536146f30900b77c8381930669532f4073df196.tar.bz2 |
gdb: don't warn about deprecated aliases during tab completion
Consider this gdb session, where on line #3 tab completion is used:
(gdb) alias xxx_yyy_zzz=break
(gdb) maint deprecate xxx_yyy_zzz
(gdb) xxx_yyy_<TAB>
The third line then updates to look like this:
(gdb) xxx_yyy_Warning: 'xxx_yyy_zzz', an alias for the command 'break' is deprecated.
No alternative known.
zzz
What's happened is during tab completion the alias has been resolved
to the actual command being aliased, and at this stage the warning is
issued. Clearly this is not what we want during tab completion.
In this commit I add a new parameter to the lookup function, a boolean
that indicates if the lookup is being done as part of completion.
This flag is used to suppress the warning. Now we get the expected
behaviour, the alias completes without any warning, but the warning is
still given once the user executes the alias.
gdb/ChangeLog:
* cli/cli-decode.c (lookup_cmd_1): Move header comment into
command.h, add extra parameter, and use this to guard giving a
warning.
* command.h (lookup_cmd_1): Add comment from cli/cli-decode.c,
include argument names in declaration, add new argument.
* completer.c (complete_line_internal_1): Remove unneeded
brackets, pass extra argument to lookup_cmd_1.
gdb/testsuite/ChangeLog:
* gdb.base/completion.exp: Add additional tests.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/completion.exp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/completion.exp b/gdb/testsuite/gdb.base/completion.exp index 1c5d03b..14d56a5 100644 --- a/gdb/testsuite/gdb.base/completion.exp +++ b/gdb/testsuite/gdb.base/completion.exp @@ -962,3 +962,9 @@ foreach_with_prefix cmd { "watch" "awatch" "rwatch" } { } } } + +# Check that tab completion of a deprecated alias does not display the +# warning about the alias being deprecated during tab completion. +gdb_test_no_output "alias xxx_yyy_zzz=break" +gdb_test_no_output "maint deprecate xxx_yyy_zzz" +test_gdb_complete_unique "xxx_yyy_" "xxx_yyy_zzz" |