From patchwork Thu Apr 13 14:08:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67699 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 924DE3858C00 for ; Thu, 13 Apr 2023 14:08:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 924DE3858C00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394929; bh=q5E6LNm7YTg4YU/L49XpJ2YMm9u9UDb3wWhfpmVJDNw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=rKr5S1pDd9Iaq27BHzDfEq4FWRgY6JVMvCjjvWhFQedr1tDgZkrY8Jly0/8VpXlI9 Nb7fB3kinyfq+At168VJRaYF/wNn/LynmEb4otg0xcCZDPO5DMGs6dHjFwuyO1ro2X VBK/lEIovUN5LxZlWdbx1WRRMeelkgKeYLC6DD7I= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id AF6923858D32 for ; Thu, 13 Apr 2023 14:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AF6923858D32 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EBB65218D9; Thu, 13 Apr 2023 14:08:15 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D384E13421; Thu, 13 Apr 2023 14:08:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id KDebMs8MOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:15 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 1/8] [gdb/testsuite] Add warning for timeout in accept_gdb_output Date: Thu, 13 Apr 2023 16:08:20 +0200 Message-Id: <20230413140827.19412-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In accept_gdb_output we have: ... timeout { # Assume a timeout means we somehow missed the # expected result, and carry on. return 0 } ... The timeout is silent, and though in some places the return value is checked, this is not done consistently, and consequently there are silent timeouts when running the TUI testsuite (gdb.tui/*.exp and gdb.python/tui*.exp). Each timeout is 10 seconds, and there are 5 in total in the TUI tests, taking 50 seconds overall: ... real 1m0.275s user 0m10.440s sys 0m1.343s ... With an entire testsuite run taking about 30 minutes, that is about 2.5% of the time spent waiting in TUI tests. Let's make the timeouts visible using a warning, such that they can be fixed. Tested on x86_64-linux. --- gdb/testsuite/lib/tuiterm.exp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index 05edfe9a5b1..ff38af082da 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -707,6 +707,8 @@ namespace eval Term { timeout { # Assume a timeout means we somehow missed the # expected result, and carry on. + warning "timeout in accept_gdb_output" + dump_screen return 0 } } From patchwork Thu Apr 13 14:08:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67698 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B8F4385701E for ; Thu, 13 Apr 2023 14:08:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1B8F4385701E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394926; bh=IQewUp1503O/c7CvBa8osw91cqb6RDYysNXCkNKJQVc=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=wnTjhT+a5LjLvou1hSY4rOL4unCXdVeWCNeUc7/lDxazz8zMuxshwFVujRlEPqoTI Oxxhah2mmmaA40MFNY2U4ipCJEM6n2YdBJVO28YWrbEV7FWCkufP3XWN2asX2f4QYM oS+sZHIMSnYcriZaraP87ozlfdinxhv6OOibpckI= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id D0C893858D35 for ; Thu, 13 Apr 2023 14:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0C893858D35 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 13052218DF; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F02ED13421; Thu, 13 Apr 2023 14:08:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 4ByhOc8MOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:15 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 2/8] [gdb/testsuite] Add debug prints in Term::wait_for Date: Thu, 13 Apr 2023 16:08:21 +0200 Message-Id: <20230413140827.19412-3-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" The semantics of wait_for are non-trivial, and a bit hard to understand sometimes. Add some debug prints in wait_for that make it clear: - what regexps we're trying to match, - what strings we compare to the regexps, and - whether there's a match or mismatch. I've added this ad-hoc a couple of times, and it seems that it's worth having readily available. The debug prints are enabled by adding DEBUG_TUI_MATCHING=1 to the RUNTESTFLAGS: ... $ make check RUNTESTFLAGS="gdb.tui/empty.exp DEBUG_TUI_MATCHING=1" ... Tested on x86_64-linux. --- gdb/testsuite/lib/tuiterm.exp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index ff38af082da..bb462911046 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -716,6 +716,20 @@ namespace eval Term { return 1 } + # Print arg using "verbose -log" if DEBUG_TUI_MATCHING == 1. + proc debug_tui_matching { arg } { + set debug 0 + if { [info exists ::DEBUG_TUI_MATCHING] } { + set debug $::DEBUG_TUI_MATCHING + } + + if { ! $debug } { + return + } + + verbose -log "$arg" + } + # Accept some output from gdb and update the screen. WAIT_FOR is # a regexp matching the line to wait for. Return 0 on timeout, 1 # on success. @@ -724,7 +738,10 @@ namespace eval Term { variable _cur_col variable _cur_row + set fn "wait_for" + set prompt_wait_for "$gdb_prompt \$" + debug_tui_matching "$fn: regexp: '$wait_for'" while 1 { if { [accept_gdb_output] == 0 } { @@ -740,10 +757,14 @@ namespace eval Term { set prev [get_line $_cur_row] } if {[regexp -- $wait_for $prev]} { + debug_tui_matching "$fn: match: '$prev'" if {$wait_for == "$prompt_wait_for"} { break } set wait_for $prompt_wait_for + debug_tui_matching "$fn: regexp prompt: '$wait_for'" + } else { + debug_tui_matching "$fn: mismatch: '$prev'" } } From patchwork Thu Apr 13 14:08:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67697 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C8D023857714 for ; Thu, 13 Apr 2023 14:08:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8D023857714 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394920; bh=sT0LWq4Tp9V+sBRsvzPT6Mr1v/dEoKj8/635cxpK+lw=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=EyprCxVjrzHhmtBcsyr340nf9LoLGgY8ihPszE+U6jWCinoG8+5YTug92wPabycD6 UanmrKSleZDAVeF1edwqFxsndQecTsmv8DmLzrJcx+wNMuPpCB43Aa3Sy/sXnJPZ+G S15Cow9yh0/hGMATuT75ds5AYyJ+svNSSkU4lyXQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 00E413858D37 for ; Thu, 13 Apr 2023 14:08:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 00E413858D37 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 304491FD66; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1978B13421; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SDKuBNAMOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 3/8] [gdb/testsuite] Fix timeout in gdb.tui/corefile-run.exp Date: Thu, 13 Apr 2023 16:08:22 +0200 Message-Id: <20230413140827.19412-4-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.tui/corefile-run.exp we run into: ... WARNING: timeout in accept_gdb_output PASS: gdb.tui/corefile-run.exp: load corefile ... The timeout happens in this command: ... Term::command "core-file $core" ... because it tries to match "(gdb) $cmd" but $cmd is split over two lines: ... 16 (gdb) core-file /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.tui/co 17 refile-run/corefile-run.core 18 [New LWP 5370] 19 Core was generated by `/data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb 20 .tui/corefile-run/coref'. 21 Program terminated with signal SIGTRAP, Trace/breakpoint trap. 22 #0 main () at tui-layout.c:21 23 (gdb) ... Fix this by using send_gdb "$cmd\n" and wait_for "Program terminated" instead. Tested on x86_64-linux. --- gdb/testsuite/gdb.tui/corefile-run.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.tui/corefile-run.exp b/gdb/testsuite/gdb.tui/corefile-run.exp index 6769dfbd800..a81d7e7c208 100644 --- a/gdb/testsuite/gdb.tui/corefile-run.exp +++ b/gdb/testsuite/gdb.tui/corefile-run.exp @@ -63,7 +63,8 @@ set text [Term::get_all_lines] gdb_assert {![string match "No Source Available" $text]} \ "initial source listing" -Term::command "core-file $core" +send_gdb "core-file $core\n" +Term::wait_for "Program terminated" Term::check_contents "load corefile" "$src_line_nr *$src_line.*$gdb_prompt .*" Term::command "run" From patchwork Thu Apr 13 14:08:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67700 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 77F06385558E for ; Thu, 13 Apr 2023 14:09:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 77F06385558E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394949; bh=WhNSTXqFG9iZqhFizXk3cbOatIgCxE3ShaCnYdrgcbE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ipRyC6Pc0Mp+1nsHpavOJzDeOcKdCpUp+u1cGd5SVgJqwedVDcnTIohRCYNSgP8Yb 58J0vUR9f5QpBiqNtSeZWo+EGZkPEWE3VWL5NA+s/wkMJlXTGldcog/iToYNvWZyXw dCTk5eC0tPF33ogjt3DIEasVJHafmcbjBMex3D9c= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 1923B3858D3C for ; Thu, 13 Apr 2023 14:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 1923B3858D3C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 496F9218E0; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3459F139D3; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id OOydC9AMOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 4/8] [gdb/testsuite] Fix timeout in gdb.tui/main.exp Date: Thu, 13 Apr 2023 16:08:23 +0200 Message-Id: <20230413140827.19412-5-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.tui/main.exp we run into: ... WARNING: timeout in accept_gdb_output PASS: gdb.tui/main.exp: show main after file ... The problem is that this command: ... Term::command "file [standard_output_file $testfile]" ... tries to match "(gdb) $cmd", but due to the long file name, $cmd is split up over two lines: ... 16 (gdb) file /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.tui/main/ma 17 in 18 Reading symbols from /data/vries/gdb/leap-15-4/build/gdb/testsuite/outputs/gdb.t 19 ui/main/main... 20 (gdb) ... Fix this by matching "Reading symbols from" instead. Tested on x86_64-linux. --- gdb/testsuite/gdb.tui/main.exp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.tui/main.exp b/gdb/testsuite/gdb.tui/main.exp index e5f26c7aac3..a7cacf0a8b8 100644 --- a/gdb/testsuite/gdb.tui/main.exp +++ b/gdb/testsuite/gdb.tui/main.exp @@ -34,7 +34,8 @@ if {![Term::enter_tui]} { return } -Term::command "file [standard_output_file $testfile]" +send_gdb "file [standard_output_file $testfile]\n" +gdb_assert { [Term::wait_for "Reading symbols from"] } "file command" Term::check_contents "show main after file" "\\|.*21 *return 0" # Ensure that "file" clears the source window. From patchwork Thu Apr 13 14:08:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67702 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 149873856952 for ; Thu, 13 Apr 2023 14:09:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 149873856952 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394958; bh=9wqUTjU52GZEJMgfY606YlmSUxRDZN+wxHtKtGPO2vE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=gVZI0VdfXackIoFkQgE9VdjheMqVhUKRxIb4k/LkOofdzYKD2BZ72cZCTlXpyZsP5 zC1mhY3eSfXug5nap8PvF4uFHtvl3J8IvZSbfUsyTcgUF5dSbVKmNHjkz7Qe/kQpcO pMTJmGL/3ufQhPq6d9Xf3P0N8zy508NK+ZFNtKk4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 3D1CA3858CDA for ; Thu, 13 Apr 2023 14:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D1CA3858CDA Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 648AF218E1; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4D95A13421; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id IG33EdAMOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 5/8] [gdb/testsuite] Fix timeout in gdb.tui/new-layout.exp Date: Thu, 13 Apr 2023 16:08:24 +0200 Message-Id: <20230413140827.19412-6-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_ASCII_DIVIDERS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In test-case gdb.tui/new-layout.exp we run into: ... WARNING: timeout in accept_gdb_output PASS: gdb.tui/new-layout.exp: layout=cmd_only {cmd 1} {} {}: \ bottom of cmd window is blank ... The timeout happens here: ... Term::command "layout src" ... Before the "layout src" command we have: ... Screen Dump (size 80 columns x 24 rows, cursor at column 46, row 7): 0 +-tui-layout.c-------------------------+(gdb) layout example3 1 | 20 { |(gdb) layout src 2 | 21 return 0; |(gdb) winheight cmd 8 3 | 22 } |(gdb) layout example4 4 | 23 |(gdb) layout src 5 | 24 |(gdb) winheight cmd 8 6 | 25 |(gdb) layout example5 7 | 26 |(gdb) 8 | 27 | 9 | 28 | 10 | 29 | 11 | 30 | 12 | 31 | 13 | 32 | 14 | 33 | 15 | 34 | 16 | 35 | 17 | 36 | 18 | 37 | 19 | 38 | 20 | 39 | 21 | 40 | 22 +--------------------------------------+ 23 exec No process In: L?? PC: ?? ... and after: ... Screen Dump (size 80 columns x 24 rows, cursor at column 6, row 16): 0 +-tui-layout.c-----------------------------------------------------------------+ 1 | 20 { | 2 | 21 return 0; | 3 | 22 } | 4 | 23 | 5 | 24 | 6 | 25 | 7 | 26 | 8 | 27 | 9 | 28 | 10 | 29 | 11 | 30 | 12 | 31 | 13 | 32 | 14 +------------------------------------------------------------------------------+ 15 exec No process In: L?? PC: ?? 16 (gdb) 17 18 19 20 21 22 23 ... The Term::command "layout src" is waiting to match: - "(gdb) layout src", and then - "(gdb) ". The first part fails to match on a line: ... | 26 |(gdb) layout src ... because it expects the prompt at the start of the line. Fix this by allowing the prompt at the start of a window as well. Tested by x86_64-linux. --- gdb/testsuite/lib/tuiterm.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index bb462911046..fa703fc060e 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -850,7 +850,7 @@ namespace eval Term { global gdb_prompt send_gdb "$cmd\n" set str [string_to_regexp $cmd] - set str "^$gdb_prompt $str" + set str "(^|\|)$gdb_prompt $str" wait_for $str } From patchwork Thu Apr 13 14:08:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67703 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3DD34385735D for ; Thu, 13 Apr 2023 14:09:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3DD34385735D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394977; bh=4eiKo2LgodNH19zEfl8cwNwGYnnjsIuGbiHvhThrsjE=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=kGiFmgh1eJz6nJpEzF45AZWjIuSJ5h0d0SR3Hf8KIHuH6LRqRyCUZpeZmrBOCBKhO oi2IlsahKDjmPYWUfK896l/tR7u5sEMHrhEQFOAZaXg/F3i6FVmC0eXyKvP91y6QF0 AyvZdFluTpxteS4UKrqtpcyUAa6XkV8YA91rdJek= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 4BE5C3858C83 for ; Thu, 13 Apr 2023 14:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4BE5C3858C83 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7CFC1218E2; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 67627139D3; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6BE+GNAMOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 6/8] [gdb/testsuite] Fix timeout in gdb.tui/completion.exp Date: Thu, 13 Apr 2023 16:08:25 +0200 Message-Id: <20230413140827.19412-7-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With test-case gdb.tui/completion.exp, we run into: ... WARNING: timeout in accept_gdb_output PASS: gdb.tui/completion.exp: check focus completions ... The timeout happens in this command: ... Term::command "layout src" ... which waits for: - "(gdb) layout src", and then - "(gdb) ". Because the "layout src" command enables the TUI there's just a prompt. Fix this by using Term::command_no_prompt_prefix. Tested on x86_64-linux. --- gdb/testsuite/gdb.tui/completion.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.tui/completion.exp b/gdb/testsuite/gdb.tui/completion.exp index 85abd4a958b..9cf8dc2ee25 100644 --- a/gdb/testsuite/gdb.tui/completion.exp +++ b/gdb/testsuite/gdb.tui/completion.exp @@ -66,7 +66,7 @@ if {![Term::prepare_for_tui]} { return } -Term::command "layout src" +Term::command_no_prompt_prefix "layout src" Term::command "complete focus " Term::dump_screen Term::check_region_contents "check focus completions" 0 17 80 5 \ From patchwork Thu Apr 13 14:08:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67704 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 154A7385AC29 for ; Thu, 13 Apr 2023 14:10:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 154A7385AC29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681395005; bh=crcaPwVWVa5Xa72kDJ27oETX9JjcY0IgqR+T0Z9ds+0=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Ln6MyefmW12CmsNbNEa+E+D94/x8WkcWZB86J7BL/sqOGp/+Vxr0lArYX14V4vISI u0w6Fx+jFq/b8nah1smu+Evc8EFWnWV5DhIpwvD+bL6weWDdu/bDZc7HUE8O9nTCQv Ki5aI2DiyHu+ak5qIs+2REyDZhUb/cOoKjyqvO34= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by sourceware.org (Postfix) with ESMTPS id 6DA763858C54 for ; Thu, 13 Apr 2023 14:08:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6DA763858C54 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 97B471FD68; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8182B13421; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SDGkHtAMOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 7/8] [gdb/testsuite] Fix timeout in gdb.tui/empty.exp Date: Thu, 13 Apr 2023 16:08:26 +0200 Message-Id: <20230413140827.19412-8-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" In test-case gdb.tui/empty.exp we run into: ... WARNING: timeout in accept_gdb_output PASS: gdb.tui/empty.exp: src: 90x40: box 1 ... We timeout here in Term::resize: ... # Due to the strange column resizing behavior, and because we # don't care about this intermediate resize, we don't check # the size here. wait_for "@@ resize done $_resize_count" ... because the string we're trying to match is split over two lines: ... 25 -----------------------------------------------------------------------------+No 26 ne No process In: L?? PC: ?? @@ 27 resize done 0, size = 79x40 28 (gdb) ... Fix this by dropping the "@@ " prefix. Tested on x86_64-linux. --- gdb/testsuite/lib/tuiterm.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index fa703fc060e..d8a99d2798a 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -1124,8 +1124,8 @@ namespace eval Term { stty rows $_rows < $::gdb_tty_name # Due to the strange column resizing behavior, and because we # don't care about this intermediate resize, we don't check - # the size here. - wait_for "@@ resize done $_resize_count" + # the size and the "@@ " prefix here. + wait_for "resize done $_resize_count" incr _resize_count # Somehow the number of columns transmitted to gdb is one less # than what we request from expect. We hide this weird From patchwork Thu Apr 13 14:08:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 67701 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E81463858284 for ; Thu, 13 Apr 2023 14:09:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E81463858284 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1681394949; bh=0yP1HffPQD/oRxyr97b3ZHCpSniUsncSLnwgQAUFpBM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=Xy6uaCco2ng6yw7PAuculbySBa78P6Q/+PIlZ8uOxRQmC49JCT71vaQo70bL9Yr00 SunQueTEDk6gnii0HrAcjxEK3e4TUdj2QpdD3UCiorms5Pbx4FUnJtuonealUrO2bZ /9MZJf9zx+5nQp/uy+3T6Q3kQ6S5NivoFnj3R5M4= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 534B5385840C for ; Thu, 13 Apr 2023 14:08:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 534B5385840C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B3256218E3; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 9B13013421; Thu, 13 Apr 2023 14:08:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id kIDZJNAMOGQ1MAAAMHmgww (envelope-from ); Thu, 13 Apr 2023 14:08:16 +0000 To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 8/8] [gdb/tui] Fix TUI for TERM=ansi Date: Thu, 13 Apr 2023 16:08:27 +0200 Message-Id: <20230413140827.19412-9-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230413140827.19412-1-tdevries@suse.de> References: <20230413140827.19412-1-tdevries@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_INVALID, DKIM_SIGNED, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom de Vries via Gdb-patches From: Tom de Vries Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" With TERM=ansi, when resizing a TUI window from LINES/COLUMNS 31/118 (maximized) to 20/78 (de-maximized), I get a garbled screen and a message: ... @@ resize done 0, size = 77x20 ... with the resulting width being 77 instead of the expected 78. [ The discrepancy also manifests in CLI, filed as PR30346. ] The discrepancy comes from tui_resize_all, where we ask readline for the screen size: ... rl_get_screen_size (&screenheight, &screenwidth); ... As it happens, when TERM is set to ansi, readline decides that the terminal cannot auto-wrap lines, and reserves one column to deal with that, and as a result reports back one less than the actual screen width: ... $ echo $COLUMNS 78 $ TERM=xterm gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 78. $ TERM=ansi gdb -ex "show width" -ex q Number of characters gdb thinks are in a line is 77. ... In tui_resize_all, we need the actual screen width, and using a screenwidth of one less that the actual value garbles the screen. This is currently not causing trouble in testing because we have a workaround in place in proc Term::resize. Fix this by: - detecting when readline reports back less than the actual screen width, - accordingly setting a new variable readline_hidden_cols, - using readline_hidden_cols in tui_resize_all to fix the resize problem, and - removing the workaround in Term::resize. The test-case gdb.tui/empty.exp serves as regression test. Tested on x86_64-linux. PR tui/30337 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30337 --- gdb/testsuite/lib/tuiterm.exp | 10 ++-------- gdb/tui/tui-win.c | 3 +++ gdb/utils.c | 9 +++++++++ gdb/utils.h | 7 +++++++ 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/gdb/testsuite/lib/tuiterm.exp b/gdb/testsuite/lib/tuiterm.exp index d8a99d2798a..f59a66a0958 100644 --- a/gdb/testsuite/lib/tuiterm.exp +++ b/gdb/testsuite/lib/tuiterm.exp @@ -1122,16 +1122,10 @@ namespace eval Term { # explicit here. This also simplifies waiting for the redraw. _do_resize $rows $_cols stty rows $_rows < $::gdb_tty_name - # Due to the strange column resizing behavior, and because we - # don't care about this intermediate resize, we don't check - # the size and the "@@ " prefix here. - wait_for "resize done $_resize_count" + wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}" incr _resize_count - # Somehow the number of columns transmitted to gdb is one less - # than what we request from expect. We hide this weird - # details from the caller. _do_resize $_rows $cols - stty columns [expr {$_cols + 1}] < $::gdb_tty_name + stty columns $_cols < $::gdb_tty_name wait_for "@@ resize done $_resize_count, size = ${_cols}x${rows}" incr _resize_count } diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c index 3b17cb8dd29..7186fb97d68 100644 --- a/gdb/tui/tui-win.c +++ b/gdb/tui/tui-win.c @@ -36,6 +36,7 @@ #include "gdbsupport/event-loop.h" #include "gdbcmd.h" #include "async-event.h" +#include "utils.h" #include "tui/tui.h" #include "tui/tui-io.h" @@ -528,6 +529,8 @@ tui_resize_all (void) int screenheight, screenwidth; rl_get_screen_size (&screenheight, &screenwidth); + screenwidth += readline_hidden_cols; + width_diff = screenwidth - tui_term_width (); height_diff = screenheight - tui_term_height (); if (height_diff || width_diff) diff --git a/gdb/utils.c b/gdb/utils.c index 6ec1cc0d48d..05a2b27bc65 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -1116,6 +1116,10 @@ static bool filter_initialized = false; +/* See utils.h. */ + +int readline_hidden_cols = 0; + /* Initialize the number of lines per page and chars per line. */ void @@ -1144,6 +1148,11 @@ init_page_info (void) /* Get the screen size from Readline. */ rl_get_screen_size (&rows, &cols); + if (gdb_stdout->isatty ()) { + readline_hidden_cols = COLS - cols; + gdb_assert (readline_hidden_cols >= 0); + gdb_assert (readline_hidden_cols <= 1); + } lines_per_page = rows; chars_per_line = cols; diff --git a/gdb/utils.h b/gdb/utils.h index a383036bcfe..29ff376bb52 100644 --- a/gdb/utils.h +++ b/gdb/utils.h @@ -335,4 +335,11 @@ extern void copy_bitwise (gdb_byte *dest, ULONGEST dest_offset, const gdb_byte *source, ULONGEST source_offset, ULONGEST nbits, int bits_big_endian); +/* When readline decides that the terminal cannot auto-wrap lines, it reduces + the width of the reported screen width by 1. This variable indicates + whether that's the case or not, allowing us to add it back where + necessary. See _rl_term_autowrap in readline/terminal.c. */ + +extern int readline_hidden_cols; + #endif /* UTILS_H */