aboutsummaryrefslogtreecommitdiff
path: root/gdb/completer.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-12-08 17:32:34 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-12-11 22:10:50 +0000
commit1536146f30900b77c8381930669532f4073df196 (patch)
tree5d743ff450de62eb026bb9dbb99ffe4dc2abee14 /gdb/completer.c
parent966484941738b7a474fb7e4fe29eb5693fc9096c (diff)
downloadgdb-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/completer.c')
-rw-r--r--gdb/completer.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/gdb/completer.c b/gdb/completer.c
index 7f63ced..4c1ad25 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -1388,9 +1388,8 @@ complete_line_internal_1 (completion_tracker &tracker,
result_list = 0;
}
else
- {
- c = lookup_cmd_1 (&p, cmdlist, &result_list, NULL, ignore_help_classes);
- }
+ c = lookup_cmd_1 (&p, cmdlist, &result_list, NULL, ignore_help_classes,
+ true);
/* Move p up to the next interesting thing. */
while (*p == ' ' || *p == '\t')