From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id C+sGDUbezmmbfQQAWB0awg (envelope-from ) for ; Thu, 02 Apr 2026 17:23:18 -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=A4E3D1GB; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=7cVyYU1f; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=A4E3D1GB; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=7cVyYU1f; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 1E6DE1E0BC; Thu, 02 Apr 2026 17:23:18 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 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_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 530F81E08C for ; Thu, 02 Apr 2026 17:23:16 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 961724BA23D9 for ; Thu, 2 Apr 2026 21:23:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 961724BA23D9 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=A4E3D1GB; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=7cVyYU1f; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=A4E3D1GB; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=7cVyYU1f Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id E974D4BA23C9 for ; Thu, 2 Apr 2026 21:22:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E974D4BA23C9 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 E974D4BA23C9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775164968; cv=none; b=lHyGzSthHOATNJyEQEQXstfQuVW06Q1SNLSBcUe2xZ7pp6xcFLDZuipgCLEOHZcQcKtCErFIU5vonVKY1MWlyMIRMWEpi2NuYcAGs1Q+28/QjhfzfaHMerSSAxXZhb/gW2Zz2vxVBhYm0Y0zzOkY07w4iVo7VFonmsRHe4TZ2DI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775164968; c=relaxed/simple; bh=52J7/X1Aat3vCL7e8I3GFVWpTHgsxOKbHEFR7ZxKDRs=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature: Message-ID:Date:MIME-Version:Subject:To:From; b=goV/vae3/AgVokvh9bXUkfeLSrc1v0ULnplZ0uPpB+a2hCEvOy2l0ggesYcBZq/l9PDTCZIAUHeT2blRO+KT+QCwcIU+nBegYD1Zw0qBqWWqE7pozbkh7inW9WRIFofz6IUIlLYSe+e+QubD3oxa+RsU846n7E4mr+gA9pAlLTs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E974D4BA23C9 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-out2.suse.de (Postfix) with ESMTPS id 34FA35BD32; Thu, 2 Apr 2026 21:22:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775164966; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aTbgCF/gJw71Nin2HuRNg/ztW/cP7I07EIS4XP8hv0M=; b=A4E3D1GB7dzMB01Fn1ZOOpyJSCWSTuR+xTsMemFfnQk/1rKZnf1yYkKlMdh5/P1lnux8ZS brEyjGMatb28eVdp3GKCwcAGKLDG8JH5tcKK1TF9VvKKJwc4+t+coRr4bPP8rGBjmCFkdt SyVaQJIYKW5zjGCDLx9TG0E0R5Erp2Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775164966; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aTbgCF/gJw71Nin2HuRNg/ztW/cP7I07EIS4XP8hv0M=; b=7cVyYU1fLhTorx23KvNMvkjzHO9cvU08zewhWw9dDjWVV5Gm2tBo1y96qUpJxzwJG5krjO 2H/Uaj7bBC4IuVAg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=A4E3D1GB; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7cVyYU1f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775164966; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aTbgCF/gJw71Nin2HuRNg/ztW/cP7I07EIS4XP8hv0M=; b=A4E3D1GB7dzMB01Fn1ZOOpyJSCWSTuR+xTsMemFfnQk/1rKZnf1yYkKlMdh5/P1lnux8ZS brEyjGMatb28eVdp3GKCwcAGKLDG8JH5tcKK1TF9VvKKJwc4+t+coRr4bPP8rGBjmCFkdt SyVaQJIYKW5zjGCDLx9TG0E0R5Erp2Y= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775164966; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aTbgCF/gJw71Nin2HuRNg/ztW/cP7I07EIS4XP8hv0M=; b=7cVyYU1fLhTorx23KvNMvkjzHO9cvU08zewhWw9dDjWVV5Gm2tBo1y96qUpJxzwJG5krjO 2H/Uaj7bBC4IuVAg== 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 1D9DD4A0B0; Thu, 2 Apr 2026 21:22:46 +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 o/PcBSbezmnRNgAAD6G6ig (envelope-from ); Thu, 02 Apr 2026 21:22:46 +0000 Message-ID: <17d38506-0968-4e3b-b808-5a3d5b913172@suse.de> Date: Thu, 2 Apr 2026 23:22:45 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] [gdb/tui] Make tui_setup_io more robust To: Andrew Burgess , gdb-patches@sourceware.org References: <20260221153831.2743758-1-tdevries@suse.de> <87fr5d67qh.fsf@redhat.com> Content-Language: en-US From: Tom de Vries In-Reply-To: <87fr5d67qh.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; 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)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; TO_DN_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,sourceware.org:url]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 34FA35BD32 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 On 4/2/26 11:18 AM, Andrew Burgess wrote: > Tom de Vries writes: > >> The following sequence of events may happen when enabling TUI: >> - tui_enable () is called, >> - a SIGFPE happens, before tui_setup_io (1) is called, >> - the SIGFPE triggers handle_fatal_signal, which calls tui_disable (), >> - during tui_disable (), tui_setup_io (0) is called, and >> - tui_setup_io (0) tries to restore things that were saved during a previous >> tui_setup_io (1) call, but tui_setup_io (1) was never called so the saving >> never happened. >> >> This can cause current_ui.m_ui_stderr to be nullptr, which then can cause a >> crash in sig_write (PR33918). > > If this bug number is worth mentioning, then we should add a 'Bug:...' > tag to the commit message. I like them if for nothing else they are > clickable in my terminal :) Hi Andrew, thanks for the review. I didn't add the tag, because I usually only add the tag if the commit claims to fix the PR, and I considered the problem fixed by this patch to be different from the one in the PR (I could have filed a another PR, but didn't bother). But that is a bit of a strict approach, so anyway, added. >> Fix this by: >> - adding a variable tui_io_mode, and >> - using the variable to bail out of tui_setup_io in case the current mode >> doesn't change. > > What's one more global, the tui already has so many! I tried to explore a scenario where this mattered, and ran into a problem, for which I filed a PR ( https://sourceware.org/pipermail/gdb-prs/2026q2/047033.html ). But I might also file a PR for the generic problem. > This seems a reasonable change to me. > > Approved-By: Andrew Burgess Thanks, pushed. - Tom > Thanks, > Andrew > > >> >> Tested on x86_64-linux. >> --- >> gdb/tui/tui-io.c | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/gdb/tui/tui-io.c b/gdb/tui/tui-io.c >> index f673fbf36f6..5a3bc604592 100644 >> --- a/gdb/tui/tui-io.c >> +++ b/gdb/tui/tui-io.c >> @@ -824,6 +824,10 @@ tui_rl_display_match_list (char **matches, int len, int max) >> gdb_display_match_list (matches, len, max, &displayer); >> } >> >> +/* Whether the IO is setup for curses (1) or non-curses (0). */ >> + >> +static int tui_io_mode; >> + >> /* Setup the IO for curses or non-curses mode. >> - In non-curses mode, readline and gdb use the standard input and >> standard output/error directly. >> @@ -837,6 +841,14 @@ tui_setup_io (int mode) >> { >> extern int _rl_echoing_p; >> >> + if (tui_io_mode == mode) >> + { >> + /* Nothing to do. Also, this makes sure that we don't try to restore >> + things before having saved them. */ >> + return; >> + } >> + tui_io_mode = mode; >> + >> if (mode) >> { >> /* Ensure that readline has been initialized before saving any >> >> base-commit: 646982f4295bf0a1e64867606d496c34c9a15a0c >> -- >> 2.51.0 >