From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id lxAfCieudmhBzjUAWB0awg (envelope-from ) for ; Tue, 15 Jul 2025 15:38:15 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=KRCrOB9m; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2I+Mlfgg; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=KRCrOB9m; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2I+Mlfgg; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 188B21E11C; Tue, 15 Jul 2025 15:38:15 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-9.1 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL, RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 09F531E089 for ; Tue, 15 Jul 2025 15:38:14 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id A5A5D385841D for ; Tue, 15 Jul 2025 19:38:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A5A5D385841D Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=KRCrOB9m; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2I+Mlfgg; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=KRCrOB9m; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=2I+Mlfgg Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 9F9F83858C51 for ; Tue, 15 Jul 2025 19:37:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9F9F83858C51 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9F9F83858C51 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752608258; cv=none; b=Ky97zFfSAuwJekURtZ2QHIebKD+mVOOlNgquovHBLUh+ZS9rQLE03q7bCr8iiXxfuOTr/65aeg1nWzO+WniC5rIH1Cu7WlNr0lpcqW32H/TpKgI+nqnepcDvW5nyll7ekOkvhZDXneFdeudQ29HFvTmYYOwxhaaiahfK6JYp9hA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1752608258; c=relaxed/simple; bh=+WSsO86JRhGsniBunpArfu5yNEVTzBqFWFaSrIpWnY4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=SSTI8OdSVWye7py7CVfgP4VE0lyr3YrvbDuXqfuQXoDbs4HdCPMf06/sxzGxtG28dOGnoV+r5blWDFINeDiP96eXZ/xhgDSi0SM6lte23d6D9XuqCy/tabU09yMuhnNde4JncQPw6dqhTvOGF1nfWdBVEEYJoyu2TICNIpmwIOA= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F9F83858C51 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 53692211EF for ; Tue, 15 Jul 2025 19:37:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1752608257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Zn8JW9f3HExL3BBaVtMzwjTGAM7YSq4C3d/5vBSSzzg=; b=KRCrOB9m9QD/pC2Ta53fazhd/m+j62QOf5Ku2JqIUo+UwwHI+DqTxudDK8h3a9/KdIB1Wj yvnLLrqEX2W9CZ6IqGkLLC7XOTmPxj56f0I2C3PuskNkvz/PTW8VoAsBUA2X92oHnhop1r f1sSMJugWnu/2kUPsfqAn8bImN2vGsw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1752608257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Zn8JW9f3HExL3BBaVtMzwjTGAM7YSq4C3d/5vBSSzzg=; b=2I+MlfggMPnfhON7KL9Q6kuA6ze0NCC+en3Ay3b516kU3BOuJGSWPE2Bkv1BRTacm02D5w z+S+1t3FK5KzvIDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=KRCrOB9m; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=2I+Mlfgg DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1752608257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Zn8JW9f3HExL3BBaVtMzwjTGAM7YSq4C3d/5vBSSzzg=; b=KRCrOB9m9QD/pC2Ta53fazhd/m+j62QOf5Ku2JqIUo+UwwHI+DqTxudDK8h3a9/KdIB1Wj yvnLLrqEX2W9CZ6IqGkLLC7XOTmPxj56f0I2C3PuskNkvz/PTW8VoAsBUA2X92oHnhop1r f1sSMJugWnu/2kUPsfqAn8bImN2vGsw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1752608257; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=Zn8JW9f3HExL3BBaVtMzwjTGAM7YSq4C3d/5vBSSzzg=; b=2I+MlfggMPnfhON7KL9Q6kuA6ze0NCC+en3Ay3b516kU3BOuJGSWPE2Bkv1BRTacm02D5w z+S+1t3FK5KzvIDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3867C13A68 for ; Tue, 15 Jul 2025 19:37:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id A9QIDAGudmiHKAAAD6G6ig (envelope-from ) for ; Tue, 15 Jul 2025 19:37:37 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH] [gdb/cli] Improve the pagination prompt Date: Tue, 15 Jul 2025 21:37:47 +0200 Message-ID: <20250715193747.30735-1-tdevries@suse.de> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from,2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim] X-Rspamd-Queue-Id: 53692211EF X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action 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 Currently the pagination prompt is: ... --Type for more, q to quit, c to continue without paging-- ... PR cli/33149 points out an inconsistency. While typing works as advertised, pressing q or c doesn't have any other effect than echoing the character to screen. An additional is needed. This is a regression since commit eb6af80922a ("Add "continue" response to pager"), which changed: ... ---Type to continue, or q to quit--- ... into: ... --Type for more, q to quit, c to continue without paging-- ... Fix this by using the slightly longer (69 instead of 64 chars): ... --Type (more), q (quit), or c (continue, no paging)-- ... Also update the documentation to clarify the same issue. In the testsuite, update the pagination_prompt variable and use it in more test-cases. In some test-cases, matching the pagination prompt was split up to address a matching race but that's no longer necessary, thanks to commit c3f814a1433 ("Fix paginate-*.exp races"). Tested on aarch64-linux. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33149 --- gdb/doc/gdb.texinfo | 6 +++--- gdb/testsuite/gdb.cp/static-print-quit.exp | 23 ++++------------------ gdb/testsuite/gdb.python/py-cmd.exp | 8 +------- gdb/testsuite/gdb.python/python.exp | 16 ++------------- gdb/testsuite/lib/gdb.exp | 4 +++- gdb/utils.c | 8 +++++--- 6 files changed, 18 insertions(+), 47 deletions(-) diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 35b770f8138..af434d62918 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -27921,9 +27921,9 @@ Certain commands to @value{GDBN} may produce large amounts of information output to the screen. To help you read all of it, @value{GDBN} pauses and asks you for input at the end of each page of output. Type @key{RET} when you want to see one more page of output, -@kbd{q} to discard the remaining output, or @kbd{c} to continue -without paging for the rest of the current command. Also, the screen -width setting determines when to wrap lines of output. Depending on +@kbd{q} @key{RET} to discard the remaining output, or @kbd{c} @key{RET} to +continue without paging for the rest of the current command. Also, the +screen width setting determines when to wrap lines of output. Depending on what is being printed, @value{GDBN} tries to break the line at a readable place, rather than simply letting it overflow onto the following line. diff --git a/gdb/testsuite/gdb.cp/static-print-quit.exp b/gdb/testsuite/gdb.cp/static-print-quit.exp index 8e0b61d86e7..e4bce7f0d8a 100644 --- a/gdb/testsuite/gdb.cp/static-print-quit.exp +++ b/gdb/testsuite/gdb.cp/static-print-quit.exp @@ -27,32 +27,17 @@ clean_restart $testfile.o gdb_test_no_output "set width 80" gdb_test_no_output "set height 2" -set test "print c - " -gdb_test_multiple "print c" $test { - -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n--Type " { - pass $test +gdb_test_multiple "print c" "" { + -re "\\$\[0-9\]+ = \{loooooooooooooooooooooooooooooooooooooooooooooong = 0, static field = \{\r\n$pagination_prompt$" { + pass $gdb_test_name } - -re "\r\n--Type " { + -re "\r\n$pagination_prompt$" { # gdb-7.1 did not crash with this testcase but it had the same bug. untested "bug does not reproduce" return 0 } } -set test "print c - q " -gdb_test_multiple "" $test { - -re " for more, q to quit, " { - pass $test - } -} - -set test "print c - remainder" -gdb_test_multiple "" $test { - -re "c to continue without paging--$" { - pass $test - } -} - gdb_test "q" ".*" # Now the obstack is uninitialized. Exercise it. diff --git a/gdb/testsuite/gdb.python/py-cmd.exp b/gdb/testsuite/gdb.python/py-cmd.exp index 5ac57122f99..1fa3c73067b 100644 --- a/gdb/testsuite/gdb.python/py-cmd.exp +++ b/gdb/testsuite/gdb.python/py-cmd.exp @@ -278,13 +278,7 @@ gdb_test_multiline "input multi-line-output command" \ set test "verify pagination from test_multiline" gdb_test_multiple "test_multiline" $test { - -re "--Type " { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 6b2f671f5e4..96977dff629 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -152,13 +152,7 @@ gdb_test_no_output "set height $lines" set test "verify pagination beforehand" gdb_test_multiple "python print (\"\\n\" * $lines)" $test { - -re "--Type " { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } @@ -168,13 +162,7 @@ gdb_test "python if gdb.execute('python print (\"\\\\n\" * $lines)', to_string=T set test "verify pagination afterwards" gdb_test_multiple "python print (\"\\n\" * $lines)" $test { - -re "--Type " { - exp_continue - } - -re " for more, q to quit" { - exp_continue - } - -re ", c to continue without paging--$" { + -re "$pagination_prompt$" { pass $test } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 777d64d14d1..5e07ac2738e 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -289,7 +289,9 @@ if {![info exists gdb_prompt]} { # A regexp that matches the pagination prompt. set pagination_prompt \ - "--Type for more, q to quit, c to continue without paging--" + [string_list_to_regexp \ + "--Type (more), q (quit)," \ + " or c (continue, no paging)--"] # The variable fullname_syntax_POSIX is a regexp which matches a POSIX # absolute path ie. /foo/ diff --git a/gdb/utils.c b/gdb/utils.c index 10d3d51e481..e44ba45e287 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1449,9 +1449,11 @@ pager_file::prompt_for_continue () if (annotation_level > 1) m_stream->puts (("\n\032\032pre-prompt-for-continue\n")); - strcpy (cont_prompt, - "--Type for more, q to quit, " - "c to continue without paging--"); + /* Keep the pagination prompt within 70ish chars to fit in a single + line in, say a VT100 (80x25) terminal. */ + strcpy (cont_prompt, "\ +--Type (more), q (quit), or c (continue, no paging)--"); + if (annotation_level > 1) strcat (cont_prompt, "\n\032\032prompt-for-continue\n"); base-commit: 83be472a61653094ea04a23b1bcadbaca0a57f84 -- 2.43.0