aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog8
-rw-r--r--gdb/ada-tasks.c26
2 files changed, 32 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ac29a32..65d6548 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,11 @@
+2019-02-18 Philippe Waroquiers <philippe.waroquiers@skynet.be>
+
+ * ada-task.c (_initialize_tasks): Use 'with_cleanup' register
+ variant for ada_tasks_pspace_data_handle and
+ ada_tasks_inferior_data_handle.
+ (ada_tasks_pspace_data_cleanup): New function.
+ (ada_tasks_inferior_data_cleanup): New function.
+
2019-02-17 Tom Tromey <tom@tromey.com>
* macrotab.h (macro_source_fullname): Return a std::string.
diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index e994147..440e32b 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -161,6 +161,15 @@ struct ada_tasks_pspace_data
/* Key to our per-program-space data. */
static const struct program_space_data *ada_tasks_pspace_data_handle;
+/* A cleanup routine for our per-program-space data. */
+static void
+ada_tasks_pspace_data_cleanup (struct program_space *pspace, void *arg)
+{
+ struct ada_tasks_pspace_data *data
+ = (struct ada_tasks_pspace_data *) arg;
+ xfree (data);
+}
+
/* The kind of data structure used by the runtime to store the list
of Ada tasks. */
@@ -285,6 +294,15 @@ get_ada_tasks_inferior_data (struct inferior *inf)
return data;
}
+/* A cleanup routine for our per-inferior data. */
+static void
+ada_tasks_inferior_data_cleanup (struct inferior *inf, void *arg)
+{
+ struct ada_tasks_inferior_data *data
+ = (struct ada_tasks_inferior_data *) arg;
+ delete data;
+}
+
/* Return the task number of the task whose thread is THREAD, or zero
if the task could not be found. */
@@ -1414,8 +1432,12 @@ ada_tasks_new_objfile_observer (struct objfile *objfile)
void
_initialize_tasks (void)
{
- ada_tasks_pspace_data_handle = register_program_space_data ();
- ada_tasks_inferior_data_handle = register_inferior_data ();
+ ada_tasks_pspace_data_handle
+ = register_program_space_data_with_cleanup (NULL,
+ ada_tasks_pspace_data_cleanup);
+ ada_tasks_inferior_data_handle
+ = register_inferior_data_with_cleanup (NULL,
+ ada_tasks_inferior_data_cleanup);
/* Attach various observers. */
gdb::observers::normal_stop.attach (ada_tasks_normal_stop_observer);