From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by sourceware.org (Postfix) with ESMTPS id 8F23F3858D39 for ; Thu, 3 Mar 2022 21:26:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8F23F3858D39 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f44.google.com with SMTP id n33-20020a05600c3ba100b003832caf7f3aso3190634wms.0 for ; Thu, 03 Mar 2022 13:26:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=3cW6ZMRwxMTlkY8fH3gm3vF1/7ZxQxCm8G9IZxj0fqY=; b=uGJG+EjQ3KwVlUQ909lxCnHmpLhT6Kmsg/R7bZZeESEpflOvDwjAeCw0jihr9pPkXi dYgL3t+l3hVUczoPk2XwzLSYnajclbUhDybmMxcj4Am5bfsPH4VJDbOVewPu2G29+YbH gQXycNAZBfW5f6V5I23IJyglhlXT14k7OIndsiWvzsdbFv09jLtAkdJAS0xSCGC4GQ/X fD/6jM4ongtho2AgFYWlp/sTWfeQoohqmgVk4BlZ9zdqX2vXJLbUYJUWSzC8h8jHTdKI 9SZ4A7lNaPfSjWvDqc6LMG/yLi5FhsImtG3CUlIS6wXtGuqlRI9FuLWafAwAvOe8OEOj bhvQ== X-Gm-Message-State: AOAM531h0ZpEcQF4GhH4EA5J7p3ab0cp/UYDf8Ub8ckiCBqGpDDBHmEn dGZ6X6JN79lgjCtGLtdCI4YVVvOM97I= X-Google-Smtp-Source: ABdhPJyfZiwHl01xdgDhf+P02tzN4EzgqC/zXvwGEqzqvBERotLzL02oYVCFOGby/h6d5umTWfHfEg== X-Received: by 2002:a05:600c:4e8a:b0:383:52d8:a569 with SMTP id f10-20020a05600c4e8a00b0038352d8a569mr5247966wmq.74.1646342792616; Thu, 03 Mar 2022 13:26:32 -0800 (PST) Received: from ?IPV6:2001:8a0:f924:2600:209d:85e2:409e:8726? ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id l7-20020adfe9c7000000b001f06f8ec92dsm399062wrn.30.2022.03.03.13.26.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 13:26:31 -0800 (PST) Message-ID: Date: Thu, 3 Mar 2022 21:26:30 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH v3 6/7] QUIT processing w/ explicit throw for gdb_exception_forced_quit Content-Language: en-US To: Kevin Buettner , gdb-patches@sourceware.org References: <20220227000051.3336149-1-kevinb@redhat.com> <20220227000051.3336149-7-kevinb@redhat.com> From: Pedro Alves In-Reply-To: <20220227000051.3336149-7-kevinb@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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-List-Received-Date: Thu, 03 Mar 2022 21:26:34 -0000 On 2022-02-27 00:00, Kevin Buettner wrote: > --- a/gdb/tui/tui-io.c > +++ b/gdb/tui/tui-io.c > @@ -1259,6 +1259,10 @@ tui_getc (FILE *fp) > { > return tui_getc_1 (fp); > } > + catch (const gdb_exception_forced_quit &ex) > + { > + throw; > + } > catch (const gdb_exception &ex) > { > /* Just in case, don't ever let an exception escape to readline. This one's incorrect. Note the comment in the context above, and also the comment at the top of the function: /* Get a character from the command window. This is called from the readline package. */ static int tui_getc (FILE *fp) { try { return tui_getc_1 (fp); } catch (const gdb_exception &ex) { /* Just in case, don't ever let an exception escape to readline. This shouldn't ever happen, but if it does, print the exception instead of just crashing GDB. */ exception_print (gdb_stderr, ex); /* If we threw an exception, it's because we recognized the character. */ return 0; } } we really must not let a C++ exception propagate out to readline. It will kill gdb in configurations/architectures that don't default to -fasynchronous-unwind-tables. As the comment says, this try/catch here is really just in case, I don't think it is reachable. But if we want to make it right for quits too, just in case, then I think we instead need to swallow the exception, and call set_quit_flag() / set sync_quit_force_run. I'll continue auditing, and may come back to the same patches...