This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: RFC/WIP: Delete SET_TOP_LEVEL ....
- To: ac131313 at cygnus dot com (Andrew Cagney)
- Subject: Re: RFC/WIP: Delete SET_TOP_LEVEL ....
- From: Todd Whitesel <toddpw at windriver dot com>
- Date: Fri, 5 Nov 1999 00:41:26 -0800 (PST)
- Cc: gdb-patches at sourceware dot cygnus dot com (GDB Patches)
> 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