[PATCH 03/30] Add dwarf2_per_cu_data::addresses_seen

Tom Tromey tom@tromey.com
Thu Aug 26 02:19:10 GMT 2021


This adds a new member to dwarf2_per_cu_data that indicates whether
addresses have been seen for this CU.  This is then set by the
.debug_aranges reader.  The idea here is to detect when a CU does not
have address information, so that the new indexer will know to do
extra scanning in that case.
---
 gdb/dwarf2/read.c | 2 ++
 gdb/dwarf2/read.h | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index e418307ee99..a772a16c64c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2741,6 +2741,8 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
 		 - baseaddr);
 	  addrmap_set_empty (mutable_map, start, end - 1, per_cu);
 	}
+
+      per_cu->addresses_seen = true;
     }
 
   return true;
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index b57e1f95c45..a0eab3500ec 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -103,6 +103,7 @@ struct dwarf2_per_cu_data
       reading_dwo_directly (false),
       tu_read (false),
       m_header_read_in (false),
+      addresses_seen (false),
       unit_type {},
       lang (language_unknown)
   {
@@ -153,6 +154,10 @@ struct dwarf2_per_cu_data
      it private at the moment.  */
   mutable bool m_header_read_in : 1;
 
+  /* If addresses have been read for this CU (usually from
+     .debug_aranges), then this flag is set.  */
+  bool addresses_seen : 1;
+
   /* The unit type of this CU.  */
   ENUM_BITFIELD (dwarf_unit_type) unit_type : 8;
 
-- 
2.31.1



More information about the Gdb-patches mailing list