+2018-07-20 Tom Tromey <tom@tromey.com>
+
+ * xcoffread.c (read_xcoff_symtab, process_xcoff_symbol): Update.
+ * stabsread.c (patch_block_stabs, define_symbol, read_type)
+ (read_enum_type, common_block_start, common_block_end)
+ (cleanup_undefined_types_1, finish_global_stabs): Update.
+ * mdebugread.c (psymtab_to_symtab_1): Update.
+ * dwarf2read.c (fixup_go_packaging, read_func_scope)
+ (read_lexical_block_scope, new_symbol): Update.
+ * dbxread.c (process_one_symbol): Update.
+ * coffread.c (coff_symtab_read, process_coff_symbol)
+ (coff_read_enum_type): Update.
+ * buildsym.h (file_symbols, global_symbols, local_symbols): Don't
+ declare.
+ (get_local_symbols, get_file_symbols, get_global_symbols): New
+ functions.
+ * buildsym.c (~buildsym_compunit): Clean up m_file_symbols and
+ m_global_symbols.
+ <m_file_symbols, m_local_symbols, m_global_symbols>: New members.
+ (~scoped_free_pendings): Update.
+ (finish_block, prepare_for_building, reset_symtab_globals)
+ (end_symtab_get_static_block, end_symtab_with_blockvector)
+ (augment_type_symtab, push_context): Update.
+ (get_local_symbols, get_file_symbols, get_global_symbols): New
+ functions.
+ (buildsym_init): Update.
+
2018-07-20 Tom Tromey <tom@tromey.com>
* dwarf2read.c (process_full_comp_unit): Do not set list_in_scope.
xfree (subfile->line_vector);
xfree (subfile);
}
+
+ struct pending *next, *next1;
+
+ for (next = m_file_symbols; next != NULL; next = next1)
+ {
+ next1 = next->next;
+ xfree ((void *) next);
+ }
+
+ for (next = m_global_symbols; next != NULL; next = next1)
+ {
+ next1 = next->next;
+ xfree ((void *) next);
+ }
}
void set_last_source_file (const char *name)
are just waiting to be built into a blockvector when finalizing the
associated symtab. */
struct pending_block *m_pending_blocks = nullptr;
+
+ /* Pending static symbols and types at the top level. */
+ struct pending *m_file_symbols = nullptr;
+
+ /* Pending global functions and variables. */
+ struct pending *m_global_symbols = nullptr;
+
+ /* Pending symbols that are local to the lexical context. */
+ struct pending *m_local_symbols = nullptr;
};
/* The work-in-progress of the compunit we are building.
scoped_free_pendings::~scoped_free_pendings ()
{
- struct pending *next, *next1;
-
- for (next = file_symbols; next != NULL; next = next1)
- {
- next1 = next->next;
- xfree ((void *) next);
- }
- file_symbols = NULL;
-
- for (next = global_symbols; next != NULL; next = next1)
- {
- next1 = next->next;
- xfree ((void *) next);
- }
- global_symbols = NULL;
-
free_buildsym_compunit ();
}
const struct dynamic_prop *static_link,
CORE_ADDR start, CORE_ADDR end)
{
- return finish_block_internal (symbol, &local_symbols, old_blocks, static_link,
+ return finish_block_internal (symbol, &buildsym_compunit->m_local_symbols,
+ old_blocks, static_link,
start, end, 0, 0);
}
static void
prepare_for_building ()
{
- local_symbols = NULL;
-
/* These should have been reset either by successful completion of building
a symtab, or by the scoped_free_pendings destructor. */
- gdb_assert (file_symbols == NULL);
- gdb_assert (global_symbols == NULL);
gdb_assert (buildsym_compunit == nullptr);
}
static void
reset_symtab_globals (void)
{
- local_symbols = NULL;
- file_symbols = NULL;
- global_symbols = NULL;
-
free_buildsym_compunit ();
}
if (!required
&& buildsym_compunit->m_pending_blocks == NULL
- && file_symbols == NULL
- && global_symbols == NULL
+ && buildsym_compunit->m_file_symbols == NULL
+ && buildsym_compunit->m_global_symbols == NULL
&& !buildsym_compunit->m_have_line_numbers
&& buildsym_compunit->m_pending_macros == NULL
&& buildsym_compunit->m_global_using_directives == NULL)
else
{
/* Define the STATIC_BLOCK. */
- return finish_block_internal (NULL, &file_symbols, NULL, NULL,
+ return finish_block_internal (NULL, get_file_symbols (), NULL, NULL,
buildsym_compunit->m_last_source_start_addr,
end_addr, 0, expandable);
}
end_addr = BLOCK_END (static_block);
/* Create the GLOBAL_BLOCK and build the blockvector. */
- finish_block_internal (NULL, &global_symbols, NULL, NULL,
+ finish_block_internal (NULL, get_global_symbols (), NULL, NULL,
buildsym_compunit->m_last_source_start_addr, end_addr,
1, expandable);
blockvector = make_blockvector ();
if (buildsym_compunit->m_have_line_numbers)
complaint (_("Line numbers recorded in a type symtab"));
- if (file_symbols != NULL)
+ if (buildsym_compunit->m_file_symbols != NULL)
{
struct block *block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
/* First mark any symbols without a specified symtab as belonging
to the primary symtab. */
- set_missing_symtab (file_symbols, cust);
+ set_missing_symtab (buildsym_compunit->m_file_symbols, cust);
- dict_add_pending (BLOCK_DICT (block), file_symbols);
+ dict_add_pending (BLOCK_DICT (block), buildsym_compunit->m_file_symbols);
}
- if (global_symbols != NULL)
+ if (buildsym_compunit->m_global_symbols != NULL)
{
struct block *block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
/* First mark any symbols without a specified symtab as belonging
to the primary symtab. */
- set_missing_symtab (global_symbols, cust);
+ set_missing_symtab (buildsym_compunit->m_global_symbols, cust);
- dict_add_pending (BLOCK_DICT (block), global_symbols);
+ dict_add_pending (BLOCK_DICT (block),
+ buildsym_compunit->m_global_symbols);
}
reset_symtab_globals ();
struct context_stack *newobj = &buildsym_compunit->m_context_stack.back ();
newobj->depth = desc;
- newobj->locals = local_symbols;
+ newobj->locals = buildsym_compunit->m_local_symbols;
newobj->old_blocks = buildsym_compunit->m_pending_blocks;
newobj->start_addr = valu;
newobj->local_using_directives
= buildsym_compunit->m_local_using_directives;
newobj->name = NULL;
- local_symbols = NULL;
+ buildsym_compunit->m_local_symbols = NULL;
buildsym_compunit->m_local_using_directives = NULL;
return newobj;
return buildsym_compunit->m_current_subfile;
}
+/* See buildsym.h. */
+
+struct pending **
+get_local_symbols ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return &buildsym_compunit->m_local_symbols;
+}
+
+/* See buildsym.h. */
+
+struct pending **
+get_file_symbols ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return &buildsym_compunit->m_file_symbols;
+}
+
+/* See buildsym.h. */
+
+struct pending **
+get_global_symbols ()
+{
+ gdb_assert (buildsym_compunit != nullptr);
+ return &buildsym_compunit->m_global_symbols;
+}
+
\f
/* Initialize anything that needs initializing when starting to read a
void
buildsym_init ()
{
- /* Ensure the scoped_free_pendings destructor was called after
- the last time. */
- gdb_assert (file_symbols == NULL);
- gdb_assert (global_symbols == NULL);
- gdb_assert (buildsym_compunit == NULL);
}
struct symbol *symbol[PENDINGSIZE];
};
-/* Here are the three lists that symbols are put on. */
-
-/* static at top level, and types */
-
-EXTERN struct pending *file_symbols;
-
-/* global functions and variables */
-
-EXTERN struct pending *global_symbols;
-
-/* everything local to lexical context */
-
-EXTERN struct pending *local_symbols;
-
/* Stack representing unclosed lexical contexts (that will become
blocks, eventually). */
extern struct subfile *get_current_subfile ();
+/* Return the local symbol list. */
+
+extern struct pending **get_local_symbols ();
+
+/* Return the file symbol list. */
+
+extern struct pending **get_file_symbols ();
+
+/* Return the global symbol list. */
+
+extern struct pending **get_global_symbols ();
+
#undef EXTERN
#endif /* defined (BUILDSYM_H) */
symnum);
break;
}
- if (local_symbols && !outermost_context_p ())
+ if (*get_local_symbols () && !outermost_context_p ())
{
tmpaddr =
cs->c_value + ANOFFSET (objfile->section_offsets,
cstk.start_addr, tmpaddr);
}
/* Now pop locals of block just finished. */
- local_symbols = cstk.locals;
+ *get_local_symbols () = cstk.locals;
}
break;
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
|| cs->c_sclass == C_THUMBSTATFUNC)
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
else if (cs->c_sclass == C_EXT || cs->c_sclass == C_THUMBEXT
|| cs->c_sclass == C_THUMBEXTFUNC)
- add_symbol_to_list (sym, &global_symbols);
+ add_symbol_to_list (sym, get_global_symbols ());
}
else
{
case C_AUTO:
SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case C_THUMBEXT:
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
- add_symbol_to_list (sym, &global_symbols);
+ add_symbol_to_list (sym, get_global_symbols ());
break;
case C_THUMBSTAT:
if (within_function)
{
/* Static symbol of local scope. */
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
}
else
{
/* Static symbol at top level of file. */
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
}
break;
case C_REG:
SYMBOL_ACLASS_INDEX (sym) = coff_register_index;
SYMBOL_VALUE (sym) = cs->c_value;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case C_THUMBLABEL:
case C_ARG:
SYMBOL_ACLASS_INDEX (sym) = LOC_ARG;
SYMBOL_IS_ARGUMENT (sym) = 1;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case C_REGPARM:
SYMBOL_ACLASS_INDEX (sym) = coff_register_index;
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = cs->c_value;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case C_TPDEF:
SYMBOL_VALUE_CHAIN (sym) = opaque_type_chain[i];
opaque_type_chain[i] = sym;
}
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
break;
case C_STRTAG:
TYPE_NAME (SYMBOL_TYPE (sym)) =
concat (SYMBOL_LINKAGE_NAME (sym), (char *)NULL);
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
break;
default:
type = coff_alloc_type (index);
if (within_function)
- symlist = &local_symbols;
+ symlist = get_local_symbols ();
else
- symlist = &file_symbols;
+ symlist = get_file_symbols ();
osyms = *symlist;
o_nsyms = osyms ? osyms->nsyms : 0;
if (desc != cstk.depth)
lbrac_mismatch_complaint (symnum);
- if (local_symbols != NULL)
+ if (*get_local_symbols () != NULL)
{
/* GCC development snapshots from March to December of
2000 would output N_LSYM entries after N_LBRAC
complaint (_("misplaced N_LBRAC entry; discarding local "
"symbols which have no enclosing block"));
}
- local_symbols = cstk.locals;
+ *get_local_symbols () = cstk.locals;
if (get_context_stack_depth () > 1)
{
for them (but don't bother if the block contains no
symbols. Should we complain on blocks without symbols?
I can't think of any useful purpose for them). */
- if (local_symbols != NULL)
+ if (*get_local_symbols () != NULL)
{
/* Muzzle a compiler bug that makes end < start.
struct pending *list;
int i;
- for (list = global_symbols; list != NULL; list = list->next)
+ for (list = *get_global_symbols (); list != NULL; list = list->next)
{
for (i = 0; i < list->nsyms; ++i)
{
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_TYPE (sym) = type;
- add_symbol_to_list (sym, &global_symbols);
+ add_symbol_to_list (sym, get_global_symbols ());
xfree (package_name);
}
attr_to_dynamic_prop (attr, die, cu, newobj->static_link);
}
- cu->list_in_scope = &local_symbols;
+ cu->list_in_scope = get_local_symbols ();
if (die->child != NULL)
{
a function declares a class that has methods). This means that
when we finish processing a function scope, we may need to go
back to building a containing block's symbol lists. */
- local_symbols = cstk.locals;
+ *get_local_symbols () = cstk.locals;
set_local_using_directives (cstk.local_using_directives);
/* If we've finished processing a top-level function, subsequent
symbols go in the file symbol list. */
if (outermost_context_p ())
- cu->list_in_scope = &file_symbols;
+ cu->list_in_scope = get_file_symbols ();
}
/* Process all the DIES contained within a lexical block scope. Start
inherit_abstract_dies (die, cu);
struct context_stack cstk = pop_context ();
- if (local_symbols != NULL || (*get_local_using_directives ()) != NULL)
+ if (*get_local_symbols () != NULL || (*get_local_using_directives ()) != NULL)
{
struct block *block
= finish_block (0, cstk.old_blocks, NULL,
to do. */
dwarf2_record_block_ranges (die, block, baseaddr, cu);
}
- local_symbols = cstk.locals;
+ *get_local_symbols () = cstk.locals;
set_local_using_directives (cstk.local_using_directives);
}
= start_symtab (cu->per_cu->dwarf2_per_objfile->objfile, name, comp_dir,
low_pc, cu->language);
- cu->list_in_scope = &file_symbols;
+ cu->list_in_scope = get_file_symbols ();
record_debugformat ("DWARF 2");
record_producer (cu->producer);
access them globally. For instance, we want to be able
to break on a nested subprogram without having to
specify the context. */
- list_to_add = &global_symbols;
+ list_to_add = get_global_symbols ();
}
else
{
if (!suppress_add)
{
if (attr2 && (DW_UNSND (attr2) != 0))
- list_to_add = &global_symbols;
+ list_to_add = get_global_symbols ();
else
list_to_add = cu->list_in_scope;
}
/* A variable with DW_AT_external is never static,
but it may be block-scoped. */
- list_to_add = (cu->list_in_scope == &file_symbols
- ? &global_symbols : cu->list_in_scope);
+ list_to_add = (cu->list_in_scope == get_file_symbols ()
+ ? get_global_symbols () : cu->list_in_scope);
}
else
list_to_add = cu->list_in_scope;
{
/* A variable with DW_AT_external is never static, but it
may be block-scoped. */
- list_to_add = (cu->list_in_scope == &file_symbols
- ? &global_symbols : cu->list_in_scope);
+ list_to_add = (cu->list_in_scope == get_file_symbols ()
+ ? get_global_symbols () : cu->list_in_scope);
SYMBOL_ACLASS_INDEX (sym) = LOC_UNRESOLVED;
}
if (!suppress_add)
{
- list_to_add = (cu->list_in_scope == &file_symbols
+ list_to_add = (cu->list_in_scope == get_file_symbols ()
&& cu->language == language_cplus
- ? &global_symbols : cu->list_in_scope);
+ ? get_global_symbols () : cu->list_in_scope);
/* The semantics of C++ state that "struct foo {
... }" also defines a typedef for "foo". */
/* NOTE: carlton/2003-11-10: See comment above in the
DW_TAG_class_type, etc. block. */
- list_to_add = (cu->list_in_scope == &file_symbols
+ list_to_add = (cu->list_in_scope == get_file_symbols ()
&& cu->language == language_cplus
- ? &global_symbols : cu->list_in_scope);
+ ? get_global_symbols () : cu->list_in_scope);
}
break;
case DW_TAG_imported_declaration:
case DW_TAG_namespace:
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
- list_to_add = &global_symbols;
+ list_to_add = get_global_symbols ();
break;
case DW_TAG_module:
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = MODULE_DOMAIN;
- list_to_add = &global_symbols;
+ list_to_add = get_global_symbols ();
break;
case DW_TAG_common_block:
SYMBOL_ACLASS_INDEX (sym) = LOC_COMMON_BLOCK;
SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void;
SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
e->pdr.framereg = -1;
- add_symbol_to_list (s, &local_symbols);
+ add_symbol_to_list (s, get_local_symbols ());
}
}
else if (sh.st == stLabel)
{
SYMBOL_TYPE (sym) = read_type (&pp, objfile);
}
- add_symbol_to_list (sym, &global_symbols);
+ add_symbol_to_list (sym, get_global_symbols ());
}
else
{
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
return sym;
}
++p;
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
return sym;
}
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
return sym;
}
}
}
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
return sym;
case 'C':
SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE_ADDRESS (sym) = valu;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case 'f':
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
/* fall into process_function_types. */
process_function_types:
SYMBOL_TYPE (sym) = read_type (&p, objfile);
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &global_symbols);
+ add_symbol_to_list (sym, get_global_symbols ());
goto process_function_types;
case 'G':
SYMBOL_VALUE_CHAIN (sym) = global_sym_chain[i];
global_sym_chain[i] = sym;
}
- add_symbol_to_list (sym, &global_symbols);
+ add_symbol_to_list (sym, get_global_symbols ());
break;
/* This case is faked by a conditional above,
SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case 'p':
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_IS_ARGUMENT (sym) = 1;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
if (gdbarch_byte_order (gdbarch) != BFD_ENDIAN_BIG)
{
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case 'r':
but this case is considered pathological and causes a warning
from a decent compiler. */
+ struct pending *local_symbols = *get_local_symbols ();
if (local_symbols
&& local_symbols->nsyms > 0
&& gdbarch_stabs_argument_has_addr (gdbarch, SYMBOL_TYPE (sym)))
break;
}
}
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
}
else
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
break;
case 'S':
}
}
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
break;
case 't':
TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_LINKAGE_NAME (sym);
}
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
if (synonym)
{
= obconcat (&objfile->objfile_obstack,
SYMBOL_LINKAGE_NAME (sym),
(char *) NULL);
- add_symbol_to_list (struct_sym, &file_symbols);
+ add_symbol_to_list (struct_sym, get_file_symbols ());
}
break;
= obconcat (&objfile->objfile_obstack,
SYMBOL_LINKAGE_NAME (sym),
(char *) NULL);
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
if (synonym)
{
= obconcat (&objfile->objfile_obstack,
SYMBOL_LINKAGE_NAME (sym),
(char *) NULL);
- add_symbol_to_list (typedef_sym, &file_symbols);
+ add_symbol_to_list (typedef_sym, get_file_symbols ());
}
break;
}
}
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case 'v':
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case 'a':
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
case 'X':
SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &local_symbols);
+ add_symbol_to_list (sym, get_local_symbols ());
break;
default:
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_VALUE (sym) = 0;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, &file_symbols);
+ add_symbol_to_list (sym, get_file_symbols ());
break;
}
type, rather than allocating a new one. This saves some
memory. */
- for (ppt = file_symbols; ppt; ppt = ppt->next)
+ for (ppt = *get_file_symbols (); ppt; ppt = ppt->next)
for (i = 0; i < ppt->nsyms; i++)
{
struct symbol *sym = ppt->symbol[i];
to be file-scope, between N_FN entries, using N_LSYM. What's a mother
to do? For now, force all enum values to file scope. */
if (within_function)
- symlist = &local_symbols;
+ symlist = get_local_symbols ();
else
#endif
- symlist = &file_symbols;
+ symlist = get_file_symbols ();
osyms = *symlist;
o_nsyms = osyms ? osyms->nsyms : 0;
{
complaint (_("Invalid symbol data: common block within common block"));
}
- common_block = local_symbols;
- common_block_i = local_symbols ? local_symbols->nsyms : 0;
+ common_block = *get_local_symbols ();
+ common_block_i = common_block ? common_block->nsyms : 0;
common_block_name = (char *) obstack_copy0 (&objfile->objfile_obstack, name,
strlen (name));
}
/* Now we copy all the symbols which have been defined since the BCOMM. */
/* Copy all the struct pendings before common_block. */
- for (next = local_symbols;
+ for (next = *get_local_symbols ();
next != NULL && next != common_block;
next = next->next)
{
complaint (_("need a type name"));
break;
}
- for (ppt = file_symbols; ppt; ppt = ppt->next)
+ for (ppt = *get_file_symbols (); ppt; ppt = ppt->next)
{
for (i = 0; i < ppt->nsyms; i++)
{
{
if (global_stabs)
{
- patch_block_stabs (global_symbols, global_stabs, objfile);
+ patch_block_stabs (*get_global_symbols (), global_stabs, objfile);
xfree (global_stabs);
global_stabs = NULL;
}
eb_complaint (cs->c_symnum);
break;
}
- if (local_symbols && !outermost_context_p ())
+ if (*get_local_symbols () && !outermost_context_p ())
{
/* Make a block for the local symbols within. */
finish_block (cstk.name,
+ ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile))));
}
- local_symbols = cstk.locals;
+ *get_local_symbols () = cstk.locals;
}
break;
SYMBOL_DUP (sym, sym2);
if (cs->c_sclass == C_EXT || C_WEAKEXT)
- add_symbol_to_list (sym2, &global_symbols);
+ add_symbol_to_list (sym2, get_global_symbols ());
else if (cs->c_sclass == C_HIDEXT || cs->c_sclass == C_STAT)
- add_symbol_to_list (sym2, &file_symbols);
+ add_symbol_to_list (sym2, get_file_symbols ());
}
else
{