From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 69310 invoked by alias); 9 Oct 2015 17:15:03 -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 68602 invoked by uid 89); 9 Oct 2015 17:15:01 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 X-HELO: usevmg20.ericsson.net Received: from usevmg20.ericsson.net (HELO usevmg20.ericsson.net) (198.24.6.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Fri, 09 Oct 2015 17:15:00 +0000 Received: from EUSAAHC001.ericsson.se (Unknown_Domain [147.117.188.75]) by usevmg20.ericsson.net (Symantec Mail Security) with SMTP id 76.41.32596.61697165; Fri, 9 Oct 2015 12:25:26 +0200 (CEST) Received: from [142.133.110.144] (147.117.188.8) by smtp-am.internal.ericsson.com (147.117.188.77) with Microsoft SMTP Server id 14.3.248.2; Fri, 9 Oct 2015 13:14:57 -0400 Subject: Re: [PATCH] Fix execution_direction's type To: Pedro Alves , References: <1444404887-10192-1-git-send-email-palves@redhat.com> From: Simon Marchi Message-ID: <5617F611.4060301@ericsson.com> Date: Fri, 09 Oct 2015 17:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1444404887-10192-1-git-send-email-palves@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg00104.txt.bz2 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?