From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id B8B7938532F9; Mon, 28 Nov 2022 20:41:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B8B7938532F9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1669668106; bh=dMEwQKVt/nM604+OlEv6d01Omz//Ww7G54712nR7VHI=; h=From:To:Subject:Date:From; b=vhPIZr9Rk9rj5APQed8DBUZPhq7SyHIb7005h538nX9SiCPdDw2dUIAleyhk5XaG/ cmDezbX2+afstRQsSzVle7u8MOk2Wi8TtzHhJuEsVjqS92PYxFABHcceDYHlBYD+yi SqWaiuEDA8UONow0Vox5RJLQQGWAgEFawUm4zCkw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Don't let gdb_stdlog use pager X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: 2b141965f2ddef8cf3e79d357768a98c8703a5df X-Git-Newrev: 1dd889362bb7027ebea754a161bf629270cc9042 Message-Id: <20221128204146.B8B7938532F9@sourceware.org> Date: Mon, 28 Nov 2022 20:41:46 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D1dd889362bb7= 027ebea754a161bf629270cc9042 commit 1dd889362bb7027ebea754a161bf629270cc9042 Author: Tom Tromey Date: Thu Nov 17 10:24:38 2022 -0700 Don't let gdb_stdlog use pager =20 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. =20 This patch fixes the problem by keeping stderr and stdlog separate from stdout, preserving the rule that only gdb_stdout should page. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29787 Diff: --- gdb/cli/cli-interp.c | 24 ++++++++++++++---------- gdb/cli/cli-interp.h | 1 + 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c index 2e8f6135405..3254efc3581 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, boo= l logging_redirect, ui_file *logfile_p =3D logfile.get (); m_saved_output->file_to_delete =3D std::move (logfile); =20 - /* If something is not being redirected, then a tee containing both = the - logfile and stdout. */ - ui_file *tee =3D nullptr; - if (!logging_redirect || !debug_redirect) + /* The new stdout and stderr only depend on whether logging + redirection is being done. */ + ui_file *new_stdout =3D logfile_p; + ui_file *new_stderr =3D logfile_p; + if (!logging_redirect) { m_saved_output->tee_to_delete.reset (new tee_file (gdb_stdout, logfile_p)); - tee =3D m_saved_output->tee_to_delete.get (); + new_stdout =3D m_saved_output->tee_to_delete.get (); + m_saved_output->stderr_to_delete.reset + (new tee_file (gdb_stderr, logfile_p)); + new_stderr =3D m_saved_output->stderr_to_delete.get (); } =20 m_saved_output->log_to_delete.reset - (new timestamped_file (debug_redirect ? logfile_p : tee)); + (new timestamped_file (debug_redirect ? logfile_p : new_stderr)); =20 - gdb_stdout =3D logging_redirect ? logfile_p : tee; + gdb_stdout =3D new_stdout; gdb_stdlog =3D m_saved_output->log_to_delete.get (); - gdb_stderr =3D logging_redirect ? logfile_p : tee; - gdb_stdtarg =3D logging_redirect ? logfile_p : tee; - gdb_stdtargerr =3D logging_redirect ? logfile_p : tee; + gdb_stderr =3D new_stderr; + gdb_stdtarg =3D new_stderr; + gdb_stdtargerr =3D new_stderr; } else { diff --git a/gdb/cli/cli-interp.h b/gdb/cli/cli-interp.h index fa007d78621..978e7f291e4 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; };