From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id DF8E43858C5E for ; Tue, 30 May 2023 10:13:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF8E43858C5E Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685441581; 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=danXtuVPM7bh/xlwcTe+brVa71etjIk74i2+4o7nVw8=; b=gyiwQ0e4+CX50Mxnj9ABcpa3qba1vdOE2oLAasxjr5+zr9sWot7GPLNSRpsjQCbdnlv25B 3IK38CuFjIk9+gOTQR2p7Iol4iSz9urD4uWpTsZlNo623KTd9hgTE63oAXvNksV8WJtWwq rdpMXEwb/xr4Rt8KE2IEYzSdRf0cOpM= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-214-ks469aGZNhiKEwmEYmlRJQ-1; Tue, 30 May 2023 06:12:58 -0400 X-MC-Unique: ks469aGZNhiKEwmEYmlRJQ-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-3f608ea689cso27219485e9.3 for ; Tue, 30 May 2023 03:12:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685441577; x=1688033577; h=content-transfer-encoding:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hHMisrNgXHcYVP7fpvESsG5OXpW/H+xZnMZ+ELqnNUc=; b=DkpbKaSmdVms4mCUInLfOHt0GKTrcUts+shVBPulYkAPaxTRsGtLT5Z7gi0RL6iMRf Hv7VTYm3XVeM+1O7lfnnad5gY65lteg4/14/6jKHewAJF7UXV++OGM7MO8pzzfQfZswY g1eRoPjaWtSmiL/gMT71AZly/Ya1Xxp3Gbx33HuWhiLCVXiJokYU+mfGFAfVE8r5l5pd h0tLwxSvLiYJpG0sCFYTarlUxfJ4kYwykx9pnAKIfngUATYiv6B1zoECFZMkZUJ7czFy Be5AjZp9JYEvuKmswIFEBxtl1kgixyHYx/1BCfy9EV+lEfiT8O8/nZHXaXjn2lz/YSnC YeTA== X-Gm-Message-State: AC+VfDxLraT3T6V5S+HCigQQp7/D9o1O6F1/DPWHszo2O8zuLgPz8dmK V4vzqzlROe0ATMe0j/ssSmK1jWma3cTx5REi3juzc+w6aEZzS8crs49i9hojDfPByZYzq8msFNp kzDK/avGj0T5ZFxIAdRTfOw== X-Received: by 2002:a1c:f318:0:b0:3f6:da2:bc86 with SMTP id q24-20020a1cf318000000b003f60da2bc86mr1351418wmq.7.1685441577016; Tue, 30 May 2023 03:12:57 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WS5+iJ7hE9UQXr0acuApG4D1HGBkOCPhZsX/GVYAfkDqdpU8YsJv/ahoAxq3ZZA0AfNp8fw== X-Received: by 2002:a1c:f318:0:b0:3f6:da2:bc86 with SMTP id q24-20020a1cf318000000b003f60da2bc86mr1351397wmq.7.1685441576690; Tue, 30 May 2023 03:12:56 -0700 (PDT) Received: from localhost (11.72.115.87.dyn.plus.net. [87.115.72.11]) by smtp.gmail.com with ESMTPSA id q21-20020a1ce915000000b003f421979398sm20456700wmc.26.2023.05.30.03.12.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 03:12:56 -0700 (PDT) From: Andrew Burgess To: Tom de Vries , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH] [gdb/testsuite] Fix gdb.tui/wrap-line.exp In-Reply-To: References: <20230518061046.17837-1-tdevries@suse.de> <87ilcm83tt.fsf@redhat.com> Date: Tue, 30 May 2023 11:12:54 +0100 Message-ID: <87edmy5dqx.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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: Tom de Vries writes: > On 5/21/23 18:48, Tom de Vries wrote: >> On 5/21/23 10:51, Andrew Burgess wrote: >>> Tom de Vries via Gdb-patches writes: >>> >>>> PR testsuite/30458 reports the following FAIL: >>>> ... >>>> PASS: gdb.tui/wrap-line.exp: width-auto-detected: cli: wrap >>>> ^CQuit >>>> (gdb) WARNING: timeout in accept_gdb_output >>>> Screen Dump (size 50 columns x 24 rows, cursor at column 6, row 3): >>>> =C2=A0=C2=A0=C2=A0=C2=A0 0 Quit >>>> =C2=A0=C2=A0=C2=A0=C2=A0 1 (gdb) 7890123456789012345678901234567890123= 456789 >>>> =C2=A0=C2=A0=C2=A0=C2=A0 2 W^CQuit >>>> =C2=A0=C2=A0=C2=A0=C2=A0 3 (gdb) >>>> =C2=A0=C2=A0 ... >>>> FAIL: gdb.tui/wrap-line.exp: width-auto-detected: cli: prompt after wr= ap >>>> ... >>>> >>>> The problem is that the regexp doesn't account for the ^C: >>>> ... >>>> =C2=A0=C2=A0=C2=A0=C2=A0 gdb_assert { [Term::wait_for "^WQuit"] } "pro= mpt after wrap" >>>> ... >>>> >>>> Fix this by updating the regexp, and likewise in another place in the >>>> test-case where we use ^C. >>> >>> Do we know why we sometimes manage to see '^C'?=C2=A0 I guess it's a ti= ming >>> thing, but right now I'm at a loss for how we manage to see it.=C2=A0 I= t >>> appears that we print the wrapping line, that ends with 'W', and then >>> wait for this to be displayed. >>> >>> At this point GDB should be in a stable state waiting in the >>> event-loop. >>> >>> When we send \003 this should trigger an event, which should trigger >>> async_request_quit, which should result in the 'Quit' exception being >>> thrown, caught, and printed. >>> >>> I think the '^C' must be getting printed from tui_redisplay_readline >>> maybe, but I can't see how that gets triggered with \003 in the input >>> buffer. >>> >>> I only ask because if we understand why '^C' is sometimes printed then >>> we might be able to decide if this should always be printed, or never b= e >>> printed, and change GDB accordingly... >>> >>=20 >> Hi Andrew, >>=20 >> yes, that's a good question. >>=20 >> [ Note that it's a TUI test-case, but the FAIL we're observing is in the= =20 >> cli part, before activating TUI, so tui_redisplay_readline has nothing= =20 >> to do with the FAIL. ] >>=20 >> I've added an assert in rl_echo_signal_char and managed to trigger it to= =20 >> generate a core file corresponding to the FAIL condition (more details= =20 >> in the PR). >>=20 >> My guess at what happens is the following: >> - we send a W to gdb >> - readline handles this, and echoes it >> - after readline echoing it, expect notices this and we send a ^C to gdb >> - at this point readline is still in the code handling the W, and >> =C2=A0 handles the ^C by echoing it. >>=20 >> Usually, at this point we're already back in gdb and handle the ^C=20 >> without echoing it. >>=20 > > Andrew, any comment? Sorry, lost track of this thread. Will take a look today. Thanks, Andrew > > Thanks, > - Tom > >> Thanks, >> - Tom >>=20 >>> Thanks, >>> Andrew >>> >>>> >>>> Tested on x86_64-linux. >>>> >>>> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=3D30458 >>>> --- >>>> =C2=A0 gdb/testsuite/gdb.tui/wrap-line.exp | 6 ++++-- >>>> =C2=A0 1 file changed, 4 insertions(+), 2 deletions(-) >>>> >>>> diff --git a/gdb/testsuite/gdb.tui/wrap-line.exp=20 >>>> b/gdb/testsuite/gdb.tui/wrap-line.exp >>>> index 4587517504c..2bfe342e04d 100644 >>>> --- a/gdb/testsuite/gdb.tui/wrap-line.exp >>>> +++ b/gdb/testsuite/gdb.tui/wrap-line.exp >>>> @@ -25,6 +25,8 @@ set cols 50 >>>> =C2=A0 set lines 24 >>>> =C2=A0 set dims [list $lines $cols] >>>> +set re_control_c "(\\^C)?Quit" >>>> + >>>> =C2=A0 # Fill line, assuming we start after the gdb prompt. >>>> =C2=A0 proc fill_line { width } { >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 set res "" >>>> @@ -47,7 +49,7 @@ proc fill_line { width } { >>>> =C2=A0 proc test_wrap { wrap_width } { >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # Generate a prompt and parse it. >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 send_gdb "\003" >>>> -=C2=A0=C2=A0=C2=A0 gdb_assert { [Term::wait_for "(^|$::gdb_prompt )Qu= it"] } "start=20 >>>> line" >>>> +=C2=A0=C2=A0=C2=A0 gdb_assert { [Term::wait_for "(^|$::gdb_prompt=20 >>>> )$::re_control_c"] } "start line" >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # Fill the line to just before wrapping= . >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 set str [fill_line $wrap_width] >>>> @@ -64,7 +66,7 @@ proc test_wrap { wrap_width } { >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 # Generate a prompt and parse it. >>>> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 send_gdb "\003" >>>> -=C2=A0=C2=A0=C2=A0 gdb_assert { [Term::wait_for "^WQuit"] } "prompt a= fter wrap" >>>> +=C2=A0=C2=A0=C2=A0 gdb_assert { [Term::wait_for "^W$::re_control_c"] = } "prompt=20 >>>> after wrap" >>>> =C2=A0 } >>>> =C2=A0 # Test wrapping in both CLI and TUI. >>>> >>>> base-commit: 0cc8cc5e6f82b8d3d8e3803c6f7f5e63f0c866ad >>>> --=20 >>>> 2.35.3 >>> >>=20