diff options
author | Daniel Jacobowitz <drow@false.org> | 2009-01-14 20:40:09 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2009-01-14 20:40:09 +0000 |
commit | adb483feb8b53555613d1165a6c6de4bdc1a5160 (patch) | |
tree | e2c58af8524daf15debeb52548bfb3215718f54c /gdb/testsuite | |
parent | a32d7317c7ae58c986b499ad11028dbf49a15da1 (diff) | |
download | gdb-adb483feb8b53555613d1165a6c6de4bdc1a5160.zip gdb-adb483feb8b53555613d1165a6c6de4bdc1a5160.tar.gz gdb-adb483feb8b53555613d1165a6c6de4bdc1a5160.tar.bz2 |
* NEWS: Document "define" for prefixed commands.
* cli/cli-cmds.c (show_user): Update calls to show_user_1. Call
show_user_1 for prefix commands.
* cli/cli-decode.c (help_cmd_list): Recurse for "help user-defined".
* cli/cli-script.c (validate_comname): Rewrite to handle prefix
commands. Return the containing command list.
(define_command, document_command): Update to handle prefix commands.
(show_user_1): Add prefix and name arguments. Handle prefix
commands.
* cli/cli-script.h (show_user_1): Update prototype.
doc/
* gdb.texinfo (Define, Hooks): Document prefix command support.
testsuite/
* gdb.base/define.exp: Test defining and hooking prefix commands.
* gdb.python/python.exp: Update test for "show user" output.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/define.exp | 37 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 2 |
3 files changed, 37 insertions, 7 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c826676..0795f58 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-01-14 Daniel Jacobowitz <dan@codesourcery.com> + + * gdb.base/define.exp: Test defining and hooking prefix commands. + * gdb.python/python.exp: Update test for "show user" output. + 2009-01-07 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.fortran/derived-type.exp: New variables int4 and real4. Match diff --git a/gdb/testsuite/gdb.base/define.exp b/gdb/testsuite/gdb.base/define.exp index bce5bdb..3ef27ae 100644 --- a/gdb/testsuite/gdb.base/define.exp +++ b/gdb/testsuite/gdb.base/define.exp @@ -346,6 +346,37 @@ gdb_expect { timeout {fail "(timeout) define hook undefined command: bar"} } +# Test creation of an additional target subcommand. +gdb_test_multiple "define target testsuite" "" { + -re "Type commands for definition of \"target testsuite\".\r\nEnd with a line saying just \"end\".\r\n>$" { + gdb_test "printf \"hello\\n\"\nend" "" "define target testsuite" + } +} +gdb_test_multiple "document target testsuite" "" { + -re "Type documentation for \"target testsuite\".\r\nEnd with a line saying just \"end\".\r\n>$" { + gdb_test "A test target.\nend" "" "document target testsuite" + } +} + +gdb_test "help target" ".*A test target.*" +gdb_test "target testsuite" "hello" +gdb_test "show user target testsuite" "User command \"target testsuite\":\r\n printf \"hello\\\\n\"\r\n" + +# We should even be able to hook subcommands. +gdb_test_multiple "define target hook-testsuite" "" { + -re "Type commands for definition of \"target hook-testsuite\".\r\nEnd with a line saying just \"end\".\r\n>$" { + gdb_test "printf \"one\\n\"\nend" "" "define target hook-testsuite" + } +} + +gdb_test_multiple "define target hookpost-testsuite" "" { + -re "Type commands for definition of \"target hookpost-testsuite\".\r\nEnd with a line saying just \"end\".\r\n>$" { + gdb_test "printf \"two\\n\"\nend" "" "define target hookpost-testsuite" + } +} + +gdb_test "target testsuite" "one\r\nhello\r\ntwo" "target testsuite with hooks" + # This is a quasi-define command: Verify that the user can redefine # GDB's gdb_prompt. # @@ -367,9 +398,3 @@ gdb_expect { gdb_exit return 0 - - - - - - diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 201e1c5..a0c9b39 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -63,7 +63,7 @@ gdb_py_test_multiple "show python command" \ "print 23" "" \ "end" "" \ "end" "" \ - "show user zzq" "User command zzq:.* python.*print 23.* end" + "show user zzq" "User command \"zzq\":.* python.*print 23.* end" gdb_py_test_multiple "indented multi-line python command" \ "python" "" \ |