From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20762 invoked by alias); 9 Oct 2015 17:26:54 -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 20701 invoked by uid 89); 9 Oct 2015 17:26:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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; Fri, 09 Oct 2015 17:26:52 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id 97B5C91E9D; Fri, 9 Oct 2015 17:26:51 +0000 (UTC) Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t99HQo7L011464; Fri, 9 Oct 2015 13:26:50 -0400 Message-ID: <5617F8D9.4080908@redhat.com> Date: Fri, 09 Oct 2015 17:26:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] Fix execution_direction's type References: <1444404887-10192-1-git-send-email-palves@redhat.com> <5617F611.4060301@ericsson.com> In-Reply-To: <5617F611.4060301@ericsson.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2015-10/txt/msg00106.txt.bz2 On 10/09/2015 06:14 PM, Simon Marchi wrote: > On 15-10-09 11:34 AM, Pedro Alves wrote: >> @@ -3817,6 +3828,7 @@ fetch_inferior_event (void *client_data) >> struct cleanup *old_chain = make_cleanup (null_cleanup, NULL); >> struct cleanup *ts_old_chain; >> int was_sync = sync_execution; >> + enum exec_direction_kind save_exec_dir = execution_direction; >> int cmd_done = 0; >> ptid_t waiton_ptid = minus_one_ptid; >> >> @@ -3849,7 +3861,7 @@ fetch_inferior_event (void *client_data) >> event. */ >> target_dcache_invalidate (); >> >> - make_cleanup_restore_integer (&execution_direction); >> + make_cleanup (restore_execution_direction, &save_exec_dir); >> execution_direction = target_execution_direction (); >> >> ecs->ptid = do_target_wait (waiton_ptid, &ecs->ws, > > Isn't it dangerous to record a cleanup with a pointer to a local variable? > > What if something throws the exception is caught in a parent frame? The > content of the memory location pointed by the cleanup will be undefined > at that time, won't it? No, the cleanups are run _before_ the throwing scope is left (that is, before longjmp), from within throw_exception. Thanks, Pedro Alves