Set list_in_scope later in DWARF reader
authorTom Tromey <tom@tromey.com>
Tue, 22 May 2018 05:30:47 +0000 (23:30 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 20 Jul 2018 15:42:46 +0000 (09:42 -0600)
Currently the DWARF reader sets the list_in_scope member of the CU
when first starting to process symbols.  Future changes will make this
assert -- code will not be able to refer to these lists until after
start_symtab has been called.  This patch prepares for the problem by
arranging to initialize list_in_scope in dwarf2_start_symtab.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (process_full_comp_unit): Do not set list_in_scope.
(process_full_type_unit): Likewise.
(dwarf2_start_symtab): Set list_in_scope.

gdb/ChangeLog
gdb/dwarf2read.c

index 96b54fbaebc41171e18ec22299a913692258bc5f..08c73904a6545a64dea672b9762ddcf7ed9167f4 100644 (file)
@@ -1,3 +1,9 @@
+2018-07-20  Tom Tromey  <tom@tromey.com>
+
+       * dwarf2read.c (process_full_comp_unit): Do not set list_in_scope.
+       (process_full_type_unit): Likewise.
+       (dwarf2_start_symtab): Set list_in_scope.
+
 2018-07-20  Tom Tromey  <tom@tromey.com>
 
        * dwarf2read.c (process_psymtab_comp_unit_reader)
index bdd1c9a3b446459f7e4c2c39620357476227c128..b73c06e69c34c4eb064a781166b84fa0e854434f 100644 (file)
@@ -10247,8 +10247,6 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
   /* Clear the list here in case something was left over.  */
   cu->method_list.clear ();
 
-  cu->list_in_scope = &file_symbols;
-
   cu->language = pretend_language;
   cu->language_defn = language_def (cu->language);
 
@@ -10352,8 +10350,6 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
   /* Clear the list here in case something was left over.  */
   cu->method_list.clear ();
 
-  cu->list_in_scope = &file_symbols;
-
   cu->language = pretend_language;
   cu->language_defn = language_def (cu->language);
 
@@ -21019,6 +21015,8 @@ 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;
+
   record_debugformat ("DWARF 2");
   record_producer (cu->producer);