From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1681394896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQewUp1503O/c7CvBa8osw91cqb6RDYysNXCkNKJQVc=; b=L/v0FtRPnVukLuoYaDsKpeH98WhaEniRGHPfez16pW7iK8jiSWxXMT0L0G9HvwUmVg38mU bQr5IXkVjYPgRo5IBgER6jtsQocWarlrmGQ3eAu/AbvsR/dambUuV9Qegaw0pwVQsO/vFQ O63j4xI1akMj1rQxmKhRa28OXQbLlTA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1681394896; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IQewUp1503O/c7CvBa8osw91cqb6RDYysNXCkNKJQVc=; b=vOvirKl+R5kjq/ZnwqVsXnqSjSeSfwOu14Xz18MjdHTyWOak65PoMUEaK+8Fgj1qJvdEEp 3CVQkOtdKtdDe9Cg== 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 From: Tom de Vries 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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'" } } -- 2.35.3