diff options
author | Tom Tromey <tom@tromey.com> | 2022-06-07 18:55:51 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2022-06-08 11:04:12 -0600 |
commit | 5ca5b31d6381ba6d0309e6ae0b1527a852d08a4b (patch) | |
tree | dd8264a87bec1bb36837742ad6d6e0aac81a179f /gdb/dwarf2 | |
parent | d09ee622ee7fb4f64e9456c600874070ca21debf (diff) | |
download | gdb-5ca5b31d6381ba6d0309e6ae0b1527a852d08a4b.zip gdb-5ca5b31d6381ba6d0309e6ae0b1527a852d08a4b.tar.gz gdb-5ca5b31d6381ba6d0309e6ae0b1527a852d08a4b.tar.bz2 |
Move CU queue to dwarf2_per_objfile
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.
This patch avoids this problem by moving the queue to the per-objfile
object.
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r-- | gdb/dwarf2/read.c | 22 | ||||
-rw-r--r-- | 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 d279e72..696277d 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 ()); - m_per_objfile->per_bfd->queue.emplace (); + m_per_objfile->queue.emplace (); } /* 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 ()); - m_per_objfile->per_bfd->queue.reset (); + m_per_objfile->queue.reset (); } 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 ()); m_dwarf2_cus.clear (); } @@ -7491,8 +7491,8 @@ queue_comp_unit (dwarf2_per_cu_data *per_cu, { per_cu->queued = 1; - 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); } /* If PER_CU is not yet expanded of queued for expansion, add it to the queue. @@ -7575,9 +7575,9 @@ process_queue (dwarf2_per_objfile *per_objfile) /* 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 = per_objfile->per_bfd->queue->front (); + dwarf2_queue_item &item = per_objfile->queue->front (); dwarf2_per_cu_data *per_cu = item.per_cu; if (!per_objfile->symtab_set_p (per_cu)) @@ -7623,7 +7623,7 @@ process_queue (dwarf2_per_objfile *per_objfile) } per_cu->queued = 0; - per_objfile->per_bfd->queue->pop (); + per_objfile->queue->pop (); } 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 could make us free the DIEs for a CU that is in the queue and therefore break that invariant. */ - gdb_assert (!this->per_bfd->queue.has_value ()); + gdb_assert (!queue.has_value ()); /* 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 75dd38c..51e02df 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -467,9 +467,6 @@ public: gdb::hash_enum<sect_offset>> abstract_to_concrete; - /* CUs that are queued to be read. */ - gdb::optional<std::queue<dwarf2_queue_item>> queue; - /* The address map that is used by the DWARF index code. */ struct addrmap *index_addrmap = nullptr; }; @@ -578,6 +575,9 @@ struct dwarf2_per_objfile /* The CU containing the m_builder in scope. */ dwarf2_cu *sym_cu = nullptr; + /* CUs that are queued to be read. */ + gdb::optional<std::queue<dwarf2_queue_item>> 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 |