From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id 7640E385840E; Wed, 28 Dec 2022 16:48:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7640E385840E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1672246093; bh=5QZTkYeeQxuLcML+NeU6iQTyJA/Ui3PWqCXBxvsOCLI=; h=From:To:Subject:Date:From; b=cEKwBGstM71ms1WET8k1h/PgSCKImx2tP7J/efHV+i6seo5WTF2pJhCocKbzTxAnY 6MZytGBqJoXOaOiJtbMbwea+1/4/ylpAn4ZP24SI7hSE3FA3j5NG8SUchBaWnBfNZv e/oWM3RjDP8BhT+VhjH7W2LHXJvgXwS6CFt0kuc8= 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/gdb-13-branch] Fix "set debug timestamp" X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/gdb-13-branch X-Git-Oldrev: bb9bdfb840f43036fbab27ace2fedefa698abe9b X-Git-Newrev: ecb7214fc18f63693dac6065e36802e0677412e7 Message-Id: <20221228164813.7640E385840E@sourceware.org> Date: Wed, 28 Dec 2022 16:48:13 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Decb7214fc18f= 63693dac6065e36802e0677412e7 commit ecb7214fc18f63693dac6065e36802e0677412e7 Author: Tom Tromey Date: Tue Dec 27 16:34:44 2022 -0700 Fix "set debug timestamp" =20 PR cli/29945 points out that "set debug timestamp 1" stopped working -- this is a regression due to commit b8043d27 ("Remove a ui-related memory leak"). =20 This patch fixes the bug and adds a regression test. =20 I think this should probably be backported to the gdb 13 branch. =20 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29945 =20 (cherry picked from commit a60535c39ba52d88c47740db6ab116db32e2331a) Diff: --- gdb/testsuite/gdb.base/timestamp.exp | 24 ++++++++++++++++++++++++ gdb/top.c | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/timestamp.exp b/gdb/testsuite/gdb.base/= timestamp.exp new file mode 100644 index 00000000000..3d124b450e5 --- /dev/null +++ b/gdb/testsuite/gdb.base/timestamp.exp @@ -0,0 +1,24 @@ +# Copyright 2022 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# Test that timestamps are printed when logging. + +clean_restart + +# This is a simple way to get logging output. +gdb_test_no_output "set debug expression 1" +gdb_test_no_output "set debug timestamp 1" + +gdb_test "print 23" "\[0-9\]+\\.\[0-9\]+ Operation: OP_LONG.* =3D 23" diff --git a/gdb/top.c b/gdb/top.c index b732f29653f..1422c880470 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -305,7 +305,7 @@ ui::ui (FILE *instream_, FILE *outstream_, FILE *errstr= eam_) m_gdb_stdout (new pager_file (new stdio_file (outstream))), m_gdb_stdin (new stdio_file (instream)), m_gdb_stderr (new stderr_file (errstream)), - m_gdb_stdlog (m_gdb_stderr) + m_gdb_stdlog (new timestamped_file (m_gdb_stderr)) { unbuffer_stream (instream_);