[1/7] gdb/dwarf: make read_cutu_die_from_dwo a method of cutu_reader

Message ID 20250305211037.205294-1-simon.marchi@efficios.com
State New
Headers
Series [1/7] gdb/dwarf: make read_cutu_die_from_dwo a method of cutu_reader |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Simon Marchi March 5, 2025, 9:10 p.m. UTC
  read_cutu_die_from_dwo is only used as a helper to cutu_reader, so make
it a private method of cutu_reader.

Remove the "result_reader" parameter, because it's always "this".

Change-Id: I7df6162137451c160f0e6bf3539569fcb2421eff
---
 gdb/dwarf2/read.c | 45 +++++++++++++++++++++++++--------------------
 1 file changed, 25 insertions(+), 20 deletions(-)


base-commit: 18b66eb58729a0eb61ff46f32bf4127d28b800aa
  

Comments

Tom Tromey March 6, 2025, 2:28 p.m. UTC | #1
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:

Simon> read_cutu_die_from_dwo is only used as a helper to cutu_reader, so make
Simon> it a private method of cutu_reader.

Simon> Remove the "result_reader" parameter, because it's always "this".

Ok.
Approved-By: Tom Tromey <tom@tromey.com>

Tom
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3aa3e9e686d0..987dda5a6a16 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -691,6 +691,13 @@  class cutu_reader
 				  dwarf2_cu *existing_cu,
 				  enum language pretend_language);
 
+  int read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
+			      die_info *stub_comp_unit_die,
+			      const char *stub_comp_dir,
+			      const gdb_byte **result_info_ptr,
+			      die_info **result_comp_unit_die,
+			      abbrev_table_up *result_dwo_abbrev_table);
+
   void prepare_one_comp_unit (struct dwarf2_cu *cu,
 			      enum language pretend_language);
 
@@ -2934,13 +2941,13 @@  init_cu_die_reader (cutu_reader *reader, dwarf2_cu *cu,
 
    The result is non-zero if a valid (non-dummy) DIE was found.  */
 
-static int
-read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
-			die_info *stub_comp_unit_die, const char *stub_comp_dir,
-			cutu_reader *result_reader,
-			const gdb_byte **result_info_ptr,
-			die_info **result_comp_unit_die,
-			abbrev_table_up *result_dwo_abbrev_table)
+int
+cutu_reader::read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
+				     die_info *stub_comp_unit_die,
+				     const char *stub_comp_dir,
+				     const gdb_byte **result_info_ptr,
+				     die_info **result_comp_unit_die,
+				     abbrev_table_up *result_dwo_abbrev_table)
 {
   dwarf2_per_objfile *per_objfile = cu->per_objfile;
   dwarf2_per_cu *per_cu = cu->per_cu;
@@ -3060,16 +3067,16 @@  read_cutu_die_from_dwo (dwarf2_cu *cu, dwo_unit *dwo_unit,
   dwo_abbrev_section->read (objfile);
   *result_dwo_abbrev_table
     = abbrev_table::read (dwo_abbrev_section, cu->header.abbrev_sect_off);
-  init_cu_die_reader (result_reader, cu, section, dwo_unit->dwo_file,
+  init_cu_die_reader (this, cu, section, dwo_unit->dwo_file,
 		      result_dwo_abbrev_table->get ());
 
   /* Read in the die, filling in the attributes from the stub.  This
      has the benefit of simplifying the rest of the code - all the
      work to maintain the illusion of a single
      DW_TAG_{compile,type}_unit DIE is done here.  */
-  info_ptr = read_toplevel_die (result_reader, result_comp_unit_die, info_ptr,
-				gdb::make_array_view (attributes,
-						      next_attr_idx));
+  info_ptr
+    = read_toplevel_die (this, result_comp_unit_die, info_ptr,
+			 gdb::make_array_view (attributes, next_attr_idx));
 
   /* Skip dummy compilation units.  */
   if (info_ptr >= begin_info_ptr + dwo_unit->length
@@ -3179,10 +3186,9 @@  cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu *this_cu,
 
   if (read_cutu_die_from_dwo (cu, sig_type->dwo_unit,
 			      NULL /* stub_comp_unit_die */,
-			      sig_type->dwo_unit->dwo_file->comp_dir,
-			      this, &info_ptr,
-			      &comp_unit_die,
-			      &m_dwo_abbrev_table) == 0)
+			      sig_type->dwo_unit->dwo_file->comp_dir, &info_ptr,
+			      &comp_unit_die, &m_dwo_abbrev_table)
+      == 0)
     {
       /* Dummy die.  */
       dummy_p = true;
@@ -3378,11 +3384,10 @@  cutu_reader::cutu_reader (dwarf2_per_cu *this_cu,
 	      dwo_unit = lookup_dwo_unit (cu, comp_unit_die, dwo_name);
 	      if (dwo_unit != NULL)
 		{
-		  if (read_cutu_die_from_dwo (cu, dwo_unit,
-					      comp_unit_die, NULL,
-					      this, &info_ptr,
-					      &dwo_comp_unit_die,
-					      &m_dwo_abbrev_table) == 0)
+		  if (read_cutu_die_from_dwo (cu, dwo_unit, comp_unit_die, NULL,
+					      &info_ptr, &dwo_comp_unit_die,
+					      &m_dwo_abbrev_table)
+		      == 0)
 		    {
 		      /* Dummy die.  */
 		      dummy_p = true;