aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/top.c6
-rw-r--r--gdb/value.c8
-rw-r--r--gdb/value.h4
4 files changed, 25 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index a3dfd31..3de5992 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2019-04-01 Sergio Durigan Junior <sergiodj@redhat.com>
+ Pedro Alves <palves@redhat.com>
+
+ * top.c (quit_force): Call 'finalize_values'.
+ * value.c (finalize_values): New function.
+ * value.h (finalize_values): Declare.
+
2019-03-30 Eli Zaretskii <eliz@gnu.org>
* NEWS: Announce $_gdb_major and $_gdb_minor.
diff --git a/gdb/top.c b/gdb/top.c
index afb77c0..1fc259f 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1673,6 +1673,12 @@ quit_force (int *exit_arg, int from_tty)
}
END_CATCH
+ /* Destroy any values currently allocated now instead of leaving it
+ to global destructors, because that may be too late. For
+ example, the destructors of xmethod values call into the Python
+ runtime, which is finalized via a final cleanup. */
+ finalize_values ();
+
/* Do any final cleanups before exiting. */
TRY
{
diff --git a/gdb/value.c b/gdb/value.c
index dc297df..bcfc084 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -4132,3 +4132,11 @@ prevents future values, larger than this size, from being allocated."),
selftests::test_insert_into_bit_range_vector);
#endif
}
+
+/* See value.h. */
+
+void
+finalize_values ()
+{
+ all_values.clear ();
+}
diff --git a/gdb/value.h b/gdb/value.h
index d3905cc..0756d13 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1189,4 +1189,8 @@ extern struct value *call_xmethod (struct value *method,
extern int value_union_variant (struct type *union_type,
const gdb_byte *contents);
+/* Destroy the values currently allocated. This is called when GDB is
+ exiting (e.g., on quit_force). */
+extern void finalize_values ();
+
#endif /* !defined (VALUE_H) */