2004-02-07 Elena Zannoni <ezannoni@redhat.com>

* 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.
This commit is contained in:
Elena Zannoni 2004-02-07 18:29:54 +00:00
parent 22940a245d
commit 8b92e4d54f
20 changed files with 126 additions and 94 deletions

View File

@ -18,6 +18,49 @@
* tui/tui-stack.c, tui/tui-win.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-winsource.c: Ditto.
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* 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.
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.

View File

@ -651,14 +651,13 @@ dbx_symfile_init (struct objfile *objfile)
DBX_SYMCOUNT (objfile) = bfd_get_symcount (sym_bfd);
DBX_SYMTAB_OFFSET (objfile) = SYMBOL_TABLE_OFFSET;
/* Read the string table and stash it away in the psymbol_obstack. It is
only needed as long as we need to expand psymbols into full symbols,
so when we blow away the psymbol the string table goes away as well.
/* Read the string table and stash it away in the objfile_obstack.
When we blow away the objfile the string table goes away as well.
Note that gdb used to use the results of attempting to malloc the
string table, based on the size it read, as a form of sanity check
for botched byte swapping, on the theory that a byte swapped string
table size would be so totally bogus that the malloc would fail. Now
that we put in on the psymbol_obstack, we can't do this since gdb gets
that we put in on the objfile_obstack, we can't do this since gdb gets
a fatal error (out of virtual memory) if the size is bogus. We can
however at least check to see if the size is less than the size of
the size field itself, or larger than the size of the entire file.
@ -710,7 +709,7 @@ dbx_symfile_init (struct objfile *objfile)
DBX_STRINGTAB_SIZE (objfile));
DBX_STRINGTAB (objfile) =
(char *) obstack_alloc (&objfile->psymbol_obstack,
(char *) obstack_alloc (&objfile->objfile_obstack,
DBX_STRINGTAB_SIZE (objfile));
OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile));
@ -2147,7 +2146,7 @@ start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
filename, textlow, global_syms, static_syms);
result->read_symtab_private = (char *)
obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc));
LDSYMOFF (result) = ldsymoff;
result->read_symtab = dbx_psymtab_to_symtab;
SYMBOL_SIZE (result) = symbol_size;
@ -2269,7 +2268,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
if (number_dependencies)
{
pst->dependencies = (struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
number_dependencies * sizeof (struct partial_symtab *));
memcpy (pst->dependencies, dependency_list,
number_dependencies * sizeof (struct partial_symtab *));
@ -2285,7 +2284,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
/* Copy the sesction_offsets array from the main psymtab. */
subpst->section_offsets = pst->section_offsets;
subpst->read_symtab_private =
(char *) obstack_alloc (&objfile->psymbol_obstack,
(char *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
LDSYMOFF (subpst) =
LDSYMLEN (subpst) =
@ -2295,7 +2294,7 @@ end_psymtab (struct partial_symtab *pst, char **include_list, int num_includes,
/* We could save slight bits of space by only making one of these,
shared by the entire set of include files. FIXME-someday. */
subpst->dependencies = (struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct partial_symtab *));
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
@ -3344,7 +3343,7 @@ coffstab_build_psymtabs (struct objfile *objfile, int mainline,
if (stabstrsize > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, stabstrsize + 1);
obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
/* Now read in the string table in one big gulp. */
@ -3442,7 +3441,7 @@ elfstab_build_psymtabs (struct objfile *objfile, int mainline,
if (stabstrsize > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", stabstrsize);
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, stabstrsize + 1);
obstack_alloc (&objfile->objfile_obstack, stabstrsize + 1);
OBJSTAT (objfile, sz_strtab += stabstrsize + 1);
/* Now read in the string table in one big gulp. */
@ -3536,7 +3535,7 @@ stabsect_build_psymtabs (struct objfile *objfile, int mainline, char *stab_name,
if (DBX_STRINGTAB_SIZE (objfile) > bfd_get_size (sym_bfd))
error ("ridiculous string table size: %d bytes", DBX_STRINGTAB_SIZE (objfile));
DBX_STRINGTAB (objfile) = (char *)
obstack_alloc (&objfile->psymbol_obstack, DBX_STRINGTAB_SIZE (objfile) + 1);
obstack_alloc (&objfile->objfile_obstack, DBX_STRINGTAB_SIZE (objfile) + 1);
OBJSTAT (objfile, sz_strtab += DBX_STRINGTAB_SIZE (objfile) + 1);
/* Now read in the string table in one big gulp. */

View File

@ -1211,7 +1211,7 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p)
return end;
cie = (struct dwarf2_cie *)
obstack_alloc (&unit->objfile->psymbol_obstack,
obstack_alloc (&unit->objfile->objfile_obstack,
sizeof (struct dwarf2_cie));
cie->initial_instructions = NULL;
cie->cie_pointer = cie_pointer;
@ -1327,7 +1327,7 @@ decode_frame_entry_1 (struct comp_unit *unit, char *start, int eh_frame_p)
return NULL;
fde = (struct dwarf2_fde *)
obstack_alloc (&unit->objfile->psymbol_obstack,
obstack_alloc (&unit->objfile->objfile_obstack,
sizeof (struct dwarf2_fde));
fde->cie = find_cie (unit, cie_pointer);
if (fde->cie == NULL)

View File

@ -446,7 +446,7 @@ static int isreg; /* Object lives in register.
/* We put a pointer to this structure in the read_symtab_private field
of the psymtab.
The complete dwarf information for an objfile is kept in the
psymbol_obstack, so that absolute die references can be handled.
objfile_obstack, so that absolute die references can be handled.
Most of the information in this structure is related to an entire
object file and could be passed via the sym_private field of the objfile.
It is however conceivable that dwarf2 might not be the only type
@ -1256,7 +1256,7 @@ dwarf2_build_psymtabs_hard (struct objfile *objfile, int mainline)
objfile->static_psymbols.next);
pst->read_symtab_private = (char *)
obstack_alloc (&objfile->psymbol_obstack, sizeof (struct dwarf2_pinfo));
obstack_alloc (&objfile->objfile_obstack, sizeof (struct dwarf2_pinfo));
DWARF_INFO_BUFFER (pst) = dwarf_info_buffer;
DWARF_INFO_OFFSET (pst) = beg_of_comp_unit - dwarf_info_buffer;
DWARF_ABBREV_BUFFER (pst) = dwarf_abbrev_buffer;
@ -4132,7 +4132,7 @@ make_cleanup_free_die_list (struct die_info *dies)
/* Read the contents of the section at OFFSET and of size SIZE from the
object file specified by OBJFILE into the psymbol_obstack and return it. */
object file specified by OBJFILE into the objfile_obstack and return it. */
char *
dwarf2_read_section (struct objfile *objfile, asection *sectp)
@ -4144,7 +4144,7 @@ dwarf2_read_section (struct objfile *objfile, asection *sectp)
if (size == 0)
return NULL;
buf = (char *) obstack_alloc (&objfile->psymbol_obstack, size);
buf = (char *) obstack_alloc (&objfile->objfile_obstack, size);
retbuf
= (char *) symfile_relocate_debug_section (abfd, sectp, (bfd_byte *) buf);
if (retbuf != NULL)

View File

@ -2800,7 +2800,7 @@ scan_compilation_units (char *thisdie, char *enddie, file_ptr dbfoff,
pst->texthigh = di.at_high_pc;
pst->read_symtab_private = (char *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct dwfinfo));
DBFOFF (pst) = dbfoff;
DBROFF (pst) = curoff;

View File

@ -1,7 +1,7 @@
/* Read ELF (Executable and Linking Format) object files for GDB.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003 Free Software Foundation, Inc.
2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
@ -712,7 +712,7 @@ elfstab_offset_sections (struct objfile *objfile, struct partial_symtab *pst)
/* Found it! Allocate a new psymtab struct, and fill it in. */
maybe->found++;
pst->section_offsets = (struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
for (i = 0; i < maybe->num_sections; i++)
(pst->section_offsets)->offsets[i] = maybe->sections[i];

View File

@ -510,7 +510,7 @@ read_unwind_info (struct objfile *objfile)
obj_private_data_t *obj_private;
text_offset = ANOFFSET (objfile->section_offsets, 0);
ui = (struct obj_unwind_info *) obstack_alloc (&objfile->psymbol_obstack,
ui = (struct obj_unwind_info *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct obj_unwind_info));
ui->table = NULL;
@ -560,7 +560,7 @@ read_unwind_info (struct objfile *objfile)
/* Allocate memory for the unwind table. */
ui->table = (struct unwind_table_entry *)
obstack_alloc (&objfile->psymbol_obstack, total_size);
obstack_alloc (&objfile->objfile_obstack, total_size);
ui->last = total_entries - 1;
/* Now read in each unwind section and internalize the standard unwind
@ -623,7 +623,7 @@ read_unwind_info (struct objfile *objfile)
if (objfile->obj_private == NULL)
{
obj_private = (obj_private_data_t *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (obj_private_data_t));
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;

View File

@ -1973,7 +1973,7 @@ hpread_build_psymtabs (struct objfile *objfile, int mainline)
if (!have_name)
{
pst->filename = (char *)
obstack_alloc (&pst->objfile->psymbol_obstack,
obstack_alloc (&pst->objfile->objfile_obstack,
strlen (namestring) + 1);
strcpy (pst->filename, namestring);
have_name = 1;
@ -2392,7 +2392,7 @@ hpread_start_psymtab (struct objfile *objfile, char *filename,
result->textlow += offset;
result->read_symtab_private = (char *)
obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc));
LDSYMOFF (result) = ldsymoff;
result->read_symtab = hpread_psymtab_to_symtab;
@ -2453,7 +2453,7 @@ hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
if (number_dependencies)
{
pst->dependencies = (struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
number_dependencies * sizeof (struct partial_symtab *));
memcpy (pst->dependencies, dependency_list,
number_dependencies * sizeof (struct partial_symtab *));
@ -2468,7 +2468,7 @@ hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
subpst->section_offsets = pst->section_offsets;
subpst->read_symtab_private =
(char *) obstack_alloc (&objfile->psymbol_obstack,
(char *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
LDSYMOFF (subpst) =
LDSYMLEN (subpst) =
@ -2478,7 +2478,7 @@ hpread_end_psymtab (struct partial_symtab *pst, char **include_list,
/* We could save slight bits of space by only making one of these,
shared by the entire set of include files. FIXME-someday. */
subpst->dependencies = (struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct partial_symtab *));
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;

View File

@ -428,7 +428,7 @@ mdebug_build_psymtabs (struct objfile *objfile,
char *fdr_end;
FDR *fdr_ptr;
info->fdr = (FDR *) obstack_alloc (&objfile->psymbol_obstack,
info->fdr = (FDR *) obstack_alloc (&objfile->objfile_obstack,
(info->symbolic_header.ifdMax
* sizeof (FDR)));
fdr_src = info->external_fdr;
@ -581,7 +581,7 @@ add_pending (FDR *fh, char *sh, struct type *t)
if (!p)
{
p = ((struct mdebug_pending *)
obstack_alloc (&current_objfile->psymbol_obstack,
obstack_alloc (&current_objfile->objfile_obstack,
sizeof (struct mdebug_pending)));
p->s = sh;
p->t = t;
@ -2262,7 +2262,7 @@ parse_partial_symbols (struct objfile *objfile)
&& (bfd_get_section_flags (cur_bfd, text_sect) & SEC_RELOC))
relocatable = 1;
extern_tab = (EXTR *) obstack_alloc (&objfile->psymbol_obstack,
extern_tab = (EXTR *) obstack_alloc (&objfile->objfile_obstack,
sizeof (EXTR) * hdr->iextMax);
includes_allocated = 30;
@ -2306,7 +2306,7 @@ parse_partial_symbols (struct objfile *objfile)
/* Allocate the global pending list. */
pending_list =
((struct mdebug_pending **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
hdr->ifdMax * sizeof (struct mdebug_pending *)));
memset (pending_list, 0,
hdr->ifdMax * sizeof (struct mdebug_pending *));
@ -2558,7 +2558,7 @@ parse_partial_symbols (struct objfile *objfile)
objfile->global_psymbols.next,
objfile->static_psymbols.next);
pst->read_symtab_private = ((char *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc)));
memset (pst->read_symtab_private, 0, sizeof (struct symloc));
@ -3661,7 +3661,7 @@ parse_partial_symbols (struct objfile *objfile)
pst->number_of_dependencies = 0;
pst->dependencies =
((struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
((fh->crfd - 1)
* sizeof (struct partial_symtab *))));
for (s_idx = 1; s_idx < fh->crfd; s_idx++)
@ -4609,7 +4609,7 @@ new_psymtab (char *name, struct objfile *objfile)
/* Keep a backpointer to the file's symbols */
psymtab->read_symtab_private = ((char *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc)));
memset (psymtab->read_symtab_private, 0, sizeof (struct symloc));
CUR_BFD (psymtab) = cur_bfd;
@ -4740,7 +4740,7 @@ elfmdebug_build_psymtabs (struct objfile *objfile,
back_to = make_cleanup_discard_minimal_symbols ();
info = ((struct ecoff_debug_info *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct ecoff_debug_info)));
if (!(*swap->read_debug_info) (abfd, sec, info))

View File

@ -2286,7 +2286,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
This means that we should not bother with this method on 64-bit
targets (until that is fixed). */
priv = obstack_alloc (&sec->objfile->psymbol_obstack,
priv = obstack_alloc (&sec->objfile->objfile_obstack,
sizeof (struct mips_objfile_private));
priv->size = 0;
sec->objfile->obj_private = priv;
@ -2295,14 +2295,14 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
{
asection *bfdsec;
priv = obstack_alloc (&sec->objfile->psymbol_obstack,
priv = obstack_alloc (&sec->objfile->objfile_obstack,
sizeof (struct mips_objfile_private));
bfdsec = bfd_get_section_by_name (sec->objfile->obfd, ".pdr");
if (bfdsec != NULL)
{
priv->size = bfd_section_size (sec->objfile->obfd, bfdsec);
priv->contents = obstack_alloc (&sec->objfile->psymbol_obstack,
priv->contents = obstack_alloc (&sec->objfile->objfile_obstack,
priv->size);
bfd_get_section_contents (sec->objfile->obfd, bfdsec,
priv->contents, 0, priv->size);
@ -2354,7 +2354,7 @@ non_heuristic_proc_desc (CORE_ADDR pc, CORE_ADDR *addrptr)
/* Fill in what we need of the proc_desc. */
proc_desc = (mips_extra_func_info_t)
obstack_alloc (&sec->objfile->psymbol_obstack,
obstack_alloc (&sec->objfile->objfile_obstack,
sizeof (struct mips_extra_func_info));
PROC_LOW_ADDR (proc_desc) = startaddr;

View File

@ -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 *) &section, sizeof (section));
obstack_grow (&objfile->objfile_obstack, (char *) &section, 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;
}

View File

@ -294,8 +294,6 @@ struct objfile
/* Obstacks to hold objects that should be freed when we load a new symbol
table from this object file. */
struct obstack psymbol_obstack; /* Partial symbols */
struct obstack symbol_obstack; /* Full symbols */
/* A byte cache where we can stash arbitrary "chunks" of bytes that
@ -312,7 +310,7 @@ struct objfile
struct htab *demangled_names_hash;
/* Vectors of all partial symbols read in from file. The actual data
is stored in the psymbol_obstack. */
is stored in the objfile_obstack. */
struct psymbol_allocation_list global_psymbols;
struct psymbol_allocation_list static_psymbols;
@ -402,7 +400,7 @@ struct objfile
unsigned num_data;
/* Set of relocation offsets to apply to each section.
Currently on the psymbol_obstack (which makes no sense, but I'm
Currently on the objfile_obstack (which makes no sense, but I'm
not sure it's harming anything).
These offsets indicate that all symbols (including partial and
@ -430,7 +428,7 @@ struct objfile
SECTIONS points to the first entry in the table, and
SECTIONS_END points to the first location past the last entry
in the table. Currently the table is stored on the
psymbol_obstack (which makes no sense, but I'm not sure it's
objfile_obstack (which makes no sense, but I'm not sure it's
harming anything). */
struct obj_section

View File

@ -1,6 +1,6 @@
/* Handle HP ELF shared libraries for GDB, the GNU Debugger.
Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
Inc.
This file is part of GDB.
@ -281,7 +281,7 @@ pa64_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
if (so->objfile->obj_private == NULL)
{
obj_private = (obj_private_data_t *)
obstack_alloc (&so->objfile->psymbol_obstack,
obstack_alloc (&so->objfile->objfile_obstack,
sizeof (obj_private_data_t));
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;

View File

@ -145,12 +145,11 @@ allocate_rt_common_objfile (void)
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);
objfile->name = mstrsave (objfile->md, "rt_common");
/* Add this file onto the tail of the linked list of other such files. */

View File

@ -1,6 +1,6 @@
/* Read HP PA/Risc object files for GDB.
Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
Copyright 1991, 1992, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
2004 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support.
This file is part of GDB.
@ -432,7 +432,7 @@ som_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
objfile->num_sections = bfd_count_sections (objfile->obfd);
objfile->section_offsets = (struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
/* FIXME: ezannoni 2000-04-20 The section names in SOM are not
@ -534,7 +534,7 @@ init_import_symbols (struct objfile *objfile)
to do with psymbols, just a matter of convenience. We want the
import list to be freed when the objfile is deallocated */
objfile->import_list
= (ImportEntry *) obstack_alloc (&objfile->psymbol_obstack,
= (ImportEntry *) obstack_alloc (&objfile->objfile_obstack,
import_list_size * sizeof (ImportEntry));
/* Read in the import entries, a bunch at a time */
@ -550,7 +550,7 @@ init_import_symbols (struct objfile *objfile)
if (buffer[i].type != (unsigned char) 0)
{
objfile->import_list[k]
= (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1);
= (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1);
strcpy (objfile->import_list[k], string_buffer + buffer[i].name);
/* Some day we might want to record the type and other information too */
}
@ -570,7 +570,7 @@ init_import_symbols (struct objfile *objfile)
if (buffer[i].type != (unsigned char) 0)
{
objfile->import_list[k]
= (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1);
= (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1);
strcpy (objfile->import_list[k], string_buffer + buffer[i].name);
/* Some day we might want to record the type and other information too */
}
@ -657,7 +657,7 @@ init_export_symbols (struct objfile *objfile)
to do with psymbols, just a matter of convenience. We want the
export list to be freed when the objfile is deallocated */
objfile->export_list
= (ExportEntry *) obstack_alloc (&objfile->psymbol_obstack,
= (ExportEntry *) obstack_alloc (&objfile->objfile_obstack,
export_list_size * sizeof (ExportEntry));
/* Read in the export entries, a bunch at a time */
@ -673,7 +673,7 @@ init_export_symbols (struct objfile *objfile)
if (buffer[i].type != (unsigned char) 0)
{
objfile->export_list[k].name
= (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1);
= (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1);
strcpy (objfile->export_list[k].name, string_buffer + buffer[i].name);
objfile->export_list[k].address = buffer[i].value;
/* Some day we might want to record the type and other information too */
@ -697,7 +697,7 @@ init_export_symbols (struct objfile *objfile)
if (buffer[i].type != (unsigned char) 0)
{
objfile->export_list[k].name
= (char *) obstack_alloc (&objfile->psymbol_obstack, strlen (string_buffer + buffer[i].name) + 1);
= (char *) obstack_alloc (&objfile->objfile_obstack, strlen (string_buffer + buffer[i].name) + 1);
strcpy (objfile->export_list[k].name, string_buffer + buffer[i].name);
/* Some day we might want to record the type and other information too */
objfile->export_list[k].address = buffer[i].value;

View File

@ -1,7 +1,7 @@
/* Handle HP SOM shared libraries for GDB, the GNU Debugger.
Copyright 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002,
2003 Free Software Foundation, Inc.
2003, 2004 Free Software Foundation, Inc.
This file is part of GDB.
@ -310,7 +310,7 @@ som_solib_add_solib_objfile (struct so_list *so, char *name, int from_tty,
if (so->objfile->obj_private == NULL)
{
obj_private = (obj_private_data_t *)
obstack_alloc (&so->objfile->psymbol_obstack,
obstack_alloc (&so->objfile->objfile_obstack,
sizeof (obj_private_data_t));
obj_private->unwind_info = NULL;
obj_private->so_info = NULL;

View File

@ -485,7 +485,7 @@ default_symfile_offsets (struct objfile *objfile,
objfile->num_sections = bfd_count_sections (objfile->obfd);
objfile->section_offsets = (struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
memset (objfile->section_offsets, 0,
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
@ -690,7 +690,7 @@ syms_from_objfile (struct objfile *objfile,
objfile->num_sections = num_offsets;
objfile->section_offsets
= ((struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack, size));
obstack_alloc (&objfile->objfile_obstack, size));
memcpy (objfile->section_offsets, offsets, size);
init_objfile_sect_indices (objfile);
@ -1879,7 +1879,7 @@ reread_symbols (void)
bfd_errmsg (bfd_get_error ()));
/* Save the offsets, we will nuke them with the rest of the
psymbol_obstack. */
objfile_obstack. */
num_offsets = objfile->num_sections;
offsets = ((struct section_offsets *)
alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets)));
@ -1911,9 +1911,8 @@ reread_symbols (void)
htab_delete (objfile->demangled_names_hash);
objfile->demangled_names_hash = NULL;
}
obstack_free (&objfile->psymbol_obstack, 0);
obstack_free (&objfile->symbol_obstack, 0);
obstack_free (&objfile->objfile_obstack, 0);
obstack_free (&objfile->symbol_obstack, 0);
objfile->sections = NULL;
objfile->symtabs = NULL;
objfile->psymtabs = NULL;
@ -1939,12 +1938,10 @@ reread_symbols (void)
it is empty. */
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
obstack_specify_allocation (&objfile->psymbol_obstack, 0, 0,
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);
if (build_objfile_section_table (objfile))
{
error ("Can't find the file sections in `%s': %s",
@ -1955,7 +1952,7 @@ reread_symbols (void)
/* We use the same section offsets as from last time. I'm not
sure whether that is always correct for shared libraries. */
objfile->section_offsets = (struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
SIZEOF_N_SECTION_OFFSETS (num_offsets));
memcpy (objfile->section_offsets, offsets,
SIZEOF_N_SECTION_OFFSETS (num_offsets));
@ -2279,12 +2276,12 @@ allocate_psymtab (char *filename, struct objfile *objfile)
}
else
psymtab = (struct partial_symtab *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct partial_symtab));
memset (psymtab, 0, sizeof (struct partial_symtab));
psymtab->filename = obsavestring (filename, strlen (filename),
&objfile->psymbol_obstack);
&objfile->objfile_obstack);
psymtab->symtab = NULL;
/* Prepend it to the psymtab list for the objfile it belongs to.
@ -2433,7 +2430,7 @@ cashier_psymtab (struct partial_symtab *pst)
partial_symbol lists (global_psymbols/static_psymbols) that
this psymtab points to. These just take up space until all
the psymtabs are reclaimed. Ditto the dependencies list and
filename, which are all in the psymbol_obstack. */
filename, which are all in the objfile_obstack. */
/* We need to cashier any psymtab that has this one as a dependency... */
again:

View File

@ -230,8 +230,6 @@ print_objfile_statistics (void)
if (OBJSTAT (objfile, sz_strtab) > 0)
printf_filtered (" Space used by a.out string tables: %d\n",
OBJSTAT (objfile, sz_strtab));
printf_filtered (" Total memory used for psymbol obstack: %d\n",
obstack_memory_used (&objfile->psymbol_obstack));
printf_filtered (" Total memory used for psymbol cache: %d\n",
bcache_memory_used (objfile->psymbol_cache));
printf_filtered (" Total memory used for macro cache: %d\n",

View File

@ -88,7 +88,7 @@ struct agent_expr;
struct general_symbol_info
{
/* Name of the symbol. This is a required field. Storage for the
name is allocated on the psymbol_obstack or symbol_obstack for
name is allocated on the objfile_obstack or symbol_obstack for
the associated objfile. For languages like C++ that make a
distinction between the mangled name and demangled name, this is
the mangled name. */
@ -858,7 +858,7 @@ struct symtab
Even after the source file has been read into a symtab, the
partial_symtab remains around. They are allocated on an obstack,
psymbol_obstack. FIXME, this is bad for dynamic linking or VxWorks-
objfile_obstack. FIXME, this is bad for dynamic linking or VxWorks-
style execution of a bunch of .o's. */
struct partial_symtab

View File

@ -1,6 +1,6 @@
/* Read AIX xcoff symbol tables and convert to internal format, for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
Free Software Foundation, Inc.
Derived from coffread.c, dbxread.c, and a lot of hacking.
Contributed by IBM Corporation.
@ -1946,7 +1946,7 @@ xcoff_start_psymtab (struct objfile *objfile, char *filename, int first_symnum,
global_syms, static_syms);
result->read_symtab_private = (char *)
obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symloc));
((struct symloc *) result->read_symtab_private)->first_symnum = first_symnum;
result->read_symtab = xcoff_psymtab_to_symtab;
@ -1993,7 +1993,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list,
if (number_dependencies)
{
pst->dependencies = (struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
number_dependencies * sizeof (struct partial_symtab *));
memcpy (pst->dependencies, dependency_list,
number_dependencies * sizeof (struct partial_symtab *));
@ -2008,7 +2008,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list,
subpst->section_offsets = pst->section_offsets;
subpst->read_symtab_private =
(char *) obstack_alloc (&objfile->psymbol_obstack,
(char *) obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
((struct symloc *) subpst->read_symtab_private)->first_symnum = 0;
((struct symloc *) subpst->read_symtab_private)->numsyms = 0;
@ -2018,7 +2018,7 @@ xcoff_end_psymtab (struct partial_symtab *pst, char **include_list,
/* We could save slight bits of space by only making one of these,
shared by the entire set of include files. FIXME-someday. */
subpst->dependencies = (struct partial_symtab **)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
sizeof (struct partial_symtab *));
subpst->dependencies[0] = pst;
subpst->number_of_dependencies = 1;
@ -2081,7 +2081,7 @@ swap_sym (struct internal_syment *symbol, union internal_auxent *aux,
/* FIXME: wastes memory for symbols which we don't end up putting
into the minimal symbols. */
char *p;
p = obstack_alloc (&objfile->psymbol_obstack, E_SYMNMLEN + 1);
p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1);
strncpy (p, symbol->n_name, E_SYMNMLEN);
p[E_SYMNMLEN] = '\0';
*name = p;
@ -2959,7 +2959,7 @@ xcoff_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
objfile->num_sections = bfd_count_sections (objfile->obfd);
objfile->section_offsets = (struct section_offsets *)
obstack_alloc (&objfile->psymbol_obstack,
obstack_alloc (&objfile->objfile_obstack,
SIZEOF_N_SECTION_OFFSETS (objfile->num_sections));
/* Initialize the section indexes for future use. */