From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 77248 invoked by alias); 5 Apr 2016 19:00:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 77232 invoked by uid 89); 5 Apr 2016 19:00:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 05 Apr 2016 19:00:20 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BEDAA8E375; Tue, 5 Apr 2016 19:00:19 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u35J0IxG007271; Tue, 5 Apr 2016 15:00:18 -0400 Subject: Re: [PATCH] Eliminate -var-create error for optzd ptr to struct To: Don Breazeal , gdb-patches@sourceware.org, qiyaoltc@gmail.com References: <1459882257-7029-1-git-send-email-donb@codesourcery.com> From: Pedro Alves Message-ID: <57040B42.1040608@redhat.com> Date: Tue, 05 Apr 2016 19:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1459882257-7029-1-git-send-email-donb@codesourcery.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SW-Source: 2016-04/txt/msg00102.txt.bz2 On 04/05/2016 07:50 PM, Don Breazeal wrote: > Hi Yao, > > On 4/5/2016 5:52 AM, Yao Qi wrote: >> Don Breazeal writes: > >>> + CATCH (ex, RETURN_MASK_ERROR) >>> + { >>> + /* If we get an error, assume the value is not optimized out. */ >>> + return 0; >> >> Why don't we fall back to checking value->optimized_out below? Some >> bits/pieces of value are optimized out, but reading the rest of >> bits/piece may trigger the memory error. In this case, the value is >> optimized out too. We can do this... >> >> TRY >> { >> value_fetch_lazy (value); >> } >> CATCH (ex, RETURN_MASK_ERROR) >> { >> /* Fall back to checking value->optimized_out. */ >> } >> END_CATCH >> >> What do you think? > > Of course, that makes more sense, thanks. > >> Note that, after this patch, value_optimized_out will no longer throw >> exceptions, some TRY/CATCH in value_optimized_out's callers can be >> removed, such as gdbscm_value_optimized_out_p and >> valpy_get_is_optimized_out. This can be done in a follow-up patch. > > I've done a more thorough audit of the call sites for value_optimized_out > than I did previously, and the only places where an enclosing TRY/CATCH can > be removed are the two you name. There is one other place where it is > called inside a TRY/CATCH, but there are other functions that could throw > errors called there as well. > > I will create a follow-up patch. > > I changed this patch as you suggest above, as well as changing > RETURN_MASK_ERROR to RETURN_MASK_ALL. The TRY/CATCH blocks that are > going to be removed use RETURN_MASK_ALL, and I thought that this patch > should maintain the same level of coverage. Please don't. A RETURN_MASK_ALL swallows Ctrl-C/QUIT, and that's almost always a bug. The cases you mention translate a QUIT to a python/scheme exception, which is not the same as just swallowing the exception. Thanks, Pedro Alves