From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KanbOZ8YH2rTFjAAWB0awg (envelope-from ) for ; Tue, 02 Jun 2026 13:53:35 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=TYsHY6gX; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id E6A7D1E0A6; Tue, 02 Jun 2026 13:53:35 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [IPv6:2620:52:6:3111::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 79D1C1E062 for ; Tue, 02 Jun 2026 13:53:35 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 366404BA2E2D for ; Tue, 2 Jun 2026 17:53:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 366404BA2E2D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=TYsHY6gX Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 94F1A4BA2E0D for ; Tue, 2 Jun 2026 17:51:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 94F1A4BA2E0D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 94F1A4BA2E0D Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::335 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780422713; cv=none; b=p1Dh1Ov0Vc6keEe68phziJ54SY83ofbgGJTsjR7nfNZyAW6+qZ750zxnrLqdF36sbbQsgyz67XuF42ApYM6pW8Okq+QbzGO38lqmshg0HIBPfQz3Tphl8p35UnvUpyNdeLJj+ECMrZ4kfg2j1mqdTu7sqocNYiZ1fAjqlkOPNlI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1780422713; c=relaxed/simple; bh=OzxrgReIfcDcChIPjycwV+soPEikM3mDFxk4d9/aliw=; h=DKIM-Signature:From:Date:Subject:MIME-Version:Message-Id:To; b=f8YB8pVH+asgT/0q4RSYZdv/z0Iz8PbY5OPOcQm+wxVQoivDDKPN8KbD3aeQ8nP3ARTTcSLHuH+60duYTUPqv0/qpYJJk/XgNO89ZpZDShC9Q1GaXl+ScfGLfck4o7a4haXYccGaMmryBgPEsatnoKGFRgY9PA0r0XWEc+PfTHc= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=TYsHY6gX DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 94F1A4BA2E0D Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-7e6b573491eso1697000a34.1 for ; Tue, 02 Jun 2026 10:51:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1780422713; x=1781027513; darn=sourceware.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=3Cn6+0PjwIpejIWsxeUzP/cfJZxjxsUSy3Kks6cUPWo=; b=TYsHY6gXM5umUvmMy95ASuu0zkrrz6DlBf8stBA9Yv9A6bMqIzIkGBchPqieUY51tM Z1YCksKM+0GKUXgsS2Z48TZPL4NpGJA0e6emZxmGTLP8dtBpuITbPOZkjtP7ZxZL1LKC cLEV467zRNa2MhTmRkV0W5Br15xYYOz39X0XYWs68TU1RjrshUsY/rLR7B/WpotIWD6A bPazkFf9O3BOYtqlfAcJ0Lc9pV3BrPrb035dC/pOHMgVeIVrW5qKLFXsoln4w5am15fd yuHvr76eTiLbX0JCaSzysOGV43Egx5f2f4SYTb+0olHgDXlzA4ZaFDqWV2aPktSfAGWj EaAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780422713; x=1781027513; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=3Cn6+0PjwIpejIWsxeUzP/cfJZxjxsUSy3Kks6cUPWo=; b=Ptkq+jZA2KDNkPL/Zt36M6IzOZ4d0nFw1hYYD/F1/4e2/75WaNbSqNf89xA8tPE1++ IAw/Akz6sd0pWIEb5b98V/c26IfCNAuuJO0apQD6jrW6F4TlQD1IfJj6UHDAEdhyQozp J34sHVxwUQaYe51LdzHxocl28hUl/5S+2a5GFzcla44ZGt3V3UroqF7dp/OTYMjzOQmn 6T7pphWk+mK55+dlwnvri7i53BDF3S4YMXBQb081r5zIfDe7lfaxGCk8I1kCgLSkiJ5i nOKI8WTgk3HhBM809eT+aTvjje0HZi7fgoAp5gA7AAJ4WzuAkirBQb1Pkc8Qf9vX7SMw 2lJg== X-Gm-Message-State: AOJu0YxhMrQDEODtwzrd/3gsL/33X/6h/tdMD/OTZcAyFqwz6Uo1PMBY cEQ8kLtGaD75WCo5y78yt5RXZ8pCv8HXGhx+ECQwv3chCn49qrZlum/pH3N3VwEQZZwz/q2v6/i Er+o= X-Gm-Gg: Acq92OF5tT/wqjzmTizTrKp2nMufYfEVXRg7CGUZfGrqL+P3rbI22VaMstr4gObi+lx xTff9l2iWJ3DFWWNpgHkardc5cXoUNH3dzz49bA5YBJYkDDVMxDj/8pNVqjhanAk4Xmr+RRddTm EkceDHjLH0lDULRPULbLeAGt5iERyStFA0i9w9fKehhheEQpT/oumxMS/ZdEsn43187RVzBXh4P rlRkPTvxhDFmuuJZB3K9BOT1NiLQDAWrnZ6h4w8rUrpp2mUa1bRcRqYESrqE+l2BEAulTqfQ2UM g3lLlH4/lpydNjxFLO4tRSwWngHE++qa3RYFXPRWzk4VlSVqZrQus5dq8RCSroCRoABsHAYw/Rg 197I9mfVDIMP++U+NB0iDoSh/vu77hUoYzAmqZ34LgK63ckfZ9qiyGQUMtuPiytVUrSOzF74q7Z vn12eeK6f4XGapnhIGwFSae0AI78GaI2Znm50B7YW17cA4kFv8+DmSHORd/VVLbABM X-Received: by 2002:a05:6830:452a:b0:7dc:dbe4:3f21 with SMTP id 46e09a7af769-7e6e61a8d3amr421216a34.1.1780422712808; Tue, 02 Jun 2026 10:51:52 -0700 (PDT) Received: from [192.168.0.26] (75-166-225-82.hlrn.qwest.net. [75.166.225.82]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7e6e74b5e80sm29691a34.7.2026.06.02.10.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2026 10:51:52 -0700 (PDT) From: Tom Tromey Date: Tue, 02 Jun 2026 11:51:50 -0600 Subject: [PATCH 2/2] Print command trace to gdb_stdlog MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20260602-cmd-trace-logging-v1-2-ab7e0fdd476e@adacore.com> References: <20260602-cmd-trace-logging-v1-0-ab7e0fdd476e@adacore.com> In-Reply-To: <20260602-cmd-trace-logging-v1-0-ab7e0fdd476e@adacore.com> To: gdb-patches@sourceware.org Cc: Tom Tromey X-Mailer: b4 0.15.2 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 I recently wanted to enable some gdb logging when running the internal AdaCore test suite. To do this nicely, I enable debug-redirect early in the test, so that the logging output does not affect the test results. I also wanted to the log the commands, to correlate what I see in the debug log with what I see in the ordinary test suite log file (which is basically like our own gdb.log). However, I found that "set trace-commands on" will log to stdout, not stdlog. This patch changes this to log to the log file instead. --- gdb/cli/cli-script.c | 10 ++++------ gdb/testsuite/gdb.base/ui-redirect.exp | 6 ++++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c index b8312f431cb..0a1208845b4 100644 --- a/gdb/cli/cli-script.c +++ b/gdb/cli/cli-script.c @@ -486,8 +486,6 @@ ATTRIBUTE_PRINTF (1, 2) void print_command_trace (const char *fmt, ...) { - int i; - if (suppress_next_print_command_trace) { suppress_next_print_command_trace = false; @@ -497,15 +495,15 @@ print_command_trace (const char *fmt, ...) if (!source_verbose && !trace_commands) return; - for (i=0; i < command_nest_depth; i++) - gdb_printf ("+"); + for (int i = 0; i < command_nest_depth; ++i) + gdb_printf (gdb_stdlog, "+"); va_list args; va_start (args, fmt); - gdb_vprintf (fmt, args); + gdb_vprintf (gdb_stdlog, fmt, args); va_end (args); - gdb_puts ("\n"); + gdb_puts ("\n", gdb_stdlog); } /* Helper for execute_control_command. */ diff --git a/gdb/testsuite/gdb.base/ui-redirect.exp b/gdb/testsuite/gdb.base/ui-redirect.exp index c1cb461496b..64007276b17 100644 --- a/gdb/testsuite/gdb.base/ui-redirect.exp +++ b/gdb/testsuite/gdb.base/ui-redirect.exp @@ -135,6 +135,12 @@ with_test_prefix "redirect debugging" { "Copying output to /dev/null.*Redirecting debug output to /dev/null\\." gdb_test "continue" "Continuing.*((?!infrun).).*Breakpoint ${::decimal}, bar.*" gdb_test "set debug infrun 0" + + # The trace should be sent to the log, not stdout. + gdb_test_no_output "set trace-commands on" + gdb_test_no_output {printf ""} + gdb_test_no_output "set trace-commands off" + gdb_test "set logging enabled off" "Done logging to /dev/null\\." gdb_test "help" "List of classes of commands:.*" } -- 2.54.0