From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id UT8zEFKxfGl6rx0AWB0awg (envelope-from ) for ; Fri, 30 Jan 2026 08:25:38 -0500 Authentication-Results: simark.ca; dkim=fail reason="signature verification failed" (768-bit key; unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=NE+g8ob/; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3E7E41E0DD; Fri, 30 Jan 2026 08:25:38 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=no autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id AFF291E08D for ; Fri, 30 Jan 2026 08:25:37 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 508524BB58A2 for ; Fri, 30 Jan 2026 13:25:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 508524BB58A2 Authentication-Results: sourceware.org; dkim=fail reason="signature verification failed" (768-bit key, unprotected) header.d=tromey.com header.i=@tromey.com header.a=rsa-sha256 header.s=default header.b=NE+g8ob/ Received: from omta038.useast.a.cloudfilter.net (omta038.useast.a.cloudfilter.net [44.202.169.37]) by sourceware.org (Postfix) with ESMTPS id 66CF64BA9029 for ; Fri, 30 Jan 2026 13:17:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 66CF64BA9029 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 66CF64BA9029 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=44.202.169.37 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779047; cv=none; b=ajL1W7JYzTxCl8aw8TzbjHxEXvwsbPF7WlQXJ4mvvXFr2cLOx3ywugCU49iQEoMuOdfloEV/9JFuvUq0D8hnSrPRxeAk15Rnmc213E6ePK/w+5Y49kSyKD06BIqYLN/QlbRR1vmdnnoic0E+xT35g3jsdx1jjvnSxsqVob9GRFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1769779047; c=relaxed/simple; bh=/dIs3o+IhHq4O9bSBxbcGc9yGFkBR+HcP5UQjExtKHk=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=wD1j7cIg1+ORrkqr/ipZ2MtSmnTM8TIqvAGnjtCmKryGfRwTxeHl/tphVh49ZYOFLEQ5EqC/UFNUY1DeDPRZ5DJsC/hbUwF6oeW1H3C1EwFXPkVdthqRnwdyrjM8ozHVe623JraGaaz9OdXPBzWQjAJ2+8TMSw65jzBW13nUbmo= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 66CF64BA9029 Received: from eig-obgw-5005b.ext.cloudfilter.net ([10.0.29.189]) by cmsmtp with ESMTPS id lmq0vFqRjSkcfloNLvvWYr; Fri, 30 Jan 2026 13:17:27 +0000 Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTPS id loNKv7rVVjAxuloNLv4Ihq; Fri, 30 Jan 2026 13:17:27 +0000 X-Authority-Analysis: v=2.4 cv=EoDSrTcA c=1 sm=1 tr=0 ts=697caf67 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=IkcTkHD0fZMA:10 a=vUbySO9Y5rIA:10 a=ItBw4LHWJt0A:10 a=CCpqsmhAAAAA:8 a=20KFwNOVAAAA:8 a=bgcdYZZvV6gKSkajS7oA:9 a=QEXdDO2ut3YA:10 a=ul9cdbp4aOFLsgKbc677:22 a=DCx65vhANUyCzuf5D8fC:22 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Cc:To:In-Reply-To:References:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From:Sender: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NPHlDKVP0qfo0Fgw2dRovj+3mOjqMZHqrfqmIIKJkQM=; b=NE+g8ob/2CCZZ8Xoww5sIJw6UE +1LyjLKlEHdToWQbdw995s8FIJJLXAemOM4D/5DPQNLT2agyXJiNFIWMt/1AMWWPftg/lUIleqWbR /Upk3YMWHAzRDIM3zPuVju4ai; Received: from 97-122-114-32.hlrn.qwest.net ([97.122.114.32]:33716 helo=[192.168.122.1]) by box5379.bluehost.com with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vloNK-00000001JjQ-1yKk; Fri, 30 Jan 2026 06:17:26 -0700 From: Tom Tromey Date: Fri, 30 Jan 2026 06:17:31 -0700 Subject: [PATCH v3 17/21] Warn if log file changed while logging MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260130-pr-28948-logging-5-v3-17-3eec47ef3cba@tromey.com> References: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> In-Reply-To: <20260130-pr-28948-logging-5-v3-0-3eec47ef3cba@tromey.com> To: gdb-patches@sourceware.org Cc: Tom Tromey , Andrew Burgess X-Mailer: b4 0.14.3 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.114.32 X-Source-L: No X-Exim-ID: 1vloNK-00000001JjQ-1yKk X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 97-122-114-32.hlrn.qwest.net ([192.168.122.1]) [97.122.114.32]:33716 X-Source-Auth: tom+tromey.com X-Email-Count: 29 X-Org: HG=bhshared;ORG=bluehost; X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-CMAE-Envelope: MS4xfCn1w7RWIXYmNZEVBP3HN0Rf0LP3fPVdpK1jStGCZQnuty41pvsnEStH8jYrw7MRIo+lLpQScfLT3l/oXOQMi0ApmddypvECueLmYC6yzMMyrEupGqSP EnJJqC8VYW7eHNdoyFgdaYhJzILM0X6W2twCdZ2Z6NeaepEKphcVye5LSQHdFTxFGgn2ao8HqS2s8cJLxSYPjqLTYZpRptZOJ00= X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org PR gdb/33531 points out that while some "set logging" commands will warn if you attempt to change settings when logging is already active, "set logging file" does not. This patch corrects this oversight. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33531 Approved-By: Andrew Burgess --- gdb/cli/cli-logging.c | 26 +++++++++++++++++--------- gdb/testsuite/gdb.base/ui-redirect.exp | 3 +++ 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c index c046e9131bc..8d22a62fa02 100644 --- a/gdb/cli/cli-logging.c +++ b/gdb/cli/cli-logging.c @@ -26,7 +26,23 @@ static std::string saved_filename; +static void +maybe_warn_already_logging () +{ + if (!saved_filename.empty ()) + warning (_("Currently logging to %s. Turn the logging off and on to " + "make the new setting effective."), saved_filename.c_str ()); +} + static std::string logging_filename = "gdb.txt"; + +static void +set_logging_filename (const char *args, + int from_tty, struct cmd_list_element *c) +{ + maybe_warn_already_logging (); +} + static void show_logging_filename (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -37,14 +53,6 @@ show_logging_filename (struct ui_file *file, int from_tty, static bool logging_overwrite; -static void -maybe_warn_already_logging () -{ - if (!saved_filename.empty ()) - warning (_("Currently logging to %s. Turn the logging off and on to " - "make the new setting effective."), saved_filename.c_str ()); -} - static void set_logging_overwrite (const char *args, int from_tty, struct cmd_list_element *c) @@ -344,7 +352,7 @@ If debug redirect is on, debug will go only to the log file."), Set the current logfile."), _("\ Show the current logfile."), _("\ The logfile is used when directing GDB's output."), - NULL, + set_logging_filename, show_logging_filename, &set_logging_cmdlist, &show_logging_cmdlist); diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp index a0382893980..b128391115f 100644 --- a/gdb/testsuite/gdb.base/ui-redirect.exp +++ b/gdb/testsuite/gdb.base/ui-redirect.exp @@ -100,6 +100,9 @@ with_test_prefix "redirect while already logging" { "Copying output to /dev/null.*Copying debug output to /dev/null\\." gdb_test "set logging redirect on" \ ".*warning: Currently logging .*Turn the logging off and on to make the new setting effective.*" + gdb_test "set logging file /dev/null" \ + ".*warning: Currently logging .*Turn the logging off and on to make the new setting effective.*" \ + "warn when changing log filename" gdb_test "save breakpoints $cmds_file" "Saved to file '$cmds_file'\\." \ "save breakpoints cmds.txt" cmp_file_string "$cmds_file" "$cmds" "cmds.txt" -- 2.49.0