[gdb] Don't create registry keys in destructor

Creating a registry key using emplace calls new:
...
      DATA *result = new DATA (std::forward<Args> (args)...);
...
which can throw a bad alloc, which will terminate gdb if called from a
destructor.

Fix this in a few places.

Tested on aarch64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Tom de Vries
2024-10-26 08:40:07 +02:00
parent b3ee98cda4
commit 5a43f7f040
6 changed files with 34 additions and 20 deletions

View File

@@ -1447,7 +1447,7 @@ ada_task_list_changed (struct inferior *inf)
static void
ada_tasks_invalidate_pspace_data (struct program_space *pspace)
{
get_ada_tasks_pspace_data (pspace)->initialized_p = 0;
ada_tasks_pspace_data_handle.clear (pspace);
}
/* Invalidate the per-inferior data. */
@@ -1455,10 +1455,7 @@ ada_tasks_invalidate_pspace_data (struct program_space *pspace)
static void
ada_tasks_invalidate_inferior_data (struct inferior *inf)
{
struct ada_tasks_inferior_data *data = get_ada_tasks_inferior_data (inf);
data->known_tasks_kind = ADA_TASKS_UNKNOWN;
data->task_list_valid_p = false;
ada_tasks_inferior_data_handle.clear (inf);
}
/* The 'normal_stop' observer notification callback. */