[02/14] Simplify setting of reading_partial_symbols

Message ID 20200215165444.32653-3-tom@tromey.com
State New
Headers show
Series
  • Share DWARF partial symtabs between objfiles
Related show

Commit Message

Tom Tromey Feb. 15, 2020, 4:54 p.m.
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-15  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     | 7 +++++++
 gdb/dwarf2/read.c | 6 +++---
 2 files changed, 10 insertions(+), 3 deletions(-)

-- 
2.17.2

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e373cc0af2c..81d8cbf0b13 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7731,7 +7731,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);
 
@@ -8705,8 +8707,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);