diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-18 16:10:59 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-05-04 15:58:07 -0600 |
commit | 7a2c85f25977ff9b11728ba85b1417538e22c246 (patch) | |
tree | 941f548ed63c2bd4099110d92ff7d4089d88a9d1 /gdb/testsuite/gdb.base/commands.exp | |
parent | Constify prompt argument to read_command_lines (diff) | |
download | binutils-gdb-7a2c85f25977ff9b11728ba85b1417538e22c246.tar.gz binutils-gdb-7a2c85f25977ff9b11728ba85b1417538e22c246.tar.bz2 binutils-gdb-7a2c85f25977ff9b11728ba85b1417538e22c246.zip |
Allow defining a user command inside a user command
PR gdb/11750 concerns defining a command inside a user commnad, like:
define outer
define inner
echo hi\n
end
end
This patch adds this capability to gdb.
ChangeLog
2018-05-04 Tom Tromey <tom@tromey.com>
PR gdb/11750:
* cli/cli-script.h (enum command_control_type) <define_control>:
New constant.
* cli/cli-script.c (multi_line_command_p): Handle define_control.
(build_command_line, execute_control_command_1)
(process_next_line): Likewise.
(do_define_command): New function, extracted from define_command.
(define_command): Use it.
testsuite/ChangeLog
2018-05-04 Tom Tromey <tom@tromey.com>
PR gdb/11750:
* gdb.base/define.exp: Test defining a user command inside a user
command.
* gdb.base/commands.exp (define_if_without_arg_test): Test "define".
Diffstat (limited to 'gdb/testsuite/gdb.base/commands.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/commands.exp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gdb/testsuite/gdb.base/commands.exp b/gdb/testsuite/gdb.base/commands.exp index b33e5124ec7..259b89b803d 100644 --- a/gdb/testsuite/gdb.base/commands.exp +++ b/gdb/testsuite/gdb.base/commands.exp @@ -1014,7 +1014,7 @@ proc_with_prefix redefine_backtrace_test {} { # Test using "if" and "while" without args when building a command list. proc define_if_without_arg_test {} { - foreach cmd {if while} { + foreach cmd {if while define} { set test "define some_command_$cmd" gdb_test_multiple $test $test { -re "End with" { @@ -1022,7 +1022,7 @@ proc define_if_without_arg_test {} { } } - gdb_test "$cmd" "if/while commands require arguments." "type $cmd without args" + gdb_test "$cmd" "$cmd command requires an argument." "type $cmd without args" } } |