aboutsummaryrefslogtreecommitdiff
path: root/gdb/ui-file.h
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2019-05-17 14:07:04 +0100
committerAlan Hayward <alan.hayward@arm.com>2019-05-17 14:07:04 +0100
commitf3a09c800fcd1d597fa2b9578cb59adfc15b698d (patch)
tree0cfd6d8b1c65fb029a59d706d47aee2f92c990c7 /gdb/ui-file.h
parentaf4fa23fba220c1b26bb3c8a7996b406dcc181cc (diff)
downloadgdb-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/ui-file.h')
-rw-r--r--gdb/ui-file.h15
1 files changed, 6 insertions, 9 deletions
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 56f0c0f..39f56d5 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -267,11 +267,9 @@ public:
class tee_file : public ui_file
{
public:
- /* Create a file which writes to both ONE and TWO. CLOSE_ONE and
- CLOSE_TWO indicate whether the original files should be closed
- when the new file is closed. */
- tee_file (ui_file *one, bool close_one,
- ui_file *two, bool close_two);
+ /* Create a file which writes to both ONE and TWO. ONE will remain
+ open when this object is destroyed; but TWO will be closed. */
+ tee_file (ui_file *one, ui_file_up &&two);
~tee_file () override;
void write (const char *buf, long length_buf) override;
@@ -284,10 +282,9 @@ public:
void flush () override;
private:
- /* The two underlying ui_files, and whether they should each be
- closed on destruction. */
- ui_file *m_one, *m_two;
- bool m_close_one, m_close_two;
+ /* The two underlying ui_files. */
+ ui_file *m_one;
+ ui_file_up m_two;
};
#endif