This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA]: Fix do_cleanups if oldchain is NULL


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);

> 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.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]