From 0eb22669dc339b3d59eba3324a8c77592e0395c3 Mon Sep 17 00:00:00 2001 From: Peter Schauer Date: Tue, 27 Jul 1993 19:40:57 +0000 Subject: * breakpoint.c (breakpoint_1): Walk the breakpoint chain to decide if we have breakpoints or watchpoints as we might have to ignore internal breakpoints. Fix gdb core dumps after `file newfile' commands. * symtab.h, symfile.c (clear_symtab_users): New routine which unconditionally clears symtab users. clear_symtab_users_once commented out as it was a noop anyway. * objfiles.c (free_objfile): Don't call clear_symtab_users_once. * objfiles.c (free_all_objfiles), symfile.c (new_symfile_objfile), xcoffexec.c (exec_close): Call clear_symtab_users if necessary. * symfile.c (syms_from_objfile): Install cleanups for errors during symbol reading. * coffread.c, dbxread.c, mipsread.c, xcoffread.c (*_symfile_read): Lint cleanup code, call do_cleanups explicitly. * symfile.c (symbol_file_add): Call new_symfile_objfile and reinit_frame_cache _after_ the new symbols are read in. --- gdb/xcoffread.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'gdb/xcoffread.c') diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index a9b89c2..efa8e7d 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -185,6 +185,9 @@ static int init_lineno PARAMS ((bfd *, file_ptr, int)); static void +free_linetab PARAMS ((void)); + +static void find_linenos PARAMS ((bfd *, sec_ptr, PTR)); static void @@ -1817,6 +1820,8 @@ init_lineno (abfd, offset, size) { int val; + free_linetab (); + if (bfd_seek(abfd, offset, L_SET) < 0) return -1; @@ -1828,9 +1833,16 @@ init_lineno (abfd, offset, size) linetab_offset = offset; linetab_size = size; - make_cleanup (free, linetab); /* Be sure it gets de-allocated. */ return 0; } + +static void +free_linetab () +{ + if (linetab) + free (linetab); + linetab = NULL; +} /* dbx allows the text of a symbol name to be continued into the next symbol name! When such a continuation is encountered @@ -1996,6 +2008,7 @@ xcoff_symfile_read (objfile, section_offset, mainline) bfd *abfd; struct coff_symfile_info *info; char *name; + struct cleanup *back_to = make_cleanup (null_cleanup, 0); info = (struct coff_symfile_info *) objfile -> sym_private; symfile_bfd = abfd = objfile->obfd; @@ -2015,6 +2028,7 @@ xcoff_symfile_read (objfile, section_offset, mainline) && info->max_lineno_offset > info->min_lineno_offset) { /* only read in the line # table if one exists */ + make_cleanup (free_linetab, 0); val = init_lineno(abfd, info->min_lineno_offset, (int) (info->max_lineno_offset - info->min_lineno_offset)); @@ -2066,6 +2080,8 @@ xcoff_symfile_read (objfile, section_offset, mainline) minimal symbols for this objfile. */ install_minimal_symbols (objfile); + + do_cleanups (back_to); } /* XCOFF-specific parsing routine for section offsets. */ -- cgit v1.1