]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Remove dwarf2_per_cu_data::dwarf2_per_objfile reference in cutu_reader::keep
authorSimon Marchi <simon.marchi@efficios.com>
Wed, 27 May 2020 15:13:56 +0000 (11:13 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Wed, 27 May 2020 15:15:55 +0000 (11:15 -0400)
Here, it should be safe to use dwarf2_per_cu_data->cu->per_objfile, as
we know that dwarf2_per_cu_data->cu will be set at this point.

Note that this adds a reference to dwarf2_per_cu_data::cu, which we'll
want to remove later, but the current focus is to remove references to
dwarf2_per_cu_data::dwarf2_per_objfile.  We'll deal with that in a
subsequent patch.

gdb/ChangeLog:

* dwarf2/read.c (cutu_reader::keep): Access dwarf2_per_objfile
object through m_this_cu->cu.

Change-Id: I8dc26d4db021e0b9e9306eb033965b2704bba87c

gdb/ChangeLog
gdb/dwarf2/read.c

index 952722f3ac8acf546a33604f5544dd5d741eafb3..e5f20d322729b36524da93f162ec9c498b5f54ca 100644 (file)
@@ -1,3 +1,8 @@
+2020-05-27  Simon Marchi  <simon.marchi@efficios.com>
+
+       * dwarf2/read.c (cutu_reader::keep): Access dwarf2_per_objfile
+       object through m_this_cu->cu.
+
 2020-05-27  Simon Marchi  <simon.marchi@polymtl.ca>
 
        * dwarf2/read.c (queue_and_load_dwo_tu): Expect a dwarf2_cu as
index 64cf5f47f7b1530934fb35dc5208c6158fb82802..d58303098c1f18467177a2ab32149ddbf2479380 100644 (file)
@@ -7162,8 +7162,11 @@ cutu_reader::keep ()
   gdb_assert (!dummy_p);
   if (m_new_cu != NULL)
     {
-      struct dwarf2_per_objfile *dwarf2_per_objfile
-       = m_this_cu->dwarf2_per_objfile;
+      /* We know that m_this_cu->cu is set, since we are in the process of
+         parsing the CU.  */
+      gdb_assert (m_this_cu->cu != nullptr);
+      dwarf2_per_objfile *dwarf2_per_objfile = m_this_cu->cu->per_objfile;
+
       /* Link this CU into read_in_chain.  */
       m_this_cu->cu->read_in_chain = dwarf2_per_objfile->per_bfd->read_in_chain;
       dwarf2_per_objfile->per_bfd->read_in_chain = m_this_cu;