diff options
author | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-09-08 21:54:18 +0200 |
---|---|---|
committer | Philippe Waroquiers <philippe.waroquiers@skynet.be> | 2019-11-30 09:37:49 +0100 |
commit | be09caf15d3d57da2173d26abdb0bf92ef90f28f (patch) | |
tree | dee1e80c88e618bec9c24fe31e9a0f226d9208ec /gdb/testsuite | |
parent | 643c0cbedb4647702778ca8788a54053d1259d3b (diff) | |
download | gdb-be09caf15d3d57da2173d26abdb0bf92ef90f28f.zip gdb-be09caf15d3d57da2173d26abdb0bf92ef90f28f.tar.gz gdb-be09caf15d3d57da2173d26abdb0bf92ef90f28f.tar.bz2 |
Allow . character as part of command names.
This patch adds . as an allowed character for user defined commands.
Combined with 'define-prefix', this allows to e.g. define a set of Valgrind
specific user command corresponding to the Valgrind monitor commands
(such as check_memory, v.info, v.set, ...).
gdb/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* command.h (valid_cmd_char_p): Declare.
* cli/cli-decode.c (valid_cmd_char_p): New function factorizing
the check of valid command char.
(find_command_name_length, valid_user_defined_cmd_name_p): Use
valid_cmd_char_p.
* cli/cli-script.c (validate_comname): Likewise.
* completer.c (gdb_completer_command_word_break_characters):
Do not remove . from the word break char, update comments.
(complete_line_internal_1): Use valid_cmd_char_p.
* guile/scm-cmd.c (gdbscm_parse_command_name): Likewise.
* python/py-cmd.c (gdbpy_parse_command_name): Likewise.
gdb/testsuite/ChangeLog
2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.base/define.exp: Test . in command names.
* gdb.base/setshow.exp: Update test, as . is now part of
command name.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/define.exp | 25 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/setshow.exp | 2 |
3 files changed, 32 insertions, 1 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index a88c545..1f52d01 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,11 @@ 2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be> + * gdb.base/define.exp: Test . in command names. + * gdb.base/setshow.exp: Update test, as . is now part of + command name. + +2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be> + * gdb.base/define-prefix.exp: New file. 2019-11-28 Andrew Burgess <andrew.burgess@embecosm.com> diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index d7d4fd0..b5183ec 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -130,6 +130,31 @@ gdb_test "help nextwhere" \ " A next command that first shows you where you're stepping from.*" \ "preserve whitespace in help string" +# Verify that GDB allows a user to use . in a command name. +# +gdb_test_multiple "define dot.command" "define user command: dot.command" { + -re "Type commands for definition of \"dot.command\".\r\nEnd with a line saying just \"end\".\r\n>$" { + gdb_test "echo dot command\\n\nend" "" \ + "define user command: dot.command" + } +} + +# Verify that dot.command works. +# +gdb_test "dot.command" \ + "dot command" \ + "full name dot.command" +gdb_test "dot" \ + "dot command" \ + "partial name dot" +gdb_test "dot." \ + "dot command" \ + "partial name dot." +gdb_test "dot.c" \ + "dot command" \ + "partial name dot.c" + + # Verify that the command parser doesn't require a space after an 'if' # command in a user defined function. # diff --git a/gdb/testsuite/gdb.base/setshow.exp b/gdb/testsuite/gdb.base/setshow.exp index 717bcc3..394967b 100644 --- a/gdb/testsuite/gdb.base/setshow.exp +++ b/gdb/testsuite/gdb.base/setshow.exp @@ -355,7 +355,7 @@ gdb_test_no_output "set verbose off" "set verbose off" gdb_test "show verbose" "Verbosity is off..*" "show verbose (off)" #test argument must be preceded by space foreach x {"history file" "solib-search-path" "data-directory"} { - foreach y {"/home/" "." "~/home" "=home"} { + foreach y {"/home/" "~/home" "=home"} { gdb_test "set $x$y" "Argument must be preceded by space." \ "$x is not set to $y" } |