From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 2VbGKIQ4M2ksYBsAWB0awg (envelope-from ) for ; Fri, 05 Dec 2025 14:54:44 -0500 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UpCi1imY; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id A2E7C1E0B3; Fri, 05 Dec 2025 14:54:44 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, 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 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 0EA6D1E08D for ; Fri, 05 Dec 2025 14:54:44 -0500 (EST) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93F174D10849 for ; Fri, 5 Dec 2025 19:54:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93F174D10849 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=UpCi1imY Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTP id 3833E4CD201B for ; Fri, 5 Dec 2025 19:53:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3833E4CD201B Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 3833E4CD201B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764964410; cv=none; b=VpXPNpETATBdOP7pNZi/plQTXvy0A5JlRLZEtd4nlnR30ebhuYvDuznrGxSaWj/HL1M1K8DahcXEpE1t16Aq6oSeVVjrvcXX6JleSkZuIrINj3VvObWAhcvENXQsNDH5pgFZ7fgEbgpHNTfrZ0wYGLwUThGvbfmLDVwfsu+FIGM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764964410; c=relaxed/simple; bh=w/ovivIpj2hAdDwHPp93pn1IO906DHtew3M6MtW/XWc=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=trSw/dErASYY78FlvJ9jEmj31rz50LI9ILuNQC6xUytW6P5S1UEt3Ryxb4VXd5ypdS+Ol+GAhcIHi331J8f1aU5LYdP3kF7eHcd70/yX+xFsg1U7sD8pcZlaeOacfpbHV/fgxfcBO57TzS2u/n+o/HLlNFkGMpcvjyKezbcm0QQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3833E4CD201B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764964409; h=from:from:reply-to:subject:subject: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=VImi8nZxv0j7sQICHHKGAfJFc1SIkdq6qgD69MaM1y4=; b=UpCi1imYQ0b+j1jZTEQ5RDMK4hrjqy5/78MFYYkD6E3jA182eDMSplQJbvO4y7lFW8JMLa 6RuuTbbJZ7D+sSvZa7ezjaTD5ma/IEkweX01x/KRN+7h0mVf8zGND9XVFrVq/yjJUieAOx cy0+/k7BOK2c+pWTShQUO/sXTfmfF/E= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-575-JosD1MMoOneTxo--CXa2Aw-1; Fri, 05 Dec 2025 14:53:28 -0500 X-MC-Unique: JosD1MMoOneTxo--CXa2Aw-1 X-Mimecast-MFC-AGG-ID: JosD1MMoOneTxo--CXa2Aw_1764964407 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-42b56125e77so1203298f8f.3 for ; Fri, 05 Dec 2025 11:53:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764964407; x=1765569207; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=VImi8nZxv0j7sQICHHKGAfJFc1SIkdq6qgD69MaM1y4=; b=FrpxLNBIwDnzhKhulh0anjGe49rrQ8OunDDcPRC6raR24tZTIfPJaIKGe0tHkY2YBk QHM9HlGZWB/aKBYmcLSjnvFOhXd0d+faZa131BS+eRw86IwnCsSf+Oa/blwdV1xf6UBt ZPzy5FJgXVznTnz1mvxSNOzAnwkK5Q1WvQE2mUX957UtBX4tLGmEtZoeWa85stVR45Sj 5t5K+ZtRot/NRlCGEzqHJlJsvpjxlZKTNVSe2M+l/xiJxZJAX21ZdZjT+q0oLqS7K8pa r+FrgpE4npULmkYBcYvDDBBor9y7XI30Tyx2wHymP2cn4IBF1hEnhDmKM12RhIPfkG8V CyrA== X-Gm-Message-State: AOJu0YxArC92PY/dNdaus06qvDsMEId9vi5WFzEY++WEHZ5G1RTfSaLD B/IxYbJZDCOkaRUfNfud/m+bdgmElpmv04diXR/RD53h3dkovvBCUWxEplB8chfbsoMkB4gzokS mXUAGMK8JEyg0DDOwku6U0RJhUXeRTTbxf5SKyFjIrHtou0QDUr9v4L6b1MXL2RkfAJhIoFHSJ/ GNlWWZDxM9m0ua7ZPShRXeLg76nFOP1CmIYlCNn9241vpCILA= X-Gm-Gg: ASbGncvefbjxkkF1+UYDFpLrXRauu0JiIpmqx/js6GxWhudWfv5IUSApafwF//xIDYn ld25VMSA5hFI35mewZLPsPFMwtKSM66F7bQwef9q7FTPCoo0wBbtzW/DOOU5U/Qe1elrIzkixwP 8IG4/5hMqHaqQj/nV6NgbwT6oZOIXOFKKL/+v8pQAkVIMk/WCnIIGho07ujRXNF5zw0vbVWbAJ2 AHI/47WEEz9ECio/kzNwHrt4DpeZ6euZt+F6d0p76YlwTPMesVhoAr5zPG3/qXU8RtKSFB/i5dD 4z2a759U/7Kpm6cn1tdVXf72933P0TdLAD4Bri020gE4+KxC35u15nU76/8/8VnU8W2R5gjeBlg qkCpA X-Received: by 2002:a05:6000:2508:b0:42b:2ac7:7942 with SMTP id ffacd0b85a97d-42f89f0fafcmr398281f8f.5.1764964406606; Fri, 05 Dec 2025 11:53:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IG2chzqiiWE6Tl3jvzT+aIgYzgYTOFNZrqWU4+sjPSkMrgp5VXAqIuMPbyIRiwYlFHaT7D6mw== X-Received: by 2002:a05:6000:2508:b0:42b:2ac7:7942 with SMTP id ffacd0b85a97d-42f89f0fafcmr398257f8f.5.1764964405972; Fri, 05 Dec 2025 11:53:25 -0800 (PST) Received: from localhost ([31.111.84.207]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42f7d353f8bsm10732513f8f.43.2025.12.05.11.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 11:53:25 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess Subject: [PATCHv3 3/3] WIP: disable progress bars setting Date: Fri, 5 Dec 2025 19:53:17 +0000 Message-ID: <32f0ffdfd85e7a3d62a2dc3a7b06b01275412920.1764964133.git.aburgess@redhat.com> X-Mailer: git-send-email 2.47.1 In-Reply-To: References: MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: UbPQDEGV_cg19OzTM5G-vXi8pDCv3PHCe3PZmgrpbSY_1764964407 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit content-type: text/plain; charset="US-ASCII"; x-default=true 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 --- gdb/NEWS | 6 ++ gdb/cli-out.c | 66 ++++++++++++++++++- gdb/doc/gdb.texinfo | 15 +++++ .../build-id-no-debug-warning.exp | 1 + .../gdb.debuginfod/corefile-mapped-file.exp | 1 + gdb/testsuite/gdb.debuginfod/crc_mismatch.exp | 1 + .../gdb.debuginfod/fetch_src_and_symbols.exp | 4 ++ .../gdb.debuginfod/solib-with-soname.exp | 1 + 8 files changed, 93 insertions(+), 2 deletions(-) diff --git a/gdb/NEWS b/gdb/NEWS index 01c998f4ea0..0e43de89e8a 100644 --- a/gdb/NEWS +++ b/gdb/NEWS @@ -59,6 +59,12 @@ maintenance test-remote-args ARGS Test splitting and joining of inferior arguments ARGS as they would be split and joined when being passed to a remote target. +set progress-bars enabled on|off +show progress-bars enabled + Allows the progress bars, used when debuginfod is downloading + content, to be disabled (the set command), or to see if + progress-bars are currently enabled or not (the show command). + * Changed commands maintenance info program-spaces diff --git a/gdb/cli-out.c b/gdb/cli-out.c index 5aa13a64271..ae60b65064b 100644 --- a/gdb/cli-out.c +++ b/gdb/cli-out.c @@ -26,6 +26,7 @@ #include "readline/readline.h" #include "cli/cli-style.h" #include "ui.h" +#include "cli/cli-cmds.h" /* These are the CLI output functions */ @@ -275,6 +276,31 @@ cli_ui_out::do_progress_start () #define MIN_CHARS_PER_LINE 50 #define MAX_CHARS_PER_LINE 4096 +/* When this is false no progress bars will be displayed. When true, + progress bars can be displayed if the output stream supports them. */ + +static bool progress_bars_enabled = true; + +/* The "show progress-bars enabled" command. */ + +static void +show_progress_bars_enabled (struct ui_file *file, int from_tty, + struct cmd_list_element *c, + const char *value) +{ + if (progress_bars_enabled && get_chars_per_line () < MIN_CHARS_PER_LINE) + gdb_printf (file, _("Progress bars are currently \"off\". " + "The terminal is too narrow.\n")); + else if (progress_bars_enabled && (!gdb_stdout->isatty () + || !current_ui->input_interactive_p ())) + gdb_printf (file, _("Progress bars are currently \"off\". " + "The terminal doesn't support them.\n")); + else + gdb_printf (file, + _("Progress bars are currently \"%s\".\n"), + value); +} + /* Print a progress update. MSG is a string to be printed on the line above the progress bar. TOTAL is the size of the download whose progress is being displayed. UNIT should be the unit of TOTAL (ex. "K"). If HOWMUCH @@ -307,7 +333,7 @@ cli_ui_out::do_progress_notify (const std::string &msg, if (stream->isatty () && current_ui->input_interactive_p () && chars_per_line >= MIN_CHARS_PER_LINE - && chars_per_line != UINT_MAX) + && progress_bars_enabled) { gdb_printf (stream, "%s\n", msg.c_str ()); info.state = progress_update::BAR; @@ -393,7 +419,7 @@ cli_ui_out::clear_progress_notify () if (!stream->isatty () || !current_ui->input_interactive_p () || chars_per_line < MIN_CHARS_PER_LINE - || chars_per_line == UINT_MAX) + || !progress_bars_enabled) return; if (chars_per_line > MAX_CHARS_PER_LINE) @@ -542,3 +568,39 @@ cli_display_match_list (char **matches, int len, int max) gdb_display_match_list (matches, len, max, &displayer); rl_forced_update_display (); } + +/* Set/show progress-bars commands. */ +static cmd_list_element *set_progress_bars_prefix_list; +static cmd_list_element *show_progress_bars_prefix_list; + +/* Initialization for this file. */ + +INIT_GDB_FILE (cli_out) +{ + /* set/show debuginfod */ + add_setshow_prefix_cmd ("progress-bars", class_obscure, + _("Set progress-bars options."), + _("Show progress-bars options."), + &set_progress_bars_prefix_list, + &show_progress_bars_prefix_list, + &setlist, &showlist); + + /* Adds 'set|show progress-bars enabled'. */ + add_setshow_boolean_cmd ("enabled", class_obscure, + &progress_bars_enabled, _("\ +Set whether progress bars should be displayed."), _("\ +Show whether progress bars should be displayed."),_("\ +During some slow operations, for example, fetching debug information\n\ +from debuginfod, GDB will display an animated progress bar when this\n\ +setting is \"on\". When this setting is \"off\", no progress bars\n\ +will be displayed.\n\ +\n\ +Even when \"on\", progress bars can be disabled if the output terminal\n\ +doesn't support them."), + nullptr, + show_progress_bars_enabled, + &set_progress_bars_prefix_list, + &show_progress_bars_prefix_list); + + +} diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index e4469227a9e..4a6bc7355b5 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -51323,6 +51323,21 @@ Debuginfod Settings @item show debuginfod verbose Show the current verbosity setting. +@kindex set progress-bars enabled +@cindex progress bars, disabling +@item set progress-bars enabled @r{[}on@r{|}off@r{]} +Set whether @value{GDBN} can display a progress bar when downloading a +file from debuginfod. When @value{off}, @value{GDBN} will not display +a progress bar. When @value{on}, @value{GDBN} will display a progress +bar if @value{GDBN}'s output console supports it. + +@kindex show progress-bars enabled +@item show progress-bars enabled +Shows whether progress bars are currently enabled or not. Progress +bars can be automatically disabled if @value{GDBN}'s output console +doesn't support them, or if the terminal width is too small +(@pxref{Screen Size,,@kbd{set width} command}). + @end table @node Man Pages diff --git a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp index 7a0cfda627c..eb4d0589478 100644 --- a/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp +++ b/gdb/testsuite/gdb.debuginfod/build-id-no-debug-warning.exp @@ -132,6 +132,7 @@ proc_with_prefix local_debuginfod { } { # Enable debuginfod and fetch the debuginfo. gdb_test_no_output "set debuginfod enabled on" + gdb_test_no_output "set progress-bars enabled off" # "separate debug info file has no debug info" warning should not be # reported now because the correct debuginfo should be fetched from diff --git a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp index 83472f00bb0..df84a1dcb98 100644 --- a/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp +++ b/gdb/testsuite/gdb.debuginfod/corefile-mapped-file.exp @@ -371,6 +371,7 @@ with_debuginfod_env $cache { clean_restart gdb_test_no_output "set debuginfod enabled on" \ "enabled debuginfod for initial test" + gdb_test_no_output "set progress-bars enabled off" gdb_load $binfile load_core_file "load corefile, download library from debuginfod" \ diff --git a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp index e44748f8205..92de3ee2167 100644 --- a/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp +++ b/gdb/testsuite/gdb.debuginfod/crc_mismatch.exp @@ -113,6 +113,7 @@ proc_with_prefix local_debuginfod { } { # Enable debuginfod and fetch the debuginfo. gdb_test_no_output "set debuginfod enabled on" + gdb_test_no_output "set progress-bars enabled off" gdb_test "file $binfile" ".*Reading symbols from.*debuginfo.*" \ "file [file tail $binfile] cmd on" diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp index 9078068c8fe..e3d9c36777b 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -218,6 +218,7 @@ proc_with_prefix local_url { } { clean_restart gdb_test_no_output "set debuginfod enabled on" \ "enabled debuginfod for initial test" + gdb_test_no_output "set progress-bars enabled off" gdb_load $binfile gdb_test_no_output "set substitute-path $outputdir /dev/null" \ "set substitute-path" @@ -243,11 +244,13 @@ proc_with_prefix local_url { } { set enable_debuginfod_question \ "Enable debuginfod for this session. \\(y or \\\[n\\\]\\) " clean_restart + gdb_test_no_output -nopass "set progress-bars enabled off" gdb_test "core $::corefile" ".*return 0.*" "file [file tail $::corefile]" \ $enable_debuginfod_question "y" # GDB should now find the debugaltlink file. clean_restart + gdb_test_no_output -nopass "set progress-bars enabled off" gdb_test "file ${binfile}_alt.o" \ ".*Downloading.*separate debug info.*" \ "file [file tail ${binfile}_alt.o]" \ @@ -269,6 +272,7 @@ proc_with_prefix local_url { } { # Enable debuginfod and fetch the debuginfo. gdb_test_no_output "set debuginfod enabled on" + gdb_test_no_output -nopass "set progress-bars enabled off" gdb_test "file $binfile" ".*Reading symbols from.*debuginfo.*" \ "file [file tail $binfile] cmd on" diff --git a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp index a22fa597602..5ff65e8f769 100644 --- a/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp +++ b/gdb/testsuite/gdb.debuginfod/solib-with-soname.exp @@ -281,6 +281,7 @@ with_debuginfod_env $cache { save_vars { GDBFLAGS } { append GDBFLAGS " -ex \"set debuginfod enabled on\"" + append GDBFLAGS " -ex \"set progress-bars enabled off\"" # Reload the executable and core file. GDB should download # the file libfoo_1.so using debuginfod during the mapped file -- 2.47.1