From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 78EC33858D37 for ; Wed, 28 Dec 2022 06:59:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 78EC33858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E907F7665F; Wed, 28 Dec 2022 06:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1672210740; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OCZac6FSc7HaU2CM7BZ4jPij8WbwnyTy8B08I5bcZS8=; b=iea7Hj73J2IZxmiFYT6b9kEmPiLP4Hzd7SaeJICa71zY6pL1mMRHm/HNa5nStvkb4wOJ+u Zd8Vd4BzMb4I+Iy1f7ajGZExQr/hQWERQntnkC52e7yU+pdgtIPIEqAp/0SGuQyQZPozhF 0XC/h86G4QnsMj82PYerq+nk2Hm0Rlo= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1672210740; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OCZac6FSc7HaU2CM7BZ4jPij8WbwnyTy8B08I5bcZS8=; b=RCNi5NaOgIetk/LijF5bQEJ53WbPX6SdxGz+F0gwWiDISvoq+Gn2hHC55BfIdiGIlnfGEy 0XvITpwndEFlelBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E227C134F5; Wed, 28 Dec 2022 06:59:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id etgFNzTpq2PxIgAAMHmgww (envelope-from ); Wed, 28 Dec 2022 06:59:00 +0000 MIME-Version: 1.0 Date: Wed, 28 Dec 2022 06:59:00 +0000 From: tdevries To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Fix "set debug timestamp" In-Reply-To: <20221227233653.1151849-1-tom@tromey.com> References: <20221227233653.1151849-1-tom@tromey.com> User-Agent: Roundcube Webmail Message-ID: <4a6fb6caabed73555dcca9cdbb75311e@suse.de> X-Sender: tdevries@suse.de Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,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: On 2022-12-27 23:36, Tom Tromey wrote: > 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've applied the patch, ran the regression test without rebuilding and verified that it failed, then rebuild and verified that it passed. The code LGTM. FWIW, I think the regexp could be make more readable using $decimal: ... -gdb_test "print 23" "\[0-9\]+\\.\[0-9\]+ Operation: OP_LONG.* = 23" +gdb_test "print 23" "$decimal\\.$decimal Operation: OP_LONG.* = 23" ... > I think this should probably be backported to the gdb 13 branch. > Agreed. Thanks, - Tom > 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_);