From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gproxy1-pub.mail.unifiedlayer.com (gproxy1-pub.mail.unifiedlayer.com [69.89.25.95]) by sourceware.org (Postfix) with ESMTPS id 271B93858D37 for ; Tue, 27 Dec 2022 23:37:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 271B93858D37 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw15.mail.unifiedlayer.com (unknown [10.0.90.130]) by progateway3.mail.pro1.eigbox.com (Postfix) with ESMTP id 9475010047345 for ; Tue, 27 Dec 2022 23:37:02 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id AJVGpnWxoknHmAJVGpNFh8; Tue, 27 Dec 2022 23:37:02 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=J95vUCrS c=1 sm=1 tr=0 ts=63ab819e a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=sHyYjHe8cH0A:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=CCpqsmhAAAAA:8 a=mDV3o1hIAAAA:8 a=0q591cmdQctjq-SlzEMA:9 a=ul9cdbp4aOFLsgKbc677:22 a=_FVE-zBwftR9WsbkzFJk:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=39owli3hyKFesWkB5YoRR7vVWnSrJSLNTqgfoEHaeGY=; b=uO/RE5noscrS6yXVfo5OxgVZFd uG8wKJyBS/YqBofi11vbLiwYT+0iFS048lVapw65NbzPm4zsbq0o20fS5sTqOW/RQF8s95SdVX3Na mIqTYlAeAlN69yQ3JH5Oml5XM; Received: from 97-122-76-186.hlrn.qwest.net ([97.122.76.186]:58700 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pAJVG-0047O7-7P; Tue, 27 Dec 2022 16:37:02 -0700 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix "set debug timestamp" Date: Tue, 27 Dec 2022 16:36:53 -0700 Message-Id: <20221227233653.1151849-1-tom@tromey.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 97.122.76.186 X-Source-L: No X-Exim-ID: 1pAJVG-0047O7-7P X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-76-186.hlrn.qwest.net (localhost.localdomain) [97.122.76.186]:58700 X-Source-Auth: tom+tromey.com X-Email-Count: 1 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3028.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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"). This patch fixes the bug and adds a regression test. I think this should probably be backported to the gdb 13 branch. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29945 --- gdb/testsuite/gdb.base/timestamp.exp | 24 ++++++++++++++++++++++++ gdb/top.c | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gdb/testsuite/gdb.base/timestamp.exp 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.* = 23" diff --git a/gdb/top.c b/gdb/top.c index 565b455a020..91b4e6a3cfe 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -305,7 +305,7 @@ ui::ui (FILE *instream_, FILE *outstream_, FILE *errstream_) 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_); -- 2.38.1