diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1993-07-27 19:40:57 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1993-07-27 19:40:57 +0000 |
commit | 0eb22669dc339b3d59eba3324a8c77592e0395c3 (patch) | |
tree | f145b3f7025ae5c96e46bf41fd5e859750fe5eb9 /gdb | |
parent | 62cd4a20676cc2df7aafe16aeca3d66c8d57c0f7 (diff) | |
download | gdb-0eb22669dc339b3d59eba3324a8c77592e0395c3.zip gdb-0eb22669dc339b3d59eba3324a8c77592e0395c3.tar.gz gdb-0eb22669dc339b3d59eba3324a8c77592e0395c3.tar.bz2 |
* 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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 20 | ||||
-rw-r--r-- | gdb/dbxread.c | 14 | ||||
-rw-r--r-- | gdb/objfiles.c | 4 | ||||
-rw-r--r-- | gdb/xcoffexec.c | 9 | ||||
-rw-r--r-- | gdb/xcoffread.c | 18 |
5 files changed, 54 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index e7bbf57..7ad66db 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,23 @@ +Tue Jul 27 12:36:49 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) + + * 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. + Tue Jul 27 01:57:01 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * mipsread.c (parse_type): Do not set tag name for compiler diff --git a/gdb/dbxread.c b/gdb/dbxread.c index cc66a15..012fac2 100644 --- a/gdb/dbxread.c +++ b/gdb/dbxread.c @@ -497,6 +497,7 @@ dbx_symfile_read (objfile, section_offsets, mainline) { bfd *sym_bfd; int val; + struct cleanup *back_to; sym_bfd = objfile->obfd; val = bfd_seek (objfile->obfd, DBX_SYMTAB_OFFSET (objfile), SEEK_SET); @@ -511,7 +512,7 @@ dbx_symfile_read (objfile, section_offsets, mainline) symbol_table_offset = DBX_SYMTAB_OFFSET (objfile); pending_blocks = 0; - make_cleanup (really_free_pendings, 0); + back_to = make_cleanup (really_free_pendings, 0); init_minimal_symbol_collection (); make_cleanup (discard_minimal_symbols, 0); @@ -533,6 +534,8 @@ dbx_symfile_read (objfile, section_offsets, mainline) printf_filtered ("(no debugging symbols found)..."); wrap_here (""); } + + do_cleanups (back_to); } /* Initialize anything that needs initializing when a completely new @@ -856,7 +859,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size) int nsl; int past_first_source_file = 0; CORE_ADDR last_o_file_start = 0; - struct cleanup *old_chain; + struct cleanup *back_to; bfd *abfd; /* End of the text segment of the executable file. */ @@ -894,11 +897,9 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size) (struct partial_symtab **) alloca (dependencies_allocated * sizeof (struct partial_symtab *)); - old_chain = make_cleanup (free_objfile, objfile); - /* Init bincl list */ init_bincl_list (20, objfile); - make_cleanup (free_bincl_list, objfile); + back_to = make_cleanup (free_bincl_list, objfile); last_source_file = NULL; @@ -984,8 +985,7 @@ read_dbx_symtab (section_offsets, objfile, text_addr, text_size) dependency_list, dependencies_used); } - free_bincl_list (objfile); - discard_cleanups (old_chain); + do_cleanups (back_to); } /* Allocate and partially fill a partial symtab. It will be diff --git a/gdb/objfiles.c b/gdb/objfiles.c index ac238ab..060409d 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -336,7 +336,6 @@ free_objfile (objfile) is unknown, but we play it safe for now and keep each action until it is shown to be no longer needed. */ - clear_symtab_users_once (); #if defined (CLEAR_SOLIB) CLEAR_SOLIB (); #endif @@ -384,7 +383,7 @@ free_objfile (objfile) } -/* Free all the object files at once. */ +/* Free all the object files at once and clean up their users. */ void free_all_objfiles () @@ -395,6 +394,7 @@ free_all_objfiles () { free_objfile (objfile); } + clear_symtab_users (); } /* Relocate OBJFILE to NEW_OFFSETS. There should be OBJFILE->NUM_SECTIONS diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c index 0e997b1..65a57b5 100644 --- a/gdb/xcoffexec.c +++ b/gdb/xcoffexec.c @@ -81,6 +81,7 @@ exec_close(quitting) { register struct vmap *vp, *nxt; struct objfile *obj; + int need_symtab_cleanup = 0; for (nxt = vmap; vp = nxt; ) { @@ -90,7 +91,10 @@ exec_close(quitting) free_objfile() will do proper cleanup of objfile *and* bfd. */ if (vp->objfile) - free_objfile (vp->objfile); + { + free_objfile (vp->objfile); + need_symtab_cleanup = 1; + } else bfd_close(vp->bfd); @@ -111,6 +115,9 @@ exec_close(quitting) exec_ops.to_sections = NULL; exec_ops.to_sections_end = NULL; } + + if (need_symtab_cleanup) + clear_symtab_users (); } /* 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. */ |