From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id kenPF3c0zmletQMAWB0awg (envelope-from ) for ; Thu, 02 Apr 2026 05:18:47 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ealGaXeh; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 50FF81E04F; Thu, 02 Apr 2026 05:18:47 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIMWL_WL_HIGH,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 86BD41E04F for ; Thu, 02 Apr 2026 05:18:46 -0400 (EDT) Received: from vm01.sourceware.org (localhost [127.0.0.1]) by sourceware.org (Postfix) with ESMTP id 5F0F84BA2E35 for ; Thu, 2 Apr 2026 09:18:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F0F84BA2E35 Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=ealGaXeh Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 629304BA2E35 for ; Thu, 2 Apr 2026 09:18:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 629304BA2E35 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 629304BA2E35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775121499; cv=none; b=deOx8S0iyQASnRr94+QMG4KRVo9R871V5lVTguLOtmujm4danyYwMYsE2uh1lDmI3xyK9+BqgAd02Qh/H0eZIP0gxOOzL5Hk4iRBEigis8jX575tsSXyb+M3DC9psVnCIM0CvbHn0Oh1ScfNbO6NKE4da3ReuyjDgswAs4UPTbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775121499; c=relaxed/simple; bh=zXed1hnXquhiSIDc7eN055Tvr62HA5LETUG0EcLphSE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=OY4M69DY67ZSobnSdzVF2Q94NbTnUoztP20vsXZEDzY13znckT2ZGLdA5j7uyC+Vt1PT6iRN4+94GsgxGqTk/a48z+4d18FE+jCQQEfGZ0mbzotPlUHgUimxnWhIw+AsAImOdqjh+hwv8e91qPUv8oQOYlG5vsJhrrdWtd31XJs= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 629304BA2E35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1775121499; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=q1KsDqdoQoyh2AGTAiwGs48wVEa5Oet5OdGC8UGkYT8=; b=ealGaXehrvjXPwhmurIp1b4l8RoS7S6iPoOnbZeMmT2z3sGSIC1JHay4hsO2UWQjagQ5YN mpr5ZONI50u6vkg7uGVzvTgzy0g0pnBJWqxn0Xb258QaaWK+tN6qUTKGtoRgDPyP43Fmhl uiFmQzYQk3U4dxr8IwuRhQQnS7JI9Ww= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-526-FbuvbvedPnilfV-w7keuRw-1; Thu, 02 Apr 2026 05:18:18 -0400 X-MC-Unique: FbuvbvedPnilfV-w7keuRw-1 X-Mimecast-MFC-AGG-ID: FbuvbvedPnilfV-w7keuRw_1775121497 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4888b17ffa6so4775755e9.3 for ; Thu, 02 Apr 2026 02:18:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775121496; x=1775726296; h=mime-version:message-id:date:references:in-reply-to:subject:to:from :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=q1KsDqdoQoyh2AGTAiwGs48wVEa5Oet5OdGC8UGkYT8=; b=dt0/Ji0kFlyJBfHLY1EFSOOPLC8NRf/iqSyTt15OKdYdBMadVbRtoErnfEmO2EzJoy TldK++nMStlPFESTKjzci740fTb/Nesp05zDf7ZZw/QmGhzXDC4MbmUCdzDz7rilZwMk Gk2kKwnsjB3mMlPFTXY1/fqvmu1E0hf1MHMIUJepgNNuUarl2/KXifJ4gt+RLcYumr69 tsdPPY/5cBGIgNtnUiMlyR+Xd3/7KhTGcodEd9TlfHujxmH5rmq7gkACvi9WVtondyN3 PK9BsGj6rVtfgT2J83dEaw2n+CorjW2kLG4q3mSh7AYbjUyMeLUor4Rx6o+CWKH7QecQ urhw== X-Forwarded-Encrypted: i=1; AJvYcCVYzDJCa7AgFVVAm4Wfs3Qq3hppeM0MSfl1TFcwExxsz0Oi6ark4oFXdf0cEIBn8bpoMI9xTym260lhnA==@sourceware.org X-Gm-Message-State: AOJu0YzGTbu358XI8hM9ACTQoqKlwQ6DvXsbtN8iJ2yxERuuu4oASA8D D7UjYMnQly2NHfAoCrLBkDOUQsOIDdyfUaPWaYL5P1b4UpgUVBAZZljtN6GOlyQ9JmOp3CvLtd+ dCIW7KS2VME8UqL9m0TKoFuPB8V8R+fUighaykBxsH43ZZcnK5mMEAjeZhFlZIyLRWzlPwHA= X-Gm-Gg: ATEYQzx0/91aRaktAuwjKHhICd0Xs30XUrozRHoIXumMYnZ3qiS3NIvvolxHy3emmVj funQ3EnjucMzUHSi820aB0TitBcp8+meFOkWxKynFb/UNMomWndPKOZmzIZB4eKA8PUY7AeaYr8 lITxfD4wBRll6EsOAFYQJzvb+TGdSK8qpheHNYBbZOX4BA1H6CtxMlm/egDLOVxIL9ofgxFgL3g WdqoYRbCb8fQ2dtS+JciVs+9stERc87VeTKC8fgzHshefOpf4MnZ8qhD/fntMaXnYNhlj3wgai3 +CyQ8pRUYEUvxhoQfV60xSeXAWczqYTXI6fuJYNw24mmutLqe6kbl/pUfH7+FCzjrXz7vqdWiC6 MI6cVS3hy+zdeOUSq X-Received: by 2002:a05:600c:a16:b0:485:a4de:f4f9 with SMTP id 5b1f17b1804b1-48883599b21mr120549345e9.27.1775121496428; Thu, 02 Apr 2026 02:18:16 -0700 (PDT) X-Received: by 2002:a05:600c:a16:b0:485:a4de:f4f9 with SMTP id 5b1f17b1804b1-48883599b21mr120548775e9.27.1775121495944; Thu, 02 Apr 2026 02:18:15 -0700 (PDT) Received: from localhost ([31.111.84.232]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4888a705ebdsm65693045e9.10.2026.04.02.02.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2026 02:18:15 -0700 (PDT) From: Andrew Burgess To: Tom de Vries , gdb-patches@sourceware.org Subject: Re: [PATCH] [gdb/tui] Make tui_setup_io more robust In-Reply-To: <20260221153831.2743758-1-tdevries@suse.de> References: <20260221153831.2743758-1-tdevries@suse.de> Date: Thu, 02 Apr 2026 10:18:14 +0100 Message-ID: <87fr5d67qh.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: HsADHxD4Hy5xHaQ0_QF5UT56hgxv2NBdu3DwC2ob_7s_1775121497 X-Mimecast-Originator: redhat.com Content-Type: text/plain 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 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 :) > > 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! This seems a reasonable change to me. Approved-By: Andrew Burgess 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