aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-02-25 17:21:54 -0500
committerSimon Marchi <simon.marchi@efficios.com>2020-05-12 15:24:50 -0400
commit68a44194a5b1220e81122f4edc2f8a7f5f548ba1 (patch)
tree28ba5197274a75c9f70f2ba861e886267220e1e4
parent4132873d03346d3237ea079c8586cbbd4006d540 (diff)
downloadgdb-68a44194a5b1220e81122f4edc2f8a7f5f548ba1.zip
gdb-68a44194a5b1220e81122f4edc2f8a7f5f548ba1.tar.gz
gdb-68a44194a5b1220e81122f4edc2f8a7f5f548ba1.tar.bz2
Remove dwarf2_per_cu_data::dwarf2_per_objfile reference in cutu_reader::keep
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.
-rw-r--r--gdb/dwarf2/read.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 3138e96..d028e86 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -7124,8 +7124,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;