This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Re: RFC/WIP: Delete SET_TOP_LEVEL ....


> 	o	have catch_errors() always
> 		call do_cleanups()

I think this is the simplest valid migration plan.

As for functions using cleanups but not calling do_cleanup before returning,
there is a least one place where this is relied upon for correct operation.

The code in coffread.c:coff_locate_sections() which reads in .stab[0-9]*
sections does something evil. It xmalloc's buffers for the section contents
and reads them in, then uses a cleanup to free them (here, one buffer, "n"):

          /* This will be run after coffstab_build_psymtabs is called
             in coff_symfile_read, at which point we no longer need
             the information.  */
          make_cleanup (free, n);

The actual consumer of these buffers is dbxread.c:fill_symbuf().

This code is of course scary because if anyone adds a make_cleanup/do_cleanups
pair between this code and last use of the memory, it will cause this fragile
algorithm to break.

-- 
Todd Whitesel
toddpw @ windriver.com

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