gdb: improve the warning given for deprecated aliases with a prefix
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 10 Dec 2020 16:03:31 +0000 (16:03 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 11 Dec 2020 22:10:50 +0000 (22:10 +0000)
commit19c659f164b9dc672580ec459c9cfef84dd0f879
treed04ecee3ab4fa36b055f2754dbc731cf7b3e21ac
parent44c77c32720c25f56a34ec4114c7addf5836ba97
gdb: improve the warning given for deprecated aliases with a prefix

Consider this GDB session:

  (gdb) define set xxx_yyy
  Type commands for definition of "set xxx_yyy".
  End with a line saying just "end".
  >echo in set xxx_yyy command\n
  >end
  (gdb) alias set qqq_aaa=set xxx_yyy
  (gdb) maintenance deprecate set qqq_aaa
  (gdb) set qqq_aaa
  Warning: 'qqq_aaa', an alias for the command 'xxx_yyy' is deprecated.
  No alternative known.

  in set xxx_yyy command
  (gdb)

Notice the warning mentions 'qqq_aaa' and 'xxx_yyy', I consider this
to be wrong.  I think the proper warning should read:

  (gdb) set qqq_aaa
  Warning: 'set qqq_aaa', an alias for the command 'set xxx_yyy', is deprecated.
  No alternative known.

With the 'set' prefixes added and a comma before the final 'is
deprecated'.  That is what this patch does.  The expected results are
updated as needed.

gdb/ChangeLog:

* cli/cli-decode.c (deprecated_cmd_warning): Ignore the prefix
result from lookup_cmd_composition_1, use the prefixes from both
the command and the alias instead.
(lookup_cmd_composition_1): Initial prefix command is the based on
the search list being passed in.  Simplify the logic for tracking
the prefix command.  Replace a use of alloca with a local
std::string.

gdb/testsuite/ChangeLog:

* gdb.base/commands.exp: Update expected results.
gdb/ChangeLog
gdb/cli/cli-decode.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/commands.exp
This page took 0.032251 seconds and 4 git commands to generate.