From 9d1447e09d4aa673826039321163b5a684e8e043 Mon Sep 17 00:00:00 2001 From: Sergio Durigan Junior Date: Fri, 29 Mar 2019 17:34:54 -0400 Subject: Destroy allocated values when exiting GDB When the user exits GDB, we might still have some allocated values in the chain, which, in specific scenarios, can cause problems when GDB attempts to destroy them in "quit_force". For example, see the bug reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1690120 And the thread starting at: https://sourceware.org/ml/gdb-patches/2019-03/msg00475.html Message-ID: <87r2azkhmq.fsf@redhat.com> In order to avoid that, and to be more aware of our allocated resources, this commit implements a new function "finalize_values" and calls it from inside "quit_force". Tested by the BuildBot. 2019-04-01 Sergio Durigan Junior Pedro Alves * top.c (quit_force): Call 'finalize_values'. * value.c (finalize_values): New function. * value.h (finalize_values): Declare. --- gdb/value.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gdb/value.c') diff --git a/gdb/value.c b/gdb/value.c index dc297dfe0f9..bcfc084e090 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 (); +} -- cgit v1.2.1