From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2126) id BCDB33851C0C; Wed, 8 Jun 2022 17:11:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BCDB33851C0C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom Tromey To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Move CU queue to dwarf2_per_objfile X-Act-Checkin: binutils-gdb X-Git-Author: Tom Tromey X-Git-Refname: refs/heads/master X-Git-Oldrev: d09ee622ee7fb4f64e9456c600874070ca21debf X-Git-Newrev: 5ca5b31d6381ba6d0309e6ae0b1527a852d08a4b Message-Id: <20220608171143.BCDB33851C0C@sourceware.org> Date: Wed, 8 Jun 2022 17:11:43 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2022 17:11:43 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D5ca5b31d6381= ba6d0309e6ae0b1527a852d08a4b commit 5ca5b31d6381ba6d0309e6ae0b1527a852d08a4b Author: Tom Tromey Date: Tue Jun 7 18:55:51 2022 -0600 Move CU queue to dwarf2_per_objfile =20 The CU queue is a member of dwarf2_per_bfd, but it is only used when expanding CUs. Also, the dwarf2_per_objfile destructor checks the queue -- however, if the per-BFD object is destroyed first, this will not work. This was pointed out Lancelot as fallout from the patch to rewrite the registry system. =20 This patch avoids this problem by moving the queue to the per-objfile object. Diff: --- gdb/dwarf2/read.c | 22 +++++++++++----------- gdb/dwarf2/read.h | 6 +++--- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index d279e729db9..696277d931a 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1231,18 +1231,18 @@ public: explicit dwarf2_queue_guard (dwarf2_per_objfile *per_objfile) : m_per_objfile (per_objfile) { - gdb_assert (!m_per_objfile->per_bfd->queue.has_value ()); + gdb_assert (!m_per_objfile->queue.has_value ()); =20 - m_per_objfile->per_bfd->queue.emplace (); + m_per_objfile->queue.emplace (); } =20 /* Free any entries remaining on the queue. There should only be entries left if we hit an error while processing the dwarf. */ ~dwarf2_queue_guard () { - gdb_assert (m_per_objfile->per_bfd->queue.has_value ()); + gdb_assert (m_per_objfile->queue.has_value ()); =20 - m_per_objfile->per_bfd->queue.reset (); + m_per_objfile->queue.reset (); } =20 DISABLE_COPY_AND_ASSIGN (dwarf2_queue_guard); @@ -1474,7 +1474,7 @@ dwarf2_per_bfd::~dwarf2_per_bfd () void dwarf2_per_objfile::remove_all_cus () { - gdb_assert (!this->per_bfd->queue.has_value ()); + gdb_assert (!queue.has_value ()); =20 m_dwarf2_cus.clear (); } @@ -7491,8 +7491,8 @@ queue_comp_unit (dwarf2_per_cu_data *per_cu, { per_cu->queued =3D 1; =20 - gdb_assert (per_objfile->per_bfd->queue.has_value ()); - per_cu->per_bfd->queue->emplace (per_cu, per_objfile, pretend_language); + gdb_assert (per_objfile->queue.has_value ()); + per_objfile->queue->emplace (per_cu, per_objfile, pretend_language); } =20 /* If PER_CU is not yet expanded of queued for expansion, add it to the qu= eue. @@ -7575,9 +7575,9 @@ process_queue (dwarf2_per_objfile *per_objfile) =20 /* The queue starts out with one item, but following a DIE reference may load a new CU, adding it to the end of the queue. */ - while (!per_objfile->per_bfd->queue->empty ()) + while (!per_objfile->queue->empty ()) { - dwarf2_queue_item &item =3D per_objfile->per_bfd->queue->front (); + dwarf2_queue_item &item =3D per_objfile->queue->front (); dwarf2_per_cu_data *per_cu =3D item.per_cu; =20 if (!per_objfile->symtab_set_p (per_cu)) @@ -7623,7 +7623,7 @@ process_queue (dwarf2_per_objfile *per_objfile) } =20 per_cu->queued =3D 0; - per_objfile->per_bfd->queue->pop (); + per_objfile->queue->pop (); } =20 dwarf_read_debug_printf ("Done expanding symtabs of %s.", @@ -23558,7 +23558,7 @@ dwarf2_per_objfile::age_comp_units () loaded in memory. Calling age_comp_units while the queue is in use c= ould make us free the DIEs for a CU that is in the queue and therefore bre= ak that invariant. */ - gdb_assert (!this->per_bfd->queue.has_value ()); + gdb_assert (!queue.has_value ()); =20 /* Start by clearing all marks. */ for (const auto &pair : m_dwarf2_cus) diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index 75dd38c0b73..51e02dfc457 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -467,9 +467,6 @@ public: gdb::hash_enum> abstract_to_concrete; =20 - /* CUs that are queued to be read. */ - gdb::optional> queue; - /* The address map that is used by the DWARF index code. */ struct addrmap *index_addrmap =3D nullptr; }; @@ -578,6 +575,9 @@ struct dwarf2_per_objfile /* The CU containing the m_builder in scope. */ dwarf2_cu *sym_cu =3D nullptr; =20 + /* CUs that are queued to be read. */ + gdb::optional> queue; + private: /* Hold the corresponding compunit_symtab for each CU or TU. This is indexed by dwarf2_per_cu_data::index. A NULL value means