[Bug symtab/27898] [gdb] Cannot not find DIE

vries at gcc dot gnu.org sourceware-bugzilla@sourceware.org
Wed May 26 09:23:01 GMT 2021


https://sourceware.org/bugzilla/show_bug.cgi?id=27898

--- Comment #9 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #8)
> This fixes it:

But causes many regression.

This also fixes it, now testing:
...
$ git diff
diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c
index 2451df4f5b6..1031ed3aa00 100644
--- a/gdb/dwarf2/cu.c
+++ b/gdb/dwarf2/cu.c
@@ -35,7 +35,8 @@ dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu,
     producer_is_icc (false),
     producer_is_icc_lt_14 (false),
     producer_is_codewarrior (false),
-    processing_has_namespace_info (false)
+    processing_has_namespace_info (false),
+    load_all_dies (false)
 {
 }

diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h
index ff56ec5527b..65a4cf8babf 100644
--- a/gdb/dwarf2/cu.h
+++ b/gdb/dwarf2/cu.h
@@ -283,6 +283,12 @@ struct dwarf2_cu

     return nullptr;
   }
+
+  /* This flag will be set when reading partial DIEs if we need to load
+     absolutely all DIEs for this compilation unit, instead of just the ones
+     we think are interesting.  It gets set if we look for a DIE in the
+     hash table and don't find it.  */
+  unsigned int load_all_dies : 1;
 };

 #endif /* GDB_DWARF2_CU_H */
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 2cd8a95658a..c23a8b99360 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -18831,7 +18831,7 @@ load_partial_dies (const struct die_reader_specs
*reader,
   last_die = NULL;

   gdb_assert (cu->per_cu != NULL);
-  if (cu->per_cu->load_all_dies)
+  if (cu->load_all_dies)
     load_all = 1;

   cu->partial_dies
@@ -19399,9 +19399,9 @@ find_partial_die (sect_offset sect_off, int
offset_in_dwz, str
uct dwarf2_cu *cu)
   /* If we didn't find it, and not all dies have been loaded,
      load them all and try again.  */

-  if (pd == NULL && cu->per_cu->load_all_dies == 0)
+  if (pd == NULL && cu->load_all_dies == 0)
     {
-      cu->per_cu->load_all_dies = 1;
+      cu->load_all_dies = 1;

       /* This is nasty.  When we reread the DIEs, somewhere up the call chain
         THIS_CU->cu may already be in use.  So we can't just free it and
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 6af1f44bd47..0bb3da5a34a 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -421,7 +421,6 @@ struct dwarf2_per_cu_data
 {
   dwarf2_per_cu_data ()
     : queued (false),
-      load_all_dies (false),
       is_debug_types (false),
       is_dwz (false),
       reading_dwo_directly (false),
@@ -447,12 +446,6 @@ struct dwarf2_per_cu_data
      any of the current compilation units are processed.  */
   unsigned int queued : 1;

-  /* This flag will be set when reading partial DIEs if we need to load
-     absolutely all DIEs for this compilation unit, instead of just the ones
-     we think are interesting.  It gets set if we look for a DIE in the
-     hash table and don't find it.  */
-  unsigned int load_all_dies : 1;
-
   /* Non-zero if this CU is from .debug_types.
      Struct dwarf2_per_cu_data is contained in struct signatured_type iff
      this is non-zero.  */
...

Basically, moving load_all_dies from dwarf2_per_cu_data to dwarf2_cu.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Gdb-prs mailing list