RFC/WIP: Delete SET_TOP_LEVEL ....
Andrew Cagney
ac131313@cygnus.com
Sat Nov 6 22:51:00 GMT 1999
Todd Whitesel wrote:
>
> > o have catch_errors() always
> > call do_cleanups()
>
> I think this is the simplest valid migration plan.
What I'll do is make it ``bug compatible'' and have the main.c specific
cases do cleanups.
> 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.
Thanks for pointing this out. I was ``rationally paranoid''.
Andrew
More information about the Gdb-patches
mailing list