+2004-02-07 Elena Zannoni <ezannoni@redhat.com>
+
+ * 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 <cagney@redhat.com>
* tui/tui.h: Do not include <stdarg.h>, <string.h>, and
/* 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.
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;
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);
}
/* 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
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
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)
{
}
blockvector = (struct blockvector *)
- obstack_alloc (&objfile->symbol_obstack,
+ obstack_alloc (&objfile->objfile_obstack,
(sizeof (struct blockvector)
+ (i - 1) * sizeof (struct block *)));
objfile);
blockvector = make_blockvector (objfile);
cp_finalize_namespace (BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK),
- &objfile->symbol_obstack);
+ &objfile->objfile_obstack);
}
#ifndef PROCESS_LINENUMBER_HOOK
{
/* 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
{
/* 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);
}
{
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
/* 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).
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;
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;
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;
{
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;
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;
/* 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;
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;
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);
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);
}
else
{
- obstack_free (&objfile->symbol_obstack, name_copy);
+ obstack_free (&objfile->objfile_obstack, name_copy);
return 1;
}
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));
SYMBOL_LINKAGE_NAME (sym)
= obsavestring (TYPE_TAG_NAME (type),
strlen (TYPE_TAG_NAME (type)),
- &objfile->symbol_obstack);
+ &objfile->objfile_obstack);
}
}
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;
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);
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);
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,
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;
/* 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)
{
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;
{
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;
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;
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)
{
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));
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;
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);
#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))
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),
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),
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),
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),
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;
/* 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)
/* 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;
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;
* 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)))
{
* 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)))
{
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;
class_symtab = allocate_symtab ("<java-classes>", 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;
{
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);
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));
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;
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;
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;
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;
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);
s->free_code = free_linetable;
s->debugformat = obsavestring ("ECOFF", 5,
- &objfile->symbol_obstack);
+ &objfile->objfile_obstack);
return (s);
}
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));
/* 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.
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.
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. */
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
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;
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);
}
/* 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])));
{
/* 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:
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;
}
/* 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. */
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;
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. */
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. */
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;
}
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)
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')
{
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)
{
case 't':
DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("this", strlen ("this"),
- &objfile->symbol_obstack);
+ &objfile->objfile_obstack);
break;
case 'v': /* $vtbl_ptr_type */
case 'e':
DEPRECATED_SYMBOL_NAME (sym) = obsavestring ("eh_throw", strlen ("eh_throw"),
- &objfile->symbol_obstack);
+ &objfile->objfile_obstack);
break;
case '_':
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;
{
/* 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;
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;
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. */
}
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;
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;
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",
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 */
/* 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.
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 *);
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--;
}
/* 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. */
/* 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)
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;
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
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;
#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;
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
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))
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;