Simplify setting of reading_partial_symbols
authorTom Tromey <tom@tromey.com>
Mon, 24 Feb 2020 22:50:57 +0000 (15:50 -0700)
committerTom Tromey <tom@tromey.com>
Mon, 24 Feb 2020 22:50:57 +0000 (15:50 -0700)
This simplifies the setting and clearing of reading_partial_symbols,
by using scoped_restore in the function that reads partial symbols.

gdb/ChangeLog
2020-02-24  Tom Tromey  <tom@tromey.com>

* dwarf2read.c (dwarf2_build_psymtabs_hard): Use
make_scoped_restore.
(dwarf2_psymtab::read_symtab): Don't clear
reading_partial_symbols.

gdb/ChangeLog
gdb/dwarf2/read.c

index 43ae8e8e36d7419ffc3ca08d100e99575d23878b..044a1920edfb97d51699e071b102a6e57c779ee8 100644 (file)
@@ -1,3 +1,10 @@
+2020-02-24  Tom Tromey  <tom@tromey.com>
+
+       * dwarf2read.c (dwarf2_build_psymtabs_hard): Use
+       make_scoped_restore.
+       (dwarf2_psymtab::read_symtab): Don't clear
+       reading_partial_symbols.
+
 2020-02-24  Tom de Vries  <tdevries@suse.de>
 
        PR gdb/25592
index 46d510eb274c52759ce8a9037d57a9ddf95438b4..701d19ebb750082860ff3ab81c986e0833e2fc82 100644 (file)
@@ -7718,7 +7718,9 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile)
                          objfile_name (objfile));
     }
 
-  dwarf2_per_objfile->reading_partial_symbols = 1;
+  scoped_restore restore_reading_psyms
+    = make_scoped_restore (&dwarf2_per_objfile->reading_partial_symbols,
+                          true);
 
   dwarf2_per_objfile->info.read (objfile);
 
@@ -8692,8 +8694,6 @@ dwarf2_psymtab::read_symtab (struct objfile *objfile)
        = dpo_backlink->has_section_at_zero;
     }
 
-  dwarf2_per_objfile->reading_partial_symbols = 0;
-
   expand_psymtab (objfile);
 
   process_cu_includes (dwarf2_per_objfile);