aboutsummaryrefslogtreecommitdiff
path: root/gdb/dummy-frame.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2015-05-13 20:47:32 +0200
committerJan Kratochvil <jan.kratochvil@redhat.com>2015-05-13 20:47:32 +0200
commit5e9705017f5b257421136b8d7752b9c793335ace (patch)
treeda7d4b8b721cbf9529eea378a337fcf3e625b8ea /gdb/dummy-frame.c
parent1c4eb778a28447d764235b8810d382b40b2a054c (diff)
Call dummy_frame_dtor_ftype also from remove_dummy_frame
There was now a leak-like bug that if dummy_frame "disappeared" by remove_dummy_frame then its destructor was not called. For example in the case of 'compile code' dummy frames the injected objfile would never get freed after some inferior longjmp out of the injected code. gdb/ChangeLog 2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com> * compile/compile-object-run.c (do_module_cleanup): Add parameter registers_valid. (compile_object_run): Update do_module_cleanup caller. * dummy-frame.c: Include infcall.h. (struct dummy_frame): Update dtor comment. (remove_dummy_frame): Call dtor. (pop_dummy_frame): Update dtor caller. * dummy-frame.h (dummy_frame_dtor_ftype): Add parameter registers_valid.
Diffstat (limited to 'gdb/dummy-frame.c')
-rw-r--r--gdb/dummy-frame.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index f193289aed..6c4fb4c6b4 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -28,6 +28,7 @@
#include "gdbcmd.h"
#include "observer.h"
#include "gdbthread.h"
+#include "infcall.h"
struct dummy_frame_id
{
@@ -62,8 +63,7 @@ struct dummy_frame
/* The caller's state prior to the call. */
struct infcall_suspend_state *caller_state;
- /* If non-NULL, a destructor that is run when this dummy frame is
- popped. */
+ /* If non-NULL, a destructor that is run when this dummy frame is freed. */
dummy_frame_dtor_ftype *dtor;
/* Arbitrary data that is passed to DTOR. */
@@ -96,6 +96,9 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr)
{
struct dummy_frame *dummy = *dummy_ptr;
+ if (dummy->dtor != NULL)
+ dummy->dtor (dummy->dtor_data, 0);
+
*dummy_ptr = dummy->next;
discard_infcall_suspend_state (dummy->caller_state);
xfree (dummy);
@@ -136,7 +139,7 @@ pop_dummy_frame (struct dummy_frame **dummy_ptr)
gdb_assert (ptid_equal (dummy->id.ptid, inferior_ptid));
if (dummy->dtor != NULL)
- dummy->dtor (dummy->dtor_data);
+ dummy->dtor (dummy->dtor_data, 1);
restore_infcall_suspend_state (dummy->caller_state);