aboutsummaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorTom Tromey <tromey@adacore.com>2022-11-17 10:24:38 -0700
committerTom Tromey <tromey@adacore.com>2022-11-28 13:22:40 -0700
commit1dd889362bb7027ebea754a161bf629270cc9042 (patch)
treecff34c092bd6716d84fce4d3fe032bd3c55eb645 /gdb/cli
parent2b141965f2ddef8cf3e79d357768a98c8703a5df (diff)
downloadgdb-1dd889362bb7027ebea754a161bf629270cc9042.zip
gdb-1dd889362bb7027ebea754a161bf629270cc9042.tar.gz
gdb-1dd889362bb7027ebea754a161bf629270cc9042.tar.bz2
Don't let gdb_stdlog use pager
When using the "set logging" commands, cli_interp_base::set_logging will send gdb_stdlog output (among others) to the tee it makes for gdb_stdout. However, this has the side effect of also causing logging to use the pager. This is PR gdb/29787. This patch fixes the problem by keeping stderr and stdlog separate from stdout, preserving the rule that only gdb_stdout should page. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29787
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-interp.c24
-rw-r--r--gdb/cli/cli-interp.h1
2 files changed, 15 insertions, 10 deletions
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 2e8f613..3254efc 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -389,24 +389,28 @@ cli_interp_base::set_logging (ui_file_up logfile, bool logging_redirect,
ui_file *logfile_p = logfile.get ();
m_saved_output->file_to_delete = std::move (logfile);
- /* If something is not being redirected, then a tee containing both the
- logfile and stdout. */
- ui_file *tee = nullptr;
- if (!logging_redirect || !debug_redirect)
+ /* The new stdout and stderr only depend on whether logging
+ redirection is being done. */
+ ui_file *new_stdout = logfile_p;
+ ui_file *new_stderr = logfile_p;
+ if (!logging_redirect)
{
m_saved_output->tee_to_delete.reset
(new tee_file (gdb_stdout, logfile_p));
- tee = m_saved_output->tee_to_delete.get ();
+ new_stdout = m_saved_output->tee_to_delete.get ();
+ m_saved_output->stderr_to_delete.reset
+ (new tee_file (gdb_stderr, logfile_p));
+ new_stderr = m_saved_output->stderr_to_delete.get ();
}
m_saved_output->log_to_delete.reset
- (new timestamped_file (debug_redirect ? logfile_p : tee));
+ (new timestamped_file (debug_redirect ? logfile_p : new_stderr));
- gdb_stdout = logging_redirect ? logfile_p : tee;
+ gdb_stdout = new_stdout;
gdb_stdlog = m_saved_output->log_to_delete.get ();
- gdb_stderr = logging_redirect ? logfile_p : tee;
- gdb_stdtarg = logging_redirect ? logfile_p : tee;
- gdb_stdtargerr = logging_redirect ? logfile_p : tee;
+ gdb_stderr = new_stderr;
+ gdb_stdtarg = new_stderr;
+ gdb_stdtargerr = new_stderr;
}
else
{
diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h
index fa007d7..978e7f2 100644
--- a/gdb/cli/cli-interp.h
+++ b/gdb/cli/cli-interp.h
@@ -42,6 +42,7 @@ private:
ui_file *targ;
ui_file *targerr;
ui_file_up tee_to_delete;
+ ui_file_up stderr_to_delete;
ui_file_up file_to_delete;
ui_file_up log_to_delete;
};