From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2400 invoked by alias); 5 Jan 2004 21:18:55 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 2393 invoked from network); 5 Jan 2004 21:18:54 -0000 Received: from unknown (HELO touchme.toronto.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 5 Jan 2004 21:18:54 -0000 Received: from redhat.com (toocool.toronto.redhat.com [172.16.14.72]) by touchme.toronto.redhat.com (Postfix) with ESMTP id 5C13E8001BD; Mon, 5 Jan 2004 16:18:54 -0500 (EST) Message-ID: <3FF9D4BE.2010202@redhat.com> Date: Mon, 05 Jan 2004 21:18:00 -0000 From: "J. Johnston" Organization: Red Hat Inc. User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 MIME-Version: 1.0 To: Daniel Jacobowitz Cc: Andrew Cagney , gdb-patches@sources.redhat.com Subject: Re: [RFA]: Fix do_cleanups if oldchain is NULL References: <3FE0C502.7020408@redhat.com> <3FF59719.7020908@gnu.org> <3FF9B429.6080501@redhat.com> <20040105190638.GA29179@nevyn.them.org> In-Reply-To: <20040105190638.GA29179@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-01/txt/msg00110.txt.bz2 Daniel Jacobowitz wrote: > On Mon, Jan 05, 2004 at 01:59:53PM -0500, J. Johnston wrote: > >> >>Andrew Cagney wrote: >> >>>>I recently solved a bug on the ia64 concerning cleanups. What was >>>>happening was that a cleanup list was being re-initialized to NULL >>>>inside a loop and later do_cleanups() was called. This caused the >>>>entire cleanup list to be run because the design is to run the list >>>>until the passed in cleanup is reached. This caused other errors when >>>>the stream being used was deleted, etc... >>>> >>>>This patch adds a check to do_my_cleanups() so no cleanups will be >>>>performed if the passed in chain is NULL. >>>> >>>>Ok to commit? >>> >>> >>>(hmm, no one thought to review this while I was on hols :-() >>>I think the bug is in the calling code, and not utils.c. That patch >>>unfortunatly makes a fundamental change to the core of the cleanup code >>>and there's no easy way of demonstrating that other callers aren't >>>assuming that NULL implies do all cleanups. >>> >>>Andrew >>> >> >>Perhaps, but there is no way to properly initialize a cleanup to avoid >>compiler warnings. > > > Sure there is: > struct cleanup *old_chain = make_cleanup (null_cleanup, 0); > Ok, that suits me fine. > >>If you set it to NULL which is the obvious choice, this >>currently means run all cleanups. IMHO, this is the wrong choice for the >>default. I found no cases where NULL was passed in directly. Do you see a >>case where a gdb routine has the right to run all previous cleanups except >>in an exit scenario? > > > This function is not just used for do_cleanups, but also for > do_run_cleanups et cetera. > I just saw the note regarding do_run_cleanup (NULL). My fault for not looking ahead in my mass of e-mails :(. I didn't check for that scenario. I no longer have any issue. -- Jeff J.