From 8b92e4d54f80aae37af6b0b2a23e114ae4b5d29d Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Sat, 7 Feb 2004 18:29:54 +0000 Subject: 2004-02-07 Elena Zannoni * dbxread.c (dbx_symfile_init, start_psymtab, end_psymtab, coffstab_build_psymtabs, elfstab_build_psymtabs) (stabsect_build_psymtabs): Replace psymbol_obstack with objfile_obstack. * dwarf2-frame.c (decode_frame_entry_1): Ditto. * dwarf2read.c (dwarf2_build_psymtabs_hard, dwarf2_read_section): Ditto. * dwarfread.c (scan_compilation_units): Ditto. * elfread.c (elfstab_offset_sections): Ditto. * hppa-tdep.c (read_unwind_info): Ditto. * hpread.c (hpread_build_psymtabs, hpread_start_psymtab) (hpread_end_psymtab): Ditto. * mdebugread.c (mdebug_build_psymtabs, add_pending) (parse_partial_symbols, new_psymtab, elfmdebug_build_psymtabs): Ditto. * mips-tdep.c (non_heuristic_proc_desc): Ditto. * objfiles.c (add_to_objfile_sections) (build_objfile_section_table): Ditto. (allocate_objfile): Remove init of psymbol_obstack. (free_objfile): Remove freeing of psymbol_obstack. * objfiles.h (struct objfile): Remove field psymbol_obstack. Update comments. * pa64solib.c (pa64_solib_add_solib_objfile): Replace psymbol_obstack with objfile_obstack. * solib-sunos.c (allocate_rt_common_objfile): Remove init of psymbol_obstack. * somread.c (som_symfile_offsets, init_import_symbols) (init_export_symbols): Replace psymbol_obstack with objfile_obstack. * somsolib.c (som_solib_add_solib_objfile): Ditto. * symfile.c (default_symfile_offsets, syms_from_objfile) (reread_symbols): Remove freeing and init of psymbol_obstack. (cashier_psymtab): Update comment. * symmisc.c (print_objfile_statistics): Don't report stats for psymbol obstack. * symtab.h (struct general_symbol_info, struct partial_symtab): Update comments. * xcoffread.c (xcoff_start_psymtab, xcoff_end_psymtab, swap_sym) (xcoff_symfile_offsets): Replace psymbol_obstack with objfile_obstack. --- gdb/objfiles.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'gdb/objfiles.c') diff --git a/gdb/objfiles.c b/gdb/objfiles.c index dd18e73..6102091 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -93,7 +93,7 @@ add_to_objfile_sections (struct bfd *abfd, struct bfd_section *asect, section.ovly_mapped = 0; section.addr = bfd_section_vma (abfd, asect); section.endaddr = section.addr + bfd_section_size (abfd, asect); - obstack_grow (&objfile->psymbol_obstack, (char *) §ion, sizeof (section)); + obstack_grow (&objfile->objfile_obstack, (char *) §ion, sizeof (section)); objfile->sections_end = (struct obj_section *) (((unsigned long) objfile->sections_end) + 1); } @@ -119,13 +119,13 @@ build_objfile_section_table (struct objfile *objfile) /* objfile->sections can be already set when reading a mapped symbol file. I believe that we do need to rebuild the section table in this case (we rebuild other things derived from the bfd), but we - can't free the old one (it's in the psymbol_obstack). So we just + can't free the old one (it's in the objfile_obstack). So we just waste some memory. */ objfile->sections_end = 0; bfd_map_over_sections (objfile->obfd, add_to_objfile_sections, (char *) objfile); objfile->sections = (struct obj_section *) - obstack_finish (&objfile->psymbol_obstack); + obstack_finish (&objfile->objfile_obstack); objfile->sections_end = objfile->sections + (unsigned long) objfile->sections_end; return (0); } @@ -165,12 +165,10 @@ allocate_objfile (bfd *abfd, int flags) objfile->md = NULL; objfile->psymbol_cache = bcache_xmalloc (); objfile->macro_cache = bcache_xmalloc (); - obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0, xmalloc, + obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, - xfree); terminate_minimal_symbol_table (objfile); } @@ -342,7 +340,7 @@ unlink_objfile (struct objfile *objfile) /* Destroy an objfile and all the symtabs and psymtabs under it. Note that as much as possible is allocated on the symbol_obstack and - psymbol_obstack, so that the memory can be efficiently freed. + objfile_obstack, so that the memory can be efficiently freed. Things which we do NOT free because they are not in malloc'd memory or not in memory specific to the objfile include: @@ -431,9 +429,9 @@ free_objfile (struct objfile *objfile) bcache_xfree (objfile->macro_cache); if (objfile->demangled_names_hash) htab_delete (objfile->demangled_names_hash); - obstack_free (&objfile->psymbol_obstack, 0); - obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->objfile_obstack, 0); + obstack_free (&objfile->symbol_obstack, 0); + xmfree (objfile->md, objfile); objfile = NULL; } -- cgit v1.1