diff options
author | Tom Tromey <tom@tromey.com> | 2018-05-21 09:12:54 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-07-20 09:42:46 -0600 |
commit | e148f09d75af9e5c6af5136fee3a5a298114d41f (patch) | |
tree | 0f9ca53921bd325bae5d3cd079cead946204ac60 /gdb/dwarf2read.c | |
parent | 93b8bea4143cafae79076076c64aaa4c46a9b73c (diff) | |
download | fsf-binutils-gdb-e148f09d75af9e5c6af5136fee3a5a298114d41f.zip fsf-binutils-gdb-e148f09d75af9e5c6af5136fee3a5a298114d41f.tar.gz fsf-binutils-gdb-e148f09d75af9e5c6af5136fee3a5a298114d41f.tar.bz2 |
Move the symbol lists to buildsym_compunit
This moves the global symbol lists into buildsym_compunit, adds
accessors, and updates all the users.
gdb/ChangeLog
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.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index b73c06e..805eaf2 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -9715,7 +9715,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) 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) { @@ -9768,7 +9768,7 @@ fixup_go_packaging (struct dwarf2_cu *cu) 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); } @@ -13628,7 +13628,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) 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) { @@ -13713,13 +13713,13 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu) 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 @@ -13771,7 +13771,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) 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, @@ -13789,7 +13789,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu) 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); } @@ -21015,7 +21015,7 @@ dwarf2_start_symtab (struct dwarf2_cu *cu, = 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); @@ -21208,7 +21208,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, 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 { @@ -21251,7 +21251,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, 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; } @@ -21296,8 +21296,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* 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; @@ -21327,8 +21327,8 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, { /* 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; } @@ -21393,9 +21393,9 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, 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". */ @@ -21434,20 +21434,20 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu, /* 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; |