diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2020-05-05 21:38:38 +0200 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2020-05-15 22:17:45 +0200 |
commit | 0605465feb51d7a8552db8019c5cfc8a5fc22c3f (patch) | |
tree | 04ab765e122b7c1b032898d9d4ec721069b1cb11 /gdb/testsuite | |
parent | 58e6ac70065131e82e0256f571e5277553096051 (diff) | |
download | gdb-0605465feb51d7a8552db8019c5cfc8a5fc22c3f.zip gdb-0605465feb51d7a8552db8019c5cfc8a5fc22c3f.tar.gz gdb-0605465feb51d7a8552db8019c5cfc8a5fc22c3f.tar.bz2 |
Fix problem that alias can be defined or not depending on the order.
When an alias name starts with the name of another alias,
GDB was accepting to define the aliases in one order (short first, long after),
but refused it the other way around.
So, fix the logic to recognise an already existing alias by using
lookup_cmd_composition.
Also, this revealed a bug in lookup_cmd_composition:
when the searched command is a prefix command, lookup_cmd_composition
was not returning the fact that a command was found even if the
TEXT to parse was fully consumed.
gdb/ChangeLog
YYYY-MM-DD Philippe Waroquiers <philippe.waroquiers@skynet.be>
* cli/cli-cmds.c (alias_command): Check for an existing alias
using lookup_cmd_composition, as valid_command_p is too strict
and forbids aliases that are the prefix of an existing alias
or command.
* cli/cli-decode.c (lookup_cmd_composition): Ensure a prefix
command is properly recognised as a valid command.
gdb/testsuite/ChangeLog
2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/alias.exp: Test aliases starting with a prefix of
another alias.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/alias.exp | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index dda5b68..820af44 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-05-15 Philippe Waroquiers <philippe.waroquiers@skynet.be> + + * gdb.base/alias.exp: Test aliases starting with a prefix of + another alias. + 2020-05-15 Gary Benson <gbenson@redhat.com> * gdb.base/info-os.c (main): Add return statement. diff --git a/gdb/testsuite/gdb.base/alias.exp b/gdb/testsuite/gdb.base/alias.exp index be78d9e..9a95576 100644 --- a/gdb/testsuite/gdb.base/alias.exp +++ b/gdb/testsuite/gdb.base/alias.exp @@ -116,3 +116,9 @@ gdb_test "show print elements" "Limit .* is 56\[.\]" "verify 56" gdb_test_no_output "set print max-elements 57" gdb_test "show print elements" "Limit .* is 57\[.\]" "verify 57" + +# Test aliases having a common prefix. +gdb_test_no_output "alias abcd = backtrace" +gdb_test_no_output "alias abcde = backtrace" +gdb_test_no_output "alias fghij = backtrace" +gdb_test_no_output "alias fghi = backtrace" |