From 4a146b47d7355c3c0ef7004f35c6c9c9a88b80c0 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Sat, 7 Feb 2004 23:13:47 +0000 Subject: [PATCH] 2004-02-07 Elena Zannoni * buildsym.c (free_pending_blocks, finish_block) (record_pending_block, make_blockvector, end_symtab): Replace symbol_obstack with objfile_obstack. * coffread.c (process_coff_symbol, coff_read_struct_type) (coff_read_enum_type): Ditto. * cp-namespace.c (initialize_namespace_symtab) (check_one_possible_namespace_symbol): Ditto. * dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file) (dwarf2_symbol_mark_computed): Ditto. * dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto. * elfread.c (elf_symtab_read): Ditto. * hpread.c (hpread_symfile_init, hpread_symfile_init) (hpread_read_enum_type, hpread_read_function_type) (hpread_read_doc_function_type, hpread_process_one_debug_symbol): Ditto. * jv-lang.c (get_java_class_symtab, add_class_symbol) (java_link_class_type): Ditto. * mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab) (new_symbol): Ditto. * minsyms.c (install_minimal_symbols): Ditto. * objfiles.c (allocate_objfile): Remove init of symbol_obstack. (terminate_minimal_symbol_table): Replace symbol_obstack with objfile_obstack. (free_objfile): Remove freeing of symbol_obstack. * objfiles.h: Remove symbol_obstack field. * pa64solib.c (add_to_solist): Replace symbol_obstack with objfile_obstack. * solib-sunos.c (allocate_rt_common_objfile): Remove init of symbol_obstack. (solib_add_common_symbols): Replace symbol_obstack with objfile_obstack. * somsolib.c (som_solib_add): Ditto. * stabsread.c (patch_block_stabs, define_symbol, read_enum_type) (common_block_start, common_block_end): Ditto. * symfile.c (reread_symbols): Remove freeing and init of symbol_obstack. (allocate_symtab): Rename symbol_obstack to objfile_obstack. * symfile.h: Update comment. * symmisc.c (print_objfile_statistics): Remove symbol_obstack stats printing. * symtab.c (symbol_set_names): Replace symbol_obstack with objfile_obstack. * symtab.h (struct general_symbol_info, struct minimal_symbol): Update comments. * xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC) (init_stringtab, xcoff_initial_scan): Replace symbol_obstack with objfile_obstack. --- gdb/ChangeLog | 50 ++++++++++++++++++++++++++++++++++++++++++++++ gdb/buildsym.c | 26 ++++++++++++------------ gdb/coffread.c | 12 +++++------ gdb/cp-namespace.c | 18 ++++++++--------- gdb/dwarf2read.c | 20 +++++++++---------- gdb/dwarfread.c | 12 +++++------ gdb/elfread.c | 6 +++--- gdb/hpread.c | 28 +++++++++++++------------- gdb/jv-lang.c | 14 ++++++------- gdb/mdebugread.c | 14 ++++++------- gdb/minsyms.c | 14 ++++++------- gdb/objfiles.c | 13 ++++-------- gdb/objfiles.h | 12 +---------- gdb/pa64solib.c | 2 +- gdb/solib-sunos.c | 7 ++----- gdb/somsolib.c | 2 +- gdb/stabsread.c | 24 +++++++++++----------- gdb/symfile.c | 9 +++------ gdb/symfile.h | 4 ++-- gdb/symmisc.c | 6 ++---- gdb/symtab.c | 4 ++-- gdb/symtab.h | 21 +++++++++---------- gdb/xcoffread.c | 14 ++++++------- 23 files changed, 180 insertions(+), 152 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 73369239686..0c6b7438cd1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,53 @@ +2004-02-07 Elena Zannoni + + * buildsym.c (free_pending_blocks, finish_block) + (record_pending_block, make_blockvector, end_symtab): Replace + symbol_obstack with objfile_obstack. + * coffread.c (process_coff_symbol, coff_read_struct_type) + (coff_read_enum_type): Ditto. + * cp-namespace.c (initialize_namespace_symtab) + (check_one_possible_namespace_symbol): Ditto. + * dwarf2read.c (new_symbol, dwarf2_const_value, macro_start_file) + (dwarf2_symbol_mark_computed): Ditto. + * dwarfread.c (enum_type, new_symbol, synthesize_typedef): Ditto. + * elfread.c (elf_symtab_read): Ditto. + * hpread.c (hpread_symfile_init, hpread_symfile_init) + (hpread_read_enum_type, hpread_read_function_type) + (hpread_read_doc_function_type, hpread_process_one_debug_symbol): + Ditto. + * jv-lang.c (get_java_class_symtab, add_class_symbol) + (java_link_class_type): Ditto. + * mdebugread.c (parse_symbol, psymtab_to_symtab_1, new_symtab) + (new_symbol): Ditto. + * minsyms.c (install_minimal_symbols): Ditto. + * objfiles.c (allocate_objfile): Remove init of symbol_obstack. + (terminate_minimal_symbol_table): Replace symbol_obstack with + objfile_obstack. + (free_objfile): Remove freeing of symbol_obstack. + * objfiles.h: Remove symbol_obstack field. + * pa64solib.c (add_to_solist): Replace symbol_obstack with + objfile_obstack. + * solib-sunos.c (allocate_rt_common_objfile): Remove init of + symbol_obstack. + (solib_add_common_symbols): Replace symbol_obstack with + objfile_obstack. + * somsolib.c (som_solib_add): Ditto. + * stabsread.c (patch_block_stabs, define_symbol, read_enum_type) + (common_block_start, common_block_end): Ditto. + * symfile.c (reread_symbols): Remove freeing and init of + symbol_obstack. + (allocate_symtab): Rename symbol_obstack to objfile_obstack. + * symfile.h: Update comment. + * symmisc.c (print_objfile_statistics): Remove symbol_obstack + stats printing. + * symtab.c (symbol_set_names): Replace symbol_obstack with + objfile_obstack. + * symtab.h (struct general_symbol_info, struct minimal_symbol): + Update comments. + * xcoffread.c (read_xcoff_symtab, SYMBOL_DUP, SYMNAME_ALLOC) + (init_stringtab, xcoff_initial_scan): Replace symbol_obstack with + objfile_obstack. + 2004-02-07 Andrew Cagney * tui/tui.h: Do not include , , and diff --git a/gdb/buildsym.c b/gdb/buildsym.c index 93090ede266..4b362e08a2e 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -1,6 +1,6 @@ /* Support routines for building symbol tables in GDB's internal format. 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. This file is part of GDB. @@ -202,7 +202,7 @@ void free_pending_blocks (void) { #if 0 /* Now we make the links in the - symbol_obstack, so don't free + objfile_obstack, so don't free them. */ struct pending_block *bnext, *bnext1; @@ -230,16 +230,16 @@ finish_block (struct symbol *symbol, struct pending **listhead, struct pending_block *pblock; struct pending_block *opblock; - block = allocate_block (&objfile->symbol_obstack); + block = allocate_block (&objfile->objfile_obstack); if (symbol) { - BLOCK_DICT (block) = dict_create_linear (&objfile->symbol_obstack, + BLOCK_DICT (block) = dict_create_linear (&objfile->objfile_obstack, *listhead); } else { - BLOCK_DICT (block) = dict_create_hashed (&objfile->symbol_obstack, + BLOCK_DICT (block) = dict_create_hashed (&objfile->objfile_obstack, *listhead); } @@ -347,7 +347,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, /* If we're in the C++ case, set the block's scope. */ if (SYMBOL_LANGUAGE (symbol) == language_cplus) { - cp_set_block_scope (symbol, block, &objfile->symbol_obstack); + cp_set_block_scope (symbol, block, &objfile->objfile_obstack); } } else @@ -439,7 +439,7 @@ finish_block (struct symbol *symbol, struct pending **listhead, OPBLOCK, or at the beginning if opblock is NULL. This puts the block in the list after all its subblocks. - Allocate the pending block struct in the symbol_obstack to save + Allocate the pending block struct in the objfile_obstack to save time. This wastes a little space. FIXME: Is it worth it? */ void @@ -449,7 +449,7 @@ record_pending_block (struct objfile *objfile, struct block *block, struct pending_block *pblock; pblock = (struct pending_block *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct pending_block)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct pending_block)); pblock->block = block; if (opblock) { @@ -477,7 +477,7 @@ make_blockvector (struct objfile *objfile) } blockvector = (struct blockvector *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, (sizeof (struct blockvector) + (i - 1) * sizeof (struct block *))); @@ -909,7 +909,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) objfile); blockvector = make_blockvector (objfile); cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } #ifndef PROCESS_LINENUMBER_HOOK @@ -961,7 +961,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { /* Reallocate the line table on the symbol obstack */ symtab->linetable = (struct linetable *) - obstack_alloc (&objfile->symbol_obstack, linetablesize); + obstack_alloc (&objfile->objfile_obstack, linetablesize); memcpy (symtab->linetable, subfile->line_vector, linetablesize); } else @@ -973,7 +973,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { /* Reallocate the dirname on the symbol obstack */ symtab->dirname = (char *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, strlen (subfile->dirname) + 1); strcpy (symtab->dirname, subfile->dirname); } @@ -997,7 +997,7 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section) { symtab->debugformat = obsavestring (subfile->debugformat, strlen (subfile->debugformat), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } /* All symtabs for the main file and the subfiles share a diff --git a/gdb/coffread.c b/gdb/coffread.c index 215be80ef96..c2a931cf985 100644 --- a/gdb/coffread.c +++ b/gdb/coffread.c @@ -1,6 +1,6 @@ /* Read coff symbol tables and convert to internal format, for GDB. Copyright 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by David D. Johnson, Brown University (ddj@cs.brown.edu). @@ -1468,7 +1468,7 @@ process_coff_symbol (struct coff_symbol *cs, struct objfile *objfile) { struct symbol *sym - = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); char *name; @@ -1963,7 +1963,7 @@ coff_read_struct_type (int index, int length, int lastsym) list->field.name = obsavestring (name, strlen (name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_BITPOS (list->field) = 8 * ms->c_value; FIELD_BITSIZE (list->field) = 0; @@ -1982,7 +1982,7 @@ coff_read_struct_type (int index, int length, int lastsym) list->field.name = obsavestring (name, strlen (name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); FIELD_TYPE (list->field) = decode_type (ms, ms->c_type, &sub_aux); FIELD_BITPOS (list->field) = ms->c_value; FIELD_BITSIZE (list->field) = sub_aux.x_sym.x_misc.x_lnsz.x_size; @@ -2049,13 +2049,13 @@ coff_read_enum_type (int index, int length, int lastsym) { case C_MOE: sym = (struct symbol *) obstack_alloc - (¤t_objfile->symbol_obstack, + (¤t_objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = ms->c_value; diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index b9cc794e353..65d3ecc4746 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -655,7 +655,7 @@ initialize_namespace_symtab (struct objfile *objfile) namespace_symtab->free_code = free_nothing; namespace_symtab->dirname = NULL; - bv = obstack_alloc (&objfile->symbol_obstack, + bv = obstack_alloc (&objfile->objfile_obstack, sizeof (struct blockvector) + FIRST_LOCAL_BLOCK * sizeof (struct block *)); BLOCKVECTOR_NBLOCKS (bv) = FIRST_LOCAL_BLOCK + 1; @@ -663,12 +663,12 @@ initialize_namespace_symtab (struct objfile *objfile) /* Allocate empty GLOBAL_BLOCK and STATIC_BLOCK. */ - bl = allocate_block (&objfile->symbol_obstack); - BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + bl = allocate_block (&objfile->objfile_obstack); + BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack, NULL); BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl; - bl = allocate_block (&objfile->symbol_obstack); - BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + bl = allocate_block (&objfile->objfile_obstack); + BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack, NULL); BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl; @@ -686,7 +686,7 @@ initialize_namespace_symtab (struct objfile *objfile) having a symtab/block for this purpose seems like the best solution for now. */ - bl = allocate_block (&objfile->symbol_obstack); + bl = allocate_block (&objfile->objfile_obstack); BLOCK_DICT (bl) = dict_create_hashed_expandable (); BLOCKVECTOR_BLOCK (bv, FIRST_LOCAL_BLOCK) = bl; @@ -783,7 +783,7 @@ check_one_possible_namespace_symbol (const char *name, int len, struct objfile *objfile) { struct block *block = get_possible_namespace_block (objfile); - char *name_copy = obsavestring (name, len, &objfile->symbol_obstack); + char *name_copy = obsavestring (name, len, &objfile->objfile_obstack); struct symbol *sym = lookup_block_symbol (block, name_copy, NULL, VAR_DOMAIN); @@ -793,7 +793,7 @@ check_one_possible_namespace_symbol (const char *name, int len, name_copy, objfile); TYPE_TAG_NAME (type) = TYPE_NAME (type); - sym = obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + sym = obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_LANGUAGE (sym) = language_cplus; SYMBOL_SET_NAMES (sym, name_copy, len, objfile); @@ -807,7 +807,7 @@ check_one_possible_namespace_symbol (const char *name, int len, } else { - obstack_free (&objfile->symbol_obstack, name_copy); + obstack_free (&objfile->objfile_obstack, name_copy); return 1; } diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index d732401fa6c..8de89d37ab1 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -5544,7 +5544,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (name) { - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); @@ -5682,7 +5682,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) SYMBOL_LINKAGE_NAME (sym) = obsavestring (TYPE_TAG_NAME (type), strlen (TYPE_TAG_NAME (type)), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } } @@ -5709,7 +5709,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (cu->language == language_cplus) { struct symbol *typedef_sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); *typedef_sym = *sym; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; @@ -5726,7 +5726,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (processing_has_namespace_info && processing_current_prefix[0] != '\0') { - SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->symbol_obstack, + SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->objfile_obstack, processing_current_prefix, "::", name); @@ -5745,7 +5745,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu) if (processing_has_namespace_info && processing_current_prefix[0] != '\0') { - SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->symbol_obstack, + SYMBOL_LINKAGE_NAME (sym) = obconcat (&objfile->objfile_obstack, processing_current_prefix, "::", name); @@ -5804,7 +5804,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, TYPE_LENGTH (SYMBOL_TYPE (sym))); SYMBOL_VALUE_BYTES (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, cu_header->addr_size); + obstack_alloc (&objfile->objfile_obstack, cu_header->addr_size); /* NOTE: cagney/2003-05-09: In-lined store_address call with it's body - store_unsigned_integer. */ store_unsigned_integer (SYMBOL_VALUE_BYTES (sym), cu_header->addr_size, @@ -5822,7 +5822,7 @@ dwarf2_const_value (struct attribute *attr, struct symbol *sym, TYPE_LENGTH (SYMBOL_TYPE (sym))); SYMBOL_VALUE_BYTES (sym) = (char *) - obstack_alloc (&objfile->symbol_obstack, blk->size); + obstack_alloc (&objfile->objfile_obstack, blk->size); memcpy (SYMBOL_VALUE_BYTES (sym), blk->data, blk->size); SYMBOL_CLASS (sym) = LOC_CONST_BYTES; break; @@ -7658,7 +7658,7 @@ macro_start_file (int file, int line, /* We don't create a macro table for this compilation unit at all until we actually get a filename. */ if (! pending_macros) - pending_macros = new_macro_table (&objfile->symbol_obstack, + pending_macros = new_macro_table (&objfile->objfile_obstack, objfile->macro_cache); if (! current_file) @@ -8001,7 +8001,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, { struct dwarf2_loclist_baton *baton; - baton = obstack_alloc (&cu->objfile->symbol_obstack, + baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (struct dwarf2_loclist_baton)); baton->objfile = cu->objfile; @@ -8021,7 +8021,7 @@ dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym, { struct dwarf2_locexpr_baton *baton; - baton = obstack_alloc (&cu->objfile->symbol_obstack, + baton = obstack_alloc (&cu->objfile->objfile_obstack, sizeof (struct dwarf2_locexpr_baton)); baton->objfile = cu->objfile; diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 2ad035335af..80484669263 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1708,11 +1708,11 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) scan += strlen (scan) + 1; nfields++; /* Handcraft a new symbol for this enum member. */ - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = create_name (list->field.name, - &objfile->symbol_obstack); + &objfile->objfile_obstack); SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_CLASS (sym) = LOC_CONST; @@ -1733,7 +1733,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED; TYPE_NFIELDS (type) = nfields; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct field) * nfields); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nfields); /* Copy the saved-up fields into the field vector. */ for (n = 0; (n < nfields) && (list != NULL); list = list->next) { @@ -2851,7 +2851,7 @@ new_symbol (struct dieinfo *dip, struct objfile *objfile) if (dip->at_name != NULL) { - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); @@ -3011,11 +3011,11 @@ synthesize_typedef (struct dieinfo *dip, struct objfile *objfile, if (dip->at_name != NULL) { sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); OBJSTAT (objfile, n_syms++); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = create_name (dip->at_name, - &objfile->symbol_obstack); + &objfile->objfile_obstack); SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language); SYMBOL_TYPE (sym) = type; SYMBOL_CLASS (sym) = LOC_TYPEDEF; diff --git a/gdb/elfread.c b/gdb/elfread.c index 9cc89e662e3..83a18627526 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -159,8 +159,8 @@ elf_symtab_read (struct objfile *objfile, int dynamic) seen any section info for it yet. */ asymbol *filesym = 0; #ifdef SOFUN_ADDRESS_MAYBE_MISSING - /* Name of filesym, as saved on the symbol_obstack. */ - char *filesymname = obsavestring ("", 0, &objfile->symbol_obstack); + /* Name of filesym, as saved on the objfile_obstack. */ + char *filesymname = obsavestring ("", 0, &objfile->objfile_obstack); #endif struct dbx_symfile_info *dbx = objfile->sym_stab_info; int stripped = (bfd_get_symcount (objfile->obfd) == 0); @@ -251,7 +251,7 @@ elf_symtab_read (struct objfile *objfile, int dynamic) #ifdef SOFUN_ADDRESS_MAYBE_MISSING filesymname = obsavestring ((char *) filesym->name, strlen (filesym->name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); #endif } else if (sym->flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK)) diff --git a/gdb/hpread.c b/gdb/hpread.c index a770b805edf..76e96961f9e 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -1680,7 +1680,7 @@ hpread_symfile_init (struct objfile *objfile) return; GNTT (objfile) - = obstack_alloc (&objfile->symbol_obstack, + = obstack_alloc (&objfile->objfile_obstack, bfd_section_size (objfile->obfd, gntt_section)); bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile), @@ -1702,7 +1702,7 @@ hpread_symfile_init (struct objfile *objfile) return; LNTT (objfile) - = obstack_alloc (&objfile->symbol_obstack, + = obstack_alloc (&objfile->objfile_obstack, bfd_section_size (objfile->obfd, lntt_section)); bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile), @@ -1719,7 +1719,7 @@ hpread_symfile_init (struct objfile *objfile) return; SLT (objfile) = - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, bfd_section_size (objfile->obfd, slt_section)); bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile), @@ -1734,7 +1734,7 @@ hpread_symfile_init (struct objfile *objfile) VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section); VT (objfile) = - (char *) obstack_alloc (&objfile->symbol_obstack, + (char *) obstack_alloc (&objfile->objfile_obstack, VT_SIZE (objfile)); bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile), @@ -3127,11 +3127,11 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp, memp = hpread_get_lntt (mem.dnttp.index, objfile); name = VT (objfile) + memp->dmember.name; - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); SYMBOL_CLASS (sym) = LOC_CONST; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_VALUE (sym) = memp->dmember.value; @@ -3235,11 +3235,11 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Get the name. */ name = VT (objfile) + paramp->dfparam.name; - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); /* Figure out where it lives. */ if (paramp->dfparam.regparam) @@ -3415,7 +3415,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, /* Get the name. */ name = VT (objfile) + paramp->dfparam.name; - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); (void) memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = name; @@ -5098,10 +5098,10 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, char *class_scope_name; /* Allocate one GDB debug symbol and fill in some default values. */ - sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack); + DEPRECATED_SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->objfile_obstack); SYMBOL_LANGUAGE (sym) = language_auto; SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_LINE (sym) = 0; @@ -5304,7 +5304,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, * some things broke, so I'm leaving it in here, and * working around the issue in stack.c. - RT */ - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); + SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack); if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->dfunc.alias) && (!SYMBOL_CPLUS_DEMANGLED_NAME (sym))) { @@ -5420,7 +5420,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, * some things broke, so I'm leaving it in here, and * working around the issue in stack.c. - RT */ - SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); + SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->objfile_obstack); if ((DEPRECATED_SYMBOL_NAME (sym) == VT (objfile) + dn_bufp->ddocfunc.alias) && (!SYMBOL_CPLUS_DEMANGLED_NAME (sym))) @@ -5886,7 +5886,7 @@ hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, { struct symbol *newsym; - newsym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, + newsym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (newsym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (newsym) = name; diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 3d153130f25..6db6e88efa5 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -104,19 +104,19 @@ get_java_class_symtab (void) class_symtab = allocate_symtab ("", objfile); class_symtab->language = language_java; bv = (struct blockvector *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct blockvector) + sizeof (struct block *)); BLOCKVECTOR_NBLOCKS (bv) = 1; BLOCKVECTOR (class_symtab) = bv; /* Allocate dummy STATIC_BLOCK. */ - bl = allocate_block (&objfile->symbol_obstack); - BLOCK_DICT (bl) = dict_create_linear (&objfile->symbol_obstack, + bl = allocate_block (&objfile->objfile_obstack); + BLOCK_DICT (bl) = dict_create_linear (&objfile->objfile_obstack, NULL); BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = bl; /* Allocate GLOBAL_BLOCK. */ - bl = allocate_block (&objfile->symbol_obstack); + bl = allocate_block (&objfile->objfile_obstack); BLOCK_DICT (bl) = dict_create_hashed_expandable (); BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = bl; class_symtab->free_func = free_class_block; @@ -139,7 +139,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr) { struct symbol *sym; sym = (struct symbol *) - obstack_alloc (&dynamics_objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&dynamics_objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_LANGUAGE (sym) = language_java; DEPRECATED_SYMBOL_NAME (sym) = TYPE_TAG_NAME (type); @@ -488,7 +488,7 @@ java_link_class_type (struct type *type, struct value *clas) TYPE_NFN_FIELDS_TOTAL (type) = nmethods; j = nmethods * sizeof (struct fn_field); fn_fields = (struct fn_field *) - obstack_alloc (&dynamics_objfile->symbol_obstack, j); + obstack_alloc (&dynamics_objfile->objfile_obstack, j); memset (fn_fields, 0, j); fn_fieldlists = (struct fn_fieldlist *) alloca (nmethods * sizeof (struct fn_fieldlist)); @@ -559,7 +559,7 @@ java_link_class_type (struct type *type, struct value *clas) j = TYPE_NFN_FIELDS (type) * sizeof (struct fn_fieldlist); TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *) - obstack_alloc (&dynamics_objfile->symbol_obstack, j); + obstack_alloc (&dynamics_objfile->objfile_obstack, j); memcpy (TYPE_FN_FIELDLISTS (type), fn_fieldlists, j); return type; diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index 012fa0e7c15..a30959f6193 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -1060,7 +1060,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, if (sh->iss == 0 || name[0] == '.' || name[0] == '\0') TYPE_TAG_NAME (t) = NULL; else - TYPE_TAG_NAME (t) = obconcat (¤t_objfile->symbol_obstack, + TYPE_TAG_NAME (t) = obconcat (¤t_objfile->objfile_obstack, "", "", name); TYPE_CODE (t) = type_code; @@ -1106,12 +1106,12 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, FIELD_STATIC_KIND (*f) = 0; enum_sym = ((struct symbol *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct symbol))); memset (enum_sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (enum_sym) = obsavestring (f->name, strlen (f->name), - ¤t_objfile->symbol_obstack); + ¤t_objfile->objfile_obstack); SYMBOL_CLASS (enum_sym) = LOC_CONST; SYMBOL_TYPE (enum_sym) = t; SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN; @@ -1204,7 +1204,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend, SYMBOL_CLASS (s) = LOC_CONST; SYMBOL_TYPE (s) = mdebug_type_void; e = ((struct mips_extra_func_info *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct mips_extra_func_info))); memset (e, 0, sizeof (struct mips_extra_func_info)); SYMBOL_VALUE (s) = (long) e; @@ -3948,7 +3948,7 @@ psymtab_to_symtab_1 (struct partial_symtab *pst, char *filename) procedure specific info */ struct mips_extra_func_info *e = ((struct mips_extra_func_info *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct mips_extra_func_info))); struct symbol *s = new_symbol (MIPS_EFI_SYMBOL_NAME); @@ -4592,7 +4592,7 @@ new_symtab (char *name, int maxlines, struct objfile *objfile) s->free_code = free_linetable; s->debugformat = obsavestring ("ECOFF", 5, - &objfile->symbol_obstack); + &objfile->objfile_obstack); return (s); } @@ -4697,7 +4697,7 @@ static struct symbol * new_symbol (char *name) { struct symbol *s = ((struct symbol *) - obstack_alloc (¤t_objfile->symbol_obstack, + obstack_alloc (¤t_objfile->objfile_obstack, sizeof (struct symbol))); memset (s, 0, sizeof (*s)); diff --git a/gdb/minsyms.c b/gdb/minsyms.c index df35956ea14..74b867d59b2 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1,6 +1,6 @@ /* GDB routines for manipulating the minimal symbol tables. Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, - 2002, 2003 + 2002, 2003, 2004 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. @@ -714,7 +714,7 @@ make_cleanup_discard_minimal_symbols (void) Note that we are not concerned here about recovering the space that is potentially freed up, because the strings themselves are allocated - on the symbol_obstack, and will get automatically freed when the symbol + on the objfile_obstack, and will get automatically freed when the symbol table is freed. The caller can free up the unused minimal symbols at the end of the compacted region if their allocation strategy allows it. @@ -832,10 +832,10 @@ install_minimal_symbols (struct objfile *objfile) we will give back the excess space. */ alloc_count = msym_count + objfile->minimal_symbol_count + 1; - obstack_blank (&objfile->symbol_obstack, + obstack_blank (&objfile->objfile_obstack, alloc_count * sizeof (struct minimal_symbol)); msymbols = (struct minimal_symbol *) - obstack_base (&objfile->symbol_obstack); + obstack_base (&objfile->objfile_obstack); /* Copy in the existing minimal symbols, if there are any. */ @@ -875,10 +875,10 @@ install_minimal_symbols (struct objfile *objfile) mcount = compact_minimal_symbols (msymbols, mcount, objfile); - obstack_blank (&objfile->symbol_obstack, + obstack_blank (&objfile->objfile_obstack, (mcount + 1 - alloc_count) * sizeof (struct minimal_symbol)); msymbols = (struct minimal_symbol *) - obstack_finish (&objfile->symbol_obstack); + obstack_finish (&objfile->objfile_obstack); /* We also terminate the minimal symbol table with a "null symbol", which is *not* included in the size of the table. This makes it @@ -896,7 +896,7 @@ install_minimal_symbols (struct objfile *objfile) SYMBOL_INIT_LANGUAGE_SPECIFIC (&msymbols[mcount], language_unknown); /* Attach the minimal symbol table to the specified objfile. - The strings themselves are also located in the symbol_obstack + The strings themselves are also located in the objfile_obstack of this objfile. */ objfile->minimal_symbol_count = mcount; diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 6102091a0fd..1500c197254 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -167,9 +167,6 @@ allocate_objfile (bfd *abfd, int flags) objfile->macro_cache = bcache_xmalloc (); obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, - xfree); - terminate_minimal_symbol_table (objfile); } @@ -236,14 +233,14 @@ allocate_objfile (bfd *abfd, int flags) /* Create the terminating entry of OBJFILE's minimal symbol table. If OBJFILE->msymbols is zero, allocate a single entry from - OBJFILE->symbol_obstack; otherwise, just initialize + OBJFILE->objfile_obstack; otherwise, just initialize OBJFILE->msymbols[OBJFILE->minimal_symbol_count]. */ void terminate_minimal_symbol_table (struct objfile *objfile) { if (! objfile->msymbols) objfile->msymbols = ((struct minimal_symbol *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (objfile->msymbols[0]))); { @@ -339,8 +336,8 @@ 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 - objfile_obstack, so that the memory can be efficiently freed. + that as much as possible is allocated on the 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: @@ -430,8 +427,6 @@ free_objfile (struct objfile *objfile) if (objfile->demangled_names_hash) htab_delete (objfile->demangled_names_hash); obstack_free (&objfile->objfile_obstack, 0); - obstack_free (&objfile->symbol_obstack, 0); - xmfree (objfile->md, objfile); objfile = NULL; } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index e512e547233..1454fbd92d9 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -284,18 +284,8 @@ struct objfile /* Obstack to hold objects that should be freed when we load a new symbol table from this object file. */ - /* Note ezannoni 2004-02-05: this obstack will become the only - obstack per objfile instead of having 3 separate ones with the - same lifetime. I am in the process of gradually migrating the - old obstacks to this one, so that it can be used more - freely. */ - struct obstack objfile_obstack; - /* Obstacks to hold objects that should be freed when we load a new symbol - table from this object file. */ - struct obstack symbol_obstack; /* Full symbols */ - /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */ @@ -322,7 +312,7 @@ struct objfile when passed a pointer to somewhere in the middle of it. There is also a count of the number of symbols, which does not include the terminating null symbol. The array itself, as well as all the data that it points - to, should be allocated on the symbol_obstack for this file. */ + to, should be allocated on the objfile_obstack for this file. */ struct minimal_symbol *msymbols; int minimal_symbol_count; diff --git a/gdb/pa64solib.c b/gdb/pa64solib.c index ee235ad1c92..4e29455606f 100644 --- a/gdb/pa64solib.c +++ b/gdb/pa64solib.c @@ -1161,7 +1161,7 @@ add_to_solist (int from_tty, char *dll_path, int readsyms, new_so->pa64_solib_desc_addr = load_module_desc_addr; new_so->loaded = 1; new_so->name = obsavestring (dll_path, strlen(dll_path), - &symfile_objfile->symbol_obstack); + &symfile_objfile->objfile_obstack); /* If we are not going to load the library, tell the user if we haven't already and return. */ diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index e66463147cc..ef6069ec6ed 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -147,9 +147,6 @@ allocate_rt_common_objfile (void) objfile->macro_cache = bcache_xmalloc (); obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->symbol_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. */ @@ -184,8 +181,8 @@ solib_add_common_symbols (CORE_ADDR rtc_symp) if (rt_common_objfile != NULL && rt_common_objfile->minimal_symbol_count) { - obstack_free (&rt_common_objfile->symbol_obstack, 0); - obstack_specify_allocation (&rt_common_objfile->symbol_obstack, 0, 0, + obstack_free (&rt_common_objfile->objfile_obstack, 0); + obstack_specify_allocation (&rt_common_objfile->objfile_obstack, 0, 0, xmalloc, xfree); rt_common_objfile->minimal_symbol_count = 0; rt_common_objfile->msymbols = NULL; diff --git a/gdb/somsolib.c b/gdb/somsolib.c index f1a0a6e3d93..7ecc97e64d1 100644 --- a/gdb/somsolib.c +++ b/gdb/somsolib.c @@ -643,7 +643,7 @@ som_solib_add (char *arg_string, int from_tty, struct target_ops *target, int re } name = obsavestring (name, name_len - 1, - &symfile_objfile->symbol_obstack); + &symfile_objfile->objfile_obstack); status = target_read_memory (addr + 8, buf, 4); if (status != 0) diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 3a670a40ce9..021c19eb489 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -379,14 +379,14 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs, ld will remove it from the executable. There is then a N_GSYM stab for it, but no regular (C_EXT) symbol. */ sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); SYMBOL_DOMAIN (sym) = VAR_DOMAIN; SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT; DEPRECATED_SYMBOL_NAME (sym) = - obsavestring (name, pp - name, &objfile->symbol_obstack); + obsavestring (name, pp - name, &objfile->objfile_obstack); pp += 2; if (*(pp - 1) == 'F' || *(pp - 1) == 'f') { @@ -612,7 +612,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, nameless = (p == string || ((string[0] == ' ') && (string[1] == ':'))); current_symbol = sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); switch (type & N_TYPE) @@ -646,7 +646,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, { case 't': DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"), - &objfile->symbol_obstack); + &objfile->objfile_obstack); break; case 'v': /* $vtbl_ptr_type */ @@ -655,7 +655,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, case 'e': DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"), - &objfile->symbol_obstack); + &objfile->objfile_obstack); break; case '_': @@ -738,7 +738,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_TYPE (sym) = lookup_fundamental_type (objfile, FT_DBL_PREC_FLOAT); dbl_valu = (char *) - obstack_alloc (&objfile->symbol_obstack, + obstack_alloc (&objfile->objfile_obstack, TYPE_LENGTH (SYMBOL_TYPE (sym))); store_typed_floating (dbl_valu, SYMBOL_TYPE (sym), d); SYMBOL_VALUE_BYTES (sym) = dbl_valu; @@ -1258,7 +1258,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, { /* Clone the sym and then modify it. */ struct symbol *typedef_sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); *typedef_sym = *sym; SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF; SYMBOL_VALUE (typedef_sym) = valu; @@ -3484,14 +3484,14 @@ read_enum_type (char **pp, struct type *type, p = *pp; while (*p != ':') p++; - name = obsavestring (*pp, p - *pp, &objfile->symbol_obstack); + name = obsavestring (*pp, p - *pp, &objfile->objfile_obstack); *pp = p + 1; n = read_huge_number (pp, ',', &nbits); if (nbits != 0) return error_type (pp, objfile); sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); DEPRECATED_SYMBOL_NAME (sym) = name; SYMBOL_LANGUAGE (sym) = current_subfile->language; @@ -4039,7 +4039,7 @@ common_block_start (char *name, struct objfile *objfile) common_block = local_symbols; common_block_i = local_symbols ? local_symbols->nsyms : 0; common_block_name = obsavestring (name, strlen (name), - &objfile->symbol_obstack); + &objfile->objfile_obstack); } /* Process a N_ECOMM symbol. */ @@ -4065,9 +4065,9 @@ common_block_end (struct objfile *objfile) } sym = (struct symbol *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); memset (sym, 0, sizeof (struct symbol)); - /* Note: common_block_name already saved on symbol_obstack */ + /* Note: common_block_name already saved on objfile_obstack */ DEPRECATED_SYMBOL_NAME (sym) = common_block_name; SYMBOL_CLASS (sym) = LOC_BLOCK; diff --git a/gdb/symfile.c b/gdb/symfile.c index 30330afaabc..13bfec3e288 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1912,7 +1912,6 @@ reread_symbols (void) objfile->demangled_names_hash = NULL; } obstack_free (&objfile->objfile_obstack, 0); - obstack_free (&objfile->symbol_obstack, 0); objfile->sections = NULL; objfile->symtabs = NULL; objfile->psymtabs = NULL; @@ -1940,8 +1939,6 @@ reread_symbols (void) objfile->macro_cache = bcache_xmalloc (); obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, - xmalloc, xfree); if (build_objfile_section_table (objfile)) { error ("Can't find the file sections in `%s': %s", @@ -2238,14 +2235,14 @@ allocate_symtab (char *filename, struct objfile *objfile) struct symtab *symtab; symtab = (struct symtab *) - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symtab)); + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symtab)); memset (symtab, 0, sizeof (*symtab)); symtab->filename = obsavestring (filename, strlen (filename), - &objfile->symbol_obstack); + &objfile->objfile_obstack); symtab->fullname = NULL; symtab->language = deduce_language_from_filename (filename); symtab->debugformat = obsavestring ("unknown", 7, - &objfile->symbol_obstack); + &objfile->objfile_obstack); /* Hook it to the objfile it comes from */ diff --git a/gdb/symfile.h b/gdb/symfile.h index 40aa8ddee28..13f6555a07f 100644 --- a/gdb/symfile.h +++ b/gdb/symfile.h @@ -1,7 +1,7 @@ /* Definitions for reading symbol files into GDB. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -224,7 +224,7 @@ extern struct partial_symtab *start_psymtab_common (struct objfile *, extern char *obsavestring (const char *, int, struct obstack *); /* Concatenate strings S1, S2 and S3; return the new string. Space is - found in the symbol_obstack. */ + found in the OBSTACKP */ extern char *obconcat (struct obstack *obstackp, const char *, const char *, const char *); diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 81084a21e26..f6d31f9cc45 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -230,14 +230,12 @@ 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 objfile obstack: %d\n", + obstack_memory_used (&objfile->objfile_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", bcache_memory_used (objfile->macro_cache)); - printf_filtered (" Total memory used for symbol obstack: %d\n", - obstack_memory_used (&objfile->symbol_obstack)); - printf_filtered (" Total memory used for type obstack: %d\n", - obstack_memory_used (&objfile->objfile_obstack)); } immediate_quit--; } diff --git a/gdb/symtab.c b/gdb/symtab.c index fa8b3e7c287..622e27788ca 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -485,7 +485,7 @@ symbol_find_demangled_name (struct general_symbol_info *gsymbol, /* Set both the mangled and demangled (if any) names for GSYMBOL based on LINKAGE_NAME and LEN. The hash table corresponding to OBJFILE - is used, and the memory comes from that objfile's symbol_obstack. + is used, and the memory comes from that objfile's objfile_obstack. LINKAGE_NAME is copied, so the pointer can be discarded after calling this function. */ @@ -572,7 +572,7 @@ symbol_set_names (struct general_symbol_info *gsymbol, /* If there is a demangled name, place it right after the mangled name. Otherwise, just place a second zero byte after the end of the mangled name. */ - *slot = obstack_alloc (&objfile->symbol_obstack, + *slot = obstack_alloc (&objfile->objfile_obstack, lookup_len + demangled_len + 2); memcpy (*slot, lookup_name, lookup_len + 1); if (demangled_name != NULL) diff --git a/gdb/symtab.h b/gdb/symtab.h index e10ea616670..b5d9ffd65b4 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -88,10 +88,10 @@ struct agent_expr; struct general_symbol_info { /* Name of the symbol. This is a required field. Storage for the - 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. */ + name is allocated on the objfile_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. */ char *name; @@ -311,12 +311,13 @@ struct minimal_symbol struct general_symbol_info ginfo; - /* The info field is available for caching machine-specific information - so it doesn't have to rederive the info constantly (over a serial line). - It is initialized to zero and stays that way until target-dependent code - sets it. Storage for any data pointed to by this field should be allo- - cated on the symbol_obstack for the associated objfile. - The type would be "void *" except for reasons of compatibility with older + /* The info field is available for caching machine-specific + information so it doesn't have to rederive the info constantly + (over a serial line). It is initialized to zero and stays that + way until target-dependent code sets it. Storage for any data + pointed to by this field should be allocated on the + objfile_obstack for the associated objfile. The type would be + "void *" except for reasons of compatibility with older compilers. This field is optional. Currently, the AMD 29000 tdep.c uses it to remember things it has decoded diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c index 51aaa37958c..0f67a8df544 100644 --- a/gdb/xcoffread.c +++ b/gdb/xcoffread.c @@ -988,7 +988,7 @@ read_xcoff_symtab (struct partial_symtab *pst) if (cs->c_name[E_SYMNMLEN - 1] != '\0') { char *p; - p = obstack_alloc (&objfile->symbol_obstack, E_SYMNMLEN + 1); + p = obstack_alloc (&objfile->objfile_obstack, E_SYMNMLEN + 1); strncpy (p, cs->c_name, E_SYMNMLEN); p[E_SYMNMLEN] = '\0'; cs->c_name = p; @@ -1422,12 +1422,12 @@ read_xcoff_symtab (struct partial_symtab *pst) #define SYMBOL_DUP(SYMBOL1, SYMBOL2) \ (SYMBOL2) = (struct symbol *) \ - obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); \ + obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol)); \ *(SYMBOL2) = *(SYMBOL1); #define SYMNAME_ALLOC(NAME, ALLOCED) \ - (ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->symbol_obstack); + (ALLOCED) ? (NAME) : obsavestring ((NAME), strlen (NAME), &objfile->objfile_obstack); static struct type *func_symbol_type; @@ -1894,10 +1894,10 @@ init_stringtab (bfd *abfd, file_ptr offset, struct objfile *objfile) if (val != sizeof lengthbuf || length < sizeof lengthbuf) return; - /* Allocate string table from symbol_obstack. We will need this table + /* Allocate string table from objfile_obstack. We will need this table as long as we have its symbol table around. */ - strtbl = (char *) obstack_alloc (&objfile->symbol_obstack, length); + strtbl = (char *) obstack_alloc (&objfile->objfile_obstack, length); ((struct coff_symfile_info *) objfile->sym_private)->strtbl = strtbl; /* Copy length buffer, the first byte is usually zero and is @@ -2890,7 +2890,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline) if (length) { debugsec = - (char *) obstack_alloc (&objfile->symbol_obstack, length); + (char *) obstack_alloc (&objfile->objfile_obstack, length); if (!bfd_get_section_contents (abfd, secp, debugsec, (file_ptr) 0, length)) @@ -2913,7 +2913,7 @@ xcoff_initial_scan (struct objfile *objfile, int mainline) name, bfd_errmsg (bfd_get_error ())); size = coff_data (abfd)->local_symesz * num_symbols; ((struct coff_symfile_info *) objfile->sym_private)->symtbl = - obstack_alloc (&objfile->symbol_obstack, size); + obstack_alloc (&objfile->objfile_obstack, size); ((struct coff_symfile_info *) objfile->sym_private)->symtbl_num_syms = num_symbols; -- 2.30.2