public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 37/38] Simplify "want_partial_unit" handling
Date: Thu, 23 Jan 2020 02:34:00 -0000	[thread overview]
Message-ID: <20200123005710.7978-38-tom@tromey.com> (raw)
In-Reply-To: <20200123005710.7978-1-tom@tromey.com>

This changes the "want_partial_unit" parameters to have type bool, and
also removes the parameter from process_psymtab_comp_unit_reader.
This latter change seemed like an improvement, because it avoids a
pointless function call in the case where we are not planning to read
a partial unit.

2020-01-22  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.c (process_psymtab_comp_unit_reader): Remove
	"want_partial_unit" parameter.
	(process_psymtab_comp_unit): Change want_partial_unit to bool.
	Inline check for DW_TAG_partial_unit.
	(dwarf2_build_psymtabs_hard, scan_partial_symbols): Update.

Change-Id: I99e647f0c4faa3346e90a6e7bacc82af57eccff1
---
 gdb/ChangeLog     |  8 ++++++++
 gdb/dwarf2/read.c | 14 +++++---------
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 09840400cec..d1a78afd8cf 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7248,7 +7248,6 @@ static void
 process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 				  const gdb_byte *info_ptr,
 				  struct die_info *comp_unit_die,
-				  int want_partial_unit,
 				  enum language pretend_language)
 {
   struct dwarf2_cu *cu = reader->cu;
@@ -7261,9 +7260,6 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
   enum pc_bounds_kind cu_bounds_kind;
   const char *filename;
 
-  if (comp_unit_die->tag == DW_TAG_partial_unit && !want_partial_unit)
-    return;
-
   gdb_assert (! per_cu->is_debug_types);
 
   prepare_one_comp_unit (cu, comp_unit_die, pretend_language);
@@ -7377,7 +7373,7 @@ process_psymtab_comp_unit_reader (const struct die_reader_specs *reader,
 
 static void
 process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
-			   int want_partial_unit,
+			   bool want_partial_unit,
 			   enum language pretend_language)
 {
   /* If this compilation unit was already read in, free the
@@ -7397,10 +7393,10 @@ process_psymtab_comp_unit (struct dwarf2_per_cu_data *this_cu,
   else if (this_cu->is_debug_types)
     build_type_psymtabs_reader (&reader, reader.info_ptr,
 				reader.comp_unit_die);
-  else
+  else if (want_partial_unit
+	   || reader.comp_unit_die->tag != DW_TAG_partial_unit)
     process_psymtab_comp_unit_reader (&reader, reader.info_ptr,
 				      reader.comp_unit_die,
-				      want_partial_unit,
 				      pretend_language);
 
   /* Age out any secondary CUs.  */
@@ -7760,7 +7756,7 @@ dwarf2_build_psymtabs_hard (struct dwarf2_per_objfile *dwarf2_per_objfile)
 			   addrmap_create_mutable (&temp_obstack));
 
   for (dwarf2_per_cu_data *per_cu : dwarf2_per_objfile->all_comp_units)
-    process_psymtab_comp_unit (per_cu, 0, language_minimal);
+    process_psymtab_comp_unit (per_cu, false, language_minimal);
 
   /* This has to wait until we read the CUs, we need the list of DWOs.  */
   process_skeletonless_type_units (dwarf2_per_objfile);
@@ -7977,7 +7973,7 @@ scan_partial_symbols (struct partial_die_info *first_die, CORE_ADDR *lowpc,
 
 		/* Go read the partial unit, if needed.  */
 		if (per_cu->v.psymtab == NULL)
-		  process_psymtab_comp_unit (per_cu, 1, cu->language);
+		  process_psymtab_comp_unit (per_cu, true, cu->language);
 
 		cu->per_cu->imported_symtabs_push (per_cu);
 	      }
-- 
2.17.2

  parent reply	other threads:[~2020-01-23  1:21 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-23  0:57 [PATCH 00/38] Start reorganization of DWARF code Tom Tromey
2020-01-23  0:57 ` [PATCH 33/38] Create dwarf2/comp-unit.[ch] Tom Tromey
2020-01-23  0:57 ` [PATCH 23/38] Change dwarf2_per_objfile::quick_file_names_table to htab_up Tom Tromey
2020-01-23  0:57 ` [PATCH 21/38] Use htab_up in abbrev_table Tom Tromey
2020-01-23  0:57 ` [PATCH 34/38] Convert read_offset to method on comp_unit_head Tom Tromey
2020-01-23  0:57 ` [PATCH 02/38] Create dwarf2/section.[ch] Tom Tromey
2020-01-23  0:57 ` [PATCH 15/38] Change dwarf2_per_objfile::type_unit_groups to htab_up Tom Tromey
2020-01-23  0:57 ` [PATCH 36/38] Move two more functions to dwarf2/leb.h Tom Tromey
2020-01-23  0:57 ` [PATCH 11/38] Move DWARF code to dwarf2/ subdirectory Tom Tromey
2020-01-27 13:41   ` Christian Biesinger via gdb-patches
2020-01-28  3:12     ` Tom Tromey
2020-01-23  0:57 ` [PATCH 26/38] Change line_table methods to return unique_xmalloc_ptr Tom Tromey
2020-01-23  0:57 ` [PATCH 06/38] Change some attribute functions to be methods Tom Tromey
2020-01-23  0:57 ` [PATCH 08/38] Remove die_info_ptr typedef Tom Tromey
2020-01-23  0:57 ` [PATCH 01/38] Create dwarf2/leb.[ch] Tom Tromey
2020-01-23  0:57 ` [PATCH 19/38] Change dwarf2_per_objfile::die_type_hash to htab_up Tom Tromey
2020-01-23  0:57 ` [PATCH 31/38] Convert dwarf2_section_size to a method Tom Tromey
2020-01-23  0:57 ` [PATCH 35/38] Convert read_address to a method on comp_unit_head Tom Tromey
2020-01-23  0:57 ` [PATCH 16/38] Change dwarf2_per_objfile::line_header_hash to htab_up Tom Tromey
2020-01-23  0:57 ` [PATCH 07/38] Change attr_form_is_block to be a method Tom Tromey
2020-01-23  0:57 ` [PATCH 32/38] Move read_offset_1 to leb.c Tom Tromey
2020-01-23  0:57 ` [PATCH 13/38] Remove DWARF queue-related globals Tom Tromey
2020-01-23  0:57 ` [PATCH 22/38] Minor simplification in abbrev_table::read Tom Tromey
2020-01-23  0:57 ` [PATCH 27/38] Move DWARF line_header to new file Tom Tromey
2020-01-23  0:57 ` [PATCH 38/38] Remove "keep" parameter from cutu_reader constructor Tom Tromey
2020-02-08 17:36   ` Simon Marchi
2020-01-23  0:57 ` [PATCH 05/38] Create dwarf2/attribute.[ch] Tom Tromey
2020-01-23  0:57 ` [PATCH 20/38] Minor cleanups in abbrev_table Tom Tromey
2020-01-23  0:57 ` [PATCH 30/38] Unify read_initial_length implementations Tom Tromey
2020-01-27 13:31   ` Christian Biesinger via gdb-patches
2020-01-28  0:54     ` Tom Tromey
2020-01-23  0:57 ` [PATCH 17/38] Don't allocate DWO file hash on obstack Tom Tromey
2020-01-23  0:57 ` [PATCH 24/38] Move dwarf_always_disassemble to dwarf2/loc.c Tom Tromey
2020-01-23  0:57 ` [PATCH 09/38] Don't declare die_info in dwarf2read.h Tom Tromey
2020-01-23  0:57 ` [PATCH 18/38] Change dwp_file to use htab_up Tom Tromey
2020-01-23  0:57 ` [PATCH 25/38] Change file_full_name and file_file_name methods Tom Tromey
2020-01-27 13:31   ` Christian Biesinger via gdb-patches
2020-01-23  0:57 ` [PATCH 14/38] Change dwarf2_per_objfile::signatured_types to be htab_up Tom Tromey
2020-02-08 16:55   ` Simon Marchi
2020-01-23  0:57 ` [PATCH 10/38] Remove die_reader_specs::comp_dir Tom Tromey
2020-01-23  0:57 ` [PATCH 28/38] Move dwarf2_per_cu_data::imported_symtabs earlier Tom Tromey
2020-01-23  0:57 ` [PATCH 12/38] Introduce die_info::has_children Tom Tromey
2020-01-23  0:57 ` [PATCH 04/38] Create dwarf2/abbrev.[ch] Tom Tromey
2020-01-23  1:12 ` [PATCH 03/38] Change section functions to be methods of dwarf2_section_info Tom Tromey
2020-01-23  1:21 ` [PATCH 29/38] Add some methods to dwarf2_per_cu_data Tom Tromey
2020-01-23  2:34 ` Tom Tromey [this message]
2020-02-08 17:38 ` [PATCH 00/38] Start reorganization of DWARF code Simon Marchi
2020-02-08 20:45   ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200123005710.7978-38-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).