From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id +rQBJ29dOGkABykAWB0awg (envelope-from ) for ; Tue, 09 Dec 2025 12:33:35 -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=ZT2JfLBB; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 849BE1E0B3; Tue, 09 Dec 2025 12:33:35 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 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_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham 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 9625A1E08D for ; Tue, 09 Dec 2025 12:33:33 -0500 (EST) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 1C7F94BA2E3D for ; Tue, 9 Dec 2025 17:33:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1C7F94BA2E3D 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=ZT2JfLBB 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 0DD634BA2E3B for ; Tue, 9 Dec 2025 17:33:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0DD634BA2E3B 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 0DD634BA2E3B 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=1765301586; cv=none; b=bqyz0lu7W3fdRdTwjzbBTMBSQ/GSlcK4g0QlDqYM0oufXitjhUoGHkL+XK9KYv8G69u/pN/UPxRETS2cep1R60fl9qevo5BQNl5gcwW+FsAfaKSJ/xHT+qY/e5Y+XbjB6cLhbnp45zHyug6rVAj4UH67ETmV2JEDdFlDUl2SnLs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1765301586; c=relaxed/simple; bh=VFOYrY8J3PtNURhuGST9SOx/xgW/JfmsXcs6KEIIF+I=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=m6myp9+3pHZdvvXcG2ypudqhhN3VnpEoJWzXVLK5Yy2/qAVPZQdXk8zrkSGSDGIS6ClBOmaxb0zOVDc4zfYylWOChuCr1rngRTKpy9klhVf2DYOdbGfL2CgiW64rxefGG+MFBZAosz/ete5Uy+KzM6atN9HC/pv52WUicrxI1KY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0DD634BA2E3B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1765301585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ZbP18OufOqoSi4WW76yKaLTSYO6LjOiLkyBOUmpzxlc=; b=ZT2JfLBBwUhTlUwJsByKefU2hTHUmWaIb+rmu12YyY59NhSoAY/nK7vcatWEilV6T9B5Tw GNOJZ2izu0M3tSzi2IyGZi534XinURV7i498bQmLc09SGpzgYCTW3B4VXI9aO0kr7ojiDh h7cipifZObmgVCswb5JnlsptFuARFl4= 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-481-537PuYEbPoGarEWx_2T9cw-1; Tue, 09 Dec 2025 12:33:03 -0500 X-MC-Unique: 537PuYEbPoGarEWx_2T9cw-1 X-Mimecast-MFC-AGG-ID: 537PuYEbPoGarEWx_2T9cw_1765301582 Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-42e2d02b528so4105492f8f.0 for ; Tue, 09 Dec 2025 09:33:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765301581; x=1765906381; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZbP18OufOqoSi4WW76yKaLTSYO6LjOiLkyBOUmpzxlc=; b=BFRmJylLs/W4xr1n+KEdr02Yh6jsTEQ0mNKpgbqncbnFTo8sF/syd2q9GyxmDupDu8 BtBqvjtpcJ2KT95LKXcLk+7sGRIxdI+CjHLXgvWnpHTStoShwCw2PH5Wt7EzxD5767Dy zQgu2BsqEzvxc8VASmauGynOXt3Q8qpyph9x5YBj/Q8jV82z2jltlGVZdwYREfDVYSkx aBO11c66TW9o5DsuefMIW8NgvDXwPhJC0Z5t1UyT45NRzwWW1DOma3HOXOogVzezOxbV Wv+F/h0Uid9GB1Fdgi5OMR0iihVCGzkZKT3qxeoWUxfaLk+ZVERMziW2KqiS84c3iY7A AQxQ== X-Gm-Message-State: AOJu0Yxn6ltxV5GLhbqf1NbJ5ePB6dGjQ16JLonp24YXb66Fj2LWuhuG mETy2jtd/cXtWuP6bY7t5ngUlWYHtgN1PMijcIV7UgJObl/o44xotWymbCz0MASME5uGx20/W0P wkkhdkwNpye5zD9XxWVIA7CLc9gwxm9BINpy0auRur3QvbQqsSUGIS3Z/CZ3r7KlqDGxvwds8gm 2i2pdYDYNfV5tkfvQxcU/nwlGx9BJ6R8rIx5lEqwdpFJac1bc= X-Gm-Gg: AY/fxX6Py/zmoDUYZqk+r2TaixA2EfKTCvOs1vge7Ahlky6LsdI0k1b1FkKd86gd1so ZH1FdAGHajJV1VM02q0K1WDuzkKgbmTQLToYNI5faWsYbZ5Ll4v1pvZkLrg/IFwnxf14zWmT4Zw Je9WJCbOJ1A9WQGoUan9WvsTaItHJEp0V+XvhNC+nlLmxGcwEO78ju81YzaZREIjJwg12OhUQzK KmMO2iQYt69lfsaO02YI9iBWQ1emtNbE3dcP5SE8Bf6Oj+MTU+qC7nZjC0igV9FH0yd7/8EzbQN hyPg461QzZUkDYGI86YiyLGVqdTocat1HUNTqH6IZv+K5m1rFP6psXpZg8cXIPLEbf2+AL79Ffb SzHoo X-Received: by 2002:a05:6000:2410:b0:427:7ac:5287 with SMTP id ffacd0b85a97d-42f89f480aamr11369468f8f.34.1765301581320; Tue, 09 Dec 2025 09:33:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IGtZcqqqCE9v2rhRLJJufOxs0+J/Jku0loyD8FygucOhLYxLrxhpVBAFgBTwILnnYokDzhUKA== X-Received: by 2002:a05:6000:2410:b0:427:7ac:5287 with SMTP id ffacd0b85a97d-42f89f480aamr11369430f8f.34.1765301580612; Tue, 09 Dec 2025 09:33:00 -0800 (PST) Received: from localhost ([31.111.84.207]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42f9f5ab46csm4825339f8f.19.2025.12.09.09.33.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Dec 2025 09:33:00 -0800 (PST) From: Andrew Burgess To: gdb-patches@sourceware.org Subject: Re: [PATCHv3 3/3] WIP: disable progress bars setting In-Reply-To: <32f0ffdfd85e7a3d62a2dc3a7b06b01275412920.1764964133.git.aburgess@redhat.com> References: <32f0ffdfd85e7a3d62a2dc3a7b06b01275412920.1764964133.git.aburgess@redhat.com> Date: Tue, 09 Dec 2025 17:32:59 +0000 Message-ID: <87h5tz5zn8.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: QeaGGobY4omxZ9OlKDQLyT5OytRammJyIqMVU-lUwsg_1765301582 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 Andrew Burgess writes: > --- > 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(-) I realise I posted this without writing an actual commit message. That's pretty poor form. Apologies. I think I was having a bad day. Anyway, here's the same patch (no code or doc changes) but with an actual commit message. Thanks, Andrew --- commit d60de316ab832dcfdbd8cef11ff22a95ef27baa4 Author: Andrew Burgess Date: Fri Dec 5 11:33:29 2025 +0000 gdb: new setting to disable progress bars Two commits ago, in the commit titled: gdb: make get_chars_per_line return an unsigned value A bodge was added in cli-out.c so that progress bars (as seen when debuginfod downloads a file) would be disabled when the output terminal had unlimited width. The hack was added because this previous commit fixed a bug such that progress bars could now be displayed in very wide, or even on unlimited width output terminals. By fixing this bug, progress bars were now being displayed when running the testsuite, as the testsuite sets the output terminal to unlimited width. To avoid breaking the tests, this previous commit added a bodge such that on unlimited width output terminals, progress bars would always be disabled. This got the tests passing again, but isn't an ideal solution. This commit cleans things up. We now have a new setting: set progress-bars enabled on|off show progress-bars enabled This setting allows progress bars to be turned off. The tests are then updated to explicitly turn off progress bars. The bodge from the earlier commit is then removed. Now, progress bars should display correctly on any width of output terminal over 50 characters, the minimum required. And the debuginfod tests should all pass as they turn off progress bars. Reviewed-By: Eli Zaretskii 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