aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2020-12-10 16:03:31 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2020-12-11 22:10:50 +0000
commit19c659f164b9dc672580ec459c9cfef84dd0f879 (patch)
treed04ecee3ab4fa36b055f2754dbc731cf7b3e21ac /gdb/testsuite
parent44c77c32720c25f56a34ec4114c7addf5836ba97 (diff)
downloadgdb-19c659f164b9dc672580ec459c9cfef84dd0f879.zip
gdb-19c659f164b9dc672580ec459c9cfef84dd0f879.tar.gz
gdb-19c659f164b9dc672580ec459c9cfef84dd0f879.tar.bz2
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.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/ChangeLog4
-rw-r--r--gdb/testsuite/gdb.base/commands.exp4
2 files changed, 6 insertions, 2 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 0eb3ce6..5796e61 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2020-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
+ * gdb.base/commands.exp: Update expected results.
+
+2020-12-11 Andrew Burgess <andrew.burgess@embecosm.com>
+
PR cli/15104
* gdb.base/commands.exp: Add additional tests.
* gdb.base/completion.exp: Add additional tests.
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp
index 19f712c..f621815 100644
--- a/gdb/testsuite/gdb.base/commands.exp
+++ b/gdb/testsuite/gdb.base/commands.exp
@@ -663,7 +663,7 @@ proc_with_prefix deprecated_command_test {} {
gdb_test_no_output "maintenance deprecate p \"new_p\"" "maintenance deprecate p \"new_p\" /1/"
gdb_test "p 5" \
- "Warning: 'p', an alias for the command 'print' is deprecated.*Use 'new_p'.*" \
+ "Warning: 'p', an alias for the command 'print', is deprecated.*Use 'new_p'.*" \
"p deprecated warning, with replacement"
gdb_test "p 5" ".\[0-9\]* = 5.*" "deprecated warning goes away /1/"
@@ -704,7 +704,7 @@ maintenance deprecate set qqq_aaa"
gdb_test_no_output "source $file1" \
"source file containing xxx_yyy command and its alias"
gdb_test "set qqq_aaa" \
- "Warning: 'qqq_aaa', an alias for the command 'xxx_yyy' is deprecated\\.\r\n.*No alternative known\\..*" \
+ "Warning: 'set qqq_aaa', an alias for the command 'set xxx_yyy', is deprecated\\.\r\n.*No alternative known\\..*" \
"deprecated alias with prefix give a warning"
file delete $file1