diff options
author | Alan Hayward <alan.hayward@arm.com> | 2019-05-17 14:07:04 +0100 |
---|---|---|
committer | Alan Hayward <alan.hayward@arm.com> | 2019-05-17 14:07:04 +0100 |
commit | f3a09c800fcd1d597fa2b9578cb59adfc15b698d (patch) | |
tree | 0cfd6d8b1c65fb029a59d706d47aee2f92c990c7 /gdb/testsuite | |
parent | af4fa23fba220c1b26bb3c8a7996b406dcc181cc (diff) | |
download | gdb-f3a09c800fcd1d597fa2b9578cb59adfc15b698d.zip gdb-f3a09c800fcd1d597fa2b9578cb59adfc15b698d.tar.gz gdb-f3a09c800fcd1d597fa2b9578cb59adfc15b698d.tar.bz2 |
Change file close behavior for tee_file
Instead of using two bools to decide if the files should close when tee_file
is closed, make file one stay open and file two close. This simplifies the
use cases for it.
Inline the make_logging_output into the calling functions (the logic here
looks ugly in order to simplify a later change).
Expand ui-redirect.exp to cover the changes, similar to mi-logging.exp.
gdb/ChangeLog:
* cli/cli-interp.c (cli_interp_base::set_logging): Create tee_file
directly.
* cli/cli-interp.h (make_logging_output): Remove declaration.
* cli/cli-logging.c (make_logging_output): Remove function.
* mi/mi-interp.c (mi_interp::set_logging): Create tee_file
directly.
* ui-file.c (tee_file::tee_file): Remove bools.
(tee_file::~tee_file): Remove deletes.
* ui-file.h (tee_file): Remove bools.
gdb/testsuite/ChangeLog:
* gdb.base/ui-redirect.exp: Test redirection.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/ui-redirect.exp | 30 |
2 files changed, 29 insertions, 5 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index bdabbc7..6d35156 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2019-05-17 Alan Hayward <alan.hayward@arm.com> + + * gdb.base/ui-redirect.exp: Test redirection. + 2019-01-28 Jan Vrany <jan.vrany@fit.cvut.cz> * gdb.mi/mi-complete.exp: New file. diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp index 1ebff79..f1d00b9 100644 --- a/gdb/testsuite/gdb.base/ui-redirect.exp +++ b/gdb/testsuite/gdb.base/ui-redirect.exp @@ -34,8 +34,28 @@ gdb_test_multiple $test $test { } gdb_test_no_output "end" -gdb_test_no_output "set logging file /dev/null" -gdb_test "set logging on" "Copying output to /dev/null\\." -gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." -gdb_test "set logging off" "Done logging to /dev/null\\." -gdb_test "help" "List of classes of commands:.*" +with_test_prefix "logging" { + gdb_test_no_output "set logging file /dev/null" + gdb_test "set logging on" "Copying output to /dev/null\\." + gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." + gdb_test "set logging off" "Done logging to /dev/null\\." + gdb_test "help" "List of classes of commands:.*" +} + +with_test_prefix "redirect" { + gdb_test "set logging redirect on" + gdb_test "set logging on" "Redirecting output to /dev/null\\." + gdb_test_no_output "save breakpoints /dev/null" + gdb_test "set logging off" "Done logging to /dev/null\\." + gdb_test "help" "List of classes of commands:.*" +} + +with_test_prefix "redirect while already logging" { + gdb_test_no_output "set logging redirect off" + gdb_test "set logging on" "Copying output to /dev/null\\." + gdb_test "set logging redirect on" \ + ".*warning: Currently logging .*Turn the logging off and on to make the new setting effective.*" + gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." + gdb_test "set logging off" "Done logging to /dev/null\\." + gdb_test "help" "List of classes of commands:.*" +} |