aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/cooked-index.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/dwarf2/cooked-index.c')
-rw-r--r--gdb/dwarf2/cooked-index.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c
index a632474..6209590 100644
--- a/gdb/dwarf2/cooked-index.c
+++ b/gdb/dwarf2/cooked-index.c
@@ -1,6 +1,6 @@
/* DIE indexing
- Copyright (C) 2022-2024 Free Software Foundation, Inc.
+ Copyright (C) 2022-2025 Free Software Foundation, Inc.
This file is part of GDB.
@@ -20,14 +20,11 @@
#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 "maint.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 +79,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,17 +91,23 @@ 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 ();
- finalizers.add_task ([=] () { this_shard->finalize (parent_maps); });
+ const parent_map_map *parent_maps = m_state->get_parent_map_map ();
+ finalizers.add_task ([=] ()
+ {
+ scoped_time_it time_it ("DWARF finalize worker",
+ m_state->m_per_command_time);
+ this_shard->finalize (parent_maps);
+ });
}
finalizers.start ();
@@ -326,9 +327,7 @@ maintenance_wait_for_index_cache (const char *args, int from_tty)
wait_for_index_cache (0);
}
-void _initialize_cooked_index ();
-void
-_initialize_cooked_index ()
+INIT_GDB_FILE (cooked_index)
{
add_cmd ("wait-for-index-cache", class_maintenance,
maintenance_wait_for_index_cache, _("\