aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2')
-rw-r--r--gdb/dwarf2/aranges.c10
-rw-r--r--gdb/dwarf2/cooked-index-worker.c18
-rw-r--r--gdb/dwarf2/cooked-index-worker.h19
-rw-r--r--gdb/dwarf2/cooked-index.c15
-rw-r--r--gdb/dwarf2/cooked-index.h15
-rw-r--r--gdb/dwarf2/cooked-indexer.h2
-rw-r--r--gdb/dwarf2/parent-map.c2
-rw-r--r--gdb/dwarf2/read.c10
-rw-r--r--gdb/dwarf2/read.h2
9 files changed, 44 insertions, 49 deletions
diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c
index 7016eee..ac530ab 100644
--- a/gdb/dwarf2/aranges.c
+++ b/gdb/dwarf2/aranges.c
@@ -59,6 +59,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
gdb::unordered_set<sect_offset> debug_info_offset_seen;
const bfd_endian dwarf5_byte_order = gdbarch_byte_order (gdbarch);
+ const int signed_addr_p = bfd_get_sign_extend_vma (abfd);
const gdb_byte *addr = section->buffer;
while (addr < section->buffer + section->size)
{
@@ -167,8 +168,13 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile,
plongest (entry_addr - section->buffer));
return false;
}
- ULONGEST start = extract_unsigned_integer (addr, address_size,
- dwarf5_byte_order);
+ ULONGEST start;
+ if (signed_addr_p)
+ start = extract_signed_integer (addr, address_size,
+ dwarf5_byte_order);
+ else
+ start = extract_unsigned_integer (addr, address_size,
+ dwarf5_byte_order);
addr += address_size;
ULONGEST length = extract_unsigned_integer (addr, address_size,
dwarf5_byte_order);
diff --git a/gdb/dwarf2/cooked-index-worker.c b/gdb/dwarf2/cooked-index-worker.c
index 95ec943..da51a8c 100644
--- a/gdb/dwarf2/cooked-index-worker.c
+++ b/gdb/dwarf2/cooked-index-worker.c
@@ -226,8 +226,7 @@ cooked_index_worker::set (cooked_state desired_state)
/* See cooked-index-worker.h. */
void
-cooked_index_worker::write_to_cache (const cooked_index *idx,
- deferred_warnings *warn) const
+cooked_index_worker::write_to_cache (const cooked_index *idx)
{
if (idx != nullptr)
{
@@ -235,7 +234,7 @@ cooked_index_worker::write_to_cache (const cooked_index *idx,
See PR symtab/30837. This arranges to capture all such
warnings. This is safe because we know the deferred_warnings
object isn't in use by any other thread at this point. */
- scoped_restore_warning_hook defer (warn);
+ scoped_restore_warning_hook defer (&m_warnings);
m_cache_store.store ();
}
}
@@ -245,21 +244,12 @@ cooked_index_worker::write_to_cache (const cooked_index *idx,
void
cooked_index_worker::done_reading ()
{
- /* Only handle the scanning results here. Complaints and exceptions
- can only be dealt with on the main thread. */
- std::vector<cooked_index_shard_up> shards;
-
for (auto &one_result : m_results)
- {
- shards.push_back (one_result.release_shard ());
- m_all_parents_map.add_map (*one_result.get_parent_map ());
- }
-
- shards.shrink_to_fit ();
+ m_all_parents_map.add_map (*one_result.get_parent_map ());
dwarf2_per_bfd *per_bfd = m_per_objfile->per_bfd;
cooked_index *table
= (gdb::checked_static_cast<cooked_index *>
(per_bfd->index_table.get ()));
- table->set_contents (std::move (shards), &m_warnings, &m_all_parents_map);
+ table->set_contents ();
}
diff --git a/gdb/dwarf2/cooked-index-worker.h b/gdb/dwarf2/cooked-index-worker.h
index fbbb3b5..df5c31d 100644
--- a/gdb/dwarf2/cooked-index-worker.h
+++ b/gdb/dwarf2/cooked-index-worker.h
@@ -224,6 +224,22 @@ public:
cache writer.) */
bool wait (cooked_state desired_state, bool allow_quit);
+ /* Release all shards from the results. */
+ std::vector<cooked_index_shard_up> release_shards ()
+ {
+ std::vector<cooked_index_shard_up> result;
+ for (auto &one_result : m_results)
+ result.push_back (one_result.release_shard ());
+ result.shrink_to_fit ();
+ return result;
+ }
+
+ /* Return the object holding all the parent maps. */
+ const parent_map_map *get_parent_map_map () const
+ {
+ return &m_all_parents_map;
+ }
+
protected:
/* Let cooked_index call the 'set' and 'write_to_cache' methods. */
@@ -233,8 +249,7 @@ protected:
void set (cooked_state desired_state);
/* Write to the index cache. */
- void write_to_cache (const cooked_index *idx,
- deferred_warnings *warn) const;
+ void write_to_cache (const cooked_index *idx);
/* Helper function that does the work of reading. This must be able
to be run in a worker thread without problems. */
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index a632474..0f20b07 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -20,14 +20,10 @@
#include "dwarf2/cooked-index.h"
#include "dwarf2/read.h"
#include "dwarf2/stringify.h"
-#include "dwarf2/index-cache.h"
#include "event-top.h"
-#include "split-name.h"
#include "observable.h"
#include "run-on-main-thread.h"
-#include <algorithm>
#include "gdbsupport/task-group.h"
-#include <chrono>
#include "cli/cli-cmds.h"
/* We don't want gdb to exit while it is in the process of writing to
@@ -82,12 +78,10 @@ cooked_index::wait (cooked_state desired_state, bool allow_quit)
}
void
-cooked_index::set_contents (std::vector<cooked_index_shard_up> &&shards,
- deferred_warnings *warn,
- const parent_map_map *parent_maps)
+cooked_index::set_contents ()
{
gdb_assert (m_shards.empty ());
- m_shards = std::move (shards);
+ m_shards = m_state->release_shards ();
m_state->set (cooked_state::MAIN_AVAILABLE);
@@ -96,16 +90,17 @@ cooked_index::set_contents (std::vector<cooked_index_shard_up> &&shards,
finalization. However, that would take a slot in the global
thread pool, and if enough such tasks were submitted at once, it
would cause a livelock. */
- gdb::task_group finalizers ([this, warn] ()
+ gdb::task_group finalizers ([this] ()
{
m_state->set (cooked_state::FINALIZED);
- m_state->write_to_cache (index_for_writing (), warn);
+ m_state->write_to_cache (index_for_writing ());
m_state->set (cooked_state::CACHE_DONE);
});
for (auto &shard : m_shards)
{
auto this_shard = shard.get ();
+ const parent_map_map *parent_maps = m_state->get_parent_map_map ();
finalizers.add_task ([=] () { this_shard->finalize (parent_maps); });
}
diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h
index c16afa0..384938e 100644
--- a/gdb/dwarf2/cooked-index.h
+++ b/gdb/dwarf2/cooked-index.h
@@ -20,19 +20,14 @@
#ifndef GDB_DWARF2_COOKED_INDEX_H
#define GDB_DWARF2_COOKED_INDEX_H
-#include "dwarf2.h"
#include "dwarf2/cooked-index-entry.h"
-#include "dwarf2/types.h"
#include "symtab.h"
-#include "hashtab.h"
#include "quick-symbol.h"
-#include "gdbsupport/gdb_obstack.h"
#include "addrmap.h"
#include "dwarf2/mapped-index.h"
#include "dwarf2/read.h"
#include "dwarf2/parent-map.h"
#include "gdbsupport/range-chain.h"
-#include "complaints.h"
#include "dwarf2/cooked-index-shard.h"
#include "dwarf2/cooked-index-worker.h"
@@ -110,14 +105,8 @@ public:
void start_reading () override;
/* Called by cooked_index_worker to set the contents of this index
- and transition to the MAIN_AVAILABLE state. WARN is used to
- collect any warnings that may arise when writing to the cache.
- PARENT_MAPS is used when resolving pending parent links.
- PARENT_MAPS may be NULL if there are no IS_PARENT_DEFERRED
- entries in VEC. */
- void set_contents (std::vector<cooked_index_shard_up> &&vec,
- deferred_warnings *warn,
- const parent_map_map *parent_maps);
+ and transition to the MAIN_AVAILABLE state. */
+ void set_contents ();
/* A range over a vector of subranges. */
using range = range_chain<cooked_index_shard::range>;
diff --git a/gdb/dwarf2/cooked-indexer.h b/gdb/dwarf2/cooked-indexer.h
index 99e9fdd..904c55f 100644
--- a/gdb/dwarf2/cooked-indexer.h
+++ b/gdb/dwarf2/cooked-indexer.h
@@ -20,7 +20,7 @@
#ifndef GDB_DWARF2_COOKED_INDEXER_H
#define GDB_DWARF2_COOKED_INDEXER_H
-#include "dwarf2/cooked-index.h"
+#include "dwarf2/cooked-index-entry.h"
#include "dwarf2/parent-map.h"
#include "dwarf2/types.h"
#include <variant>
diff --git a/gdb/dwarf2/parent-map.c b/gdb/dwarf2/parent-map.c
index d029a76..6f290c1 100644
--- a/gdb/dwarf2/parent-map.c
+++ b/gdb/dwarf2/parent-map.c
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#include "dwarf2/cooked-index.h"
+#include "dwarf2/cooked-index-entry.h"
#include "dwarf2/read.h"
#include "dwarf2/parent-map.h"
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 17f06ff..71fd352 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -2970,7 +2970,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
dwarf2_cu *existing_cu,
bool skip_partial,
enum language pretend_language,
- const abbrev_table_cache *cache)
+ const abbrev_table_cache *abbrev_cache)
{
struct objfile *objfile = per_objfile.objfile;
struct dwarf2_section_info *section = this_cu.section;
@@ -3030,7 +3030,7 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
indexer. This assert is avoided in this case because (1) it
is irrelevant, and (2) the get_cu method is not
thread-safe. */
- gdb_assert (cache != nullptr
+ gdb_assert (abbrev_cache != nullptr
|| per_objfile.get_cu (&this_cu) == nullptr);
m_new_cu = std::make_unique<dwarf2_cu> (&this_cu, &per_objfile);
cu = m_new_cu.get ();
@@ -3092,9 +3092,9 @@ cutu_reader::cutu_reader (dwarf2_per_cu &this_cu,
gdb_assert (cu->header.abbrev_sect_off == abbrev_table->sect_off);
else
{
- if (cache != nullptr)
- abbrev_table = cache->find (abbrev_section,
- cu->header.abbrev_sect_off);
+ if (abbrev_cache != nullptr)
+ abbrev_table = abbrev_cache->find (abbrev_section,
+ cu->header.abbrev_sect_off);
if (abbrev_table == nullptr)
{
abbrev_section->read (objfile);
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index 7f56dac..b13e42d 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -927,7 +927,7 @@ public:
dwarf2_cu *existing_cu,
bool skip_partial,
enum language pretend_language,
- const abbrev_table_cache *cache = nullptr);
+ const abbrev_table_cache *abbrev_cache = nullptr);
cutu_reader (dwarf2_per_cu &this_cu,
dwarf2_per_objfile &per_objfile,