• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisión5e9705017f5b257421136b8d7752b9c793335ace (tree)
Tiempo2015-05-14 03:47:32
AutorJan Kratochvil <jan.kratochvil@redh...>
CommiterJan Kratochvil

Log Message

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.

Cambiar Resumen

Diferencia incremental

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,15 @@
1+2015-05-13 Jan Kratochvil <jan.kratochvil@redhat.com>
2+
3+ * compile/compile-object-run.c (do_module_cleanup): Add parameter
4+ registers_valid.
5+ (compile_object_run): Update do_module_cleanup caller.
6+ * dummy-frame.c: Include infcall.h.
7+ (struct dummy_frame): Update dtor comment.
8+ (remove_dummy_frame): Call dtor.
9+ (pop_dummy_frame): Update dtor caller.
10+ * dummy-frame.h (dummy_frame_dtor_ftype): Add parameter
11+ registers_valid.
12+
113 2015-05-13 Joel Brobecker <brobecker@adacore.com>
214
315 GDB 7.9.1 released.
--- a/gdb/compile/compile-object-run.c
+++ b/gdb/compile/compile-object-run.c
@@ -45,7 +45,7 @@ struct do_module_cleanup
4545
4646 static dummy_frame_dtor_ftype do_module_cleanup;
4747 static void
48-do_module_cleanup (void *arg)
48+do_module_cleanup (void *arg, int registers_valid)
4949 {
5050 struct do_module_cleanup *data = arg;
5151 struct objfile *objfile;
@@ -129,7 +129,7 @@ compile_object_run (struct compile_module *module)
129129 data->executedp = NULL;
130130 gdb_assert (!(dtor_found && executed));
131131 if (!dtor_found && !executed)
132- do_module_cleanup (data);
132+ do_module_cleanup (data, 0);
133133 throw_exception (ex);
134134 }
135135 END_CATCH
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -28,6 +28,7 @@
2828 #include "gdbcmd.h"
2929 #include "observer.h"
3030 #include "gdbthread.h"
31+#include "infcall.h"
3132
3233 struct dummy_frame_id
3334 {
@@ -62,8 +63,7 @@ struct dummy_frame
6263 /* The caller's state prior to the call. */
6364 struct infcall_suspend_state *caller_state;
6465
65- /* If non-NULL, a destructor that is run when this dummy frame is
66- popped. */
66+ /* If non-NULL, a destructor that is run when this dummy frame is freed. */
6767 dummy_frame_dtor_ftype *dtor;
6868
6969 /* Arbitrary data that is passed to DTOR. */
@@ -96,6 +96,9 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr)
9696 {
9797 struct dummy_frame *dummy = *dummy_ptr;
9898
99+ if (dummy->dtor != NULL)
100+ dummy->dtor (dummy->dtor_data, 0);
101+
99102 *dummy_ptr = dummy->next;
100103 discard_infcall_suspend_state (dummy->caller_state);
101104 xfree (dummy);
@@ -136,7 +139,7 @@ pop_dummy_frame (struct dummy_frame **dummy_ptr)
136139 gdb_assert (ptid_equal (dummy->id.ptid, inferior_ptid));
137140
138141 if (dummy->dtor != NULL)
139- dummy->dtor (dummy->dtor_data);
142+ dummy->dtor (dummy->dtor_data, 1);
140143
141144 restore_infcall_suspend_state (dummy->caller_state);
142145
--- a/gdb/dummy-frame.h
+++ b/gdb/dummy-frame.h
@@ -54,8 +54,9 @@ extern void dummy_frame_discard (struct frame_id dummy_id, ptid_t ptid);
5454
5555 extern const struct frame_unwind dummy_frame_unwind;
5656
57-/* Destructor for dummy_frame. DATA is supplied by registrant. */
58-typedef void (dummy_frame_dtor_ftype) (void *data);
57+/* Destructor for dummy_frame. DATA is supplied by registrant.
58+ REGISTERS_VALID is 1 for dummy_frame_pop, 0 for dummy_frame_discard. */
59+typedef void (dummy_frame_dtor_ftype) (void *data, int registers_valid);
5960
6061 /* Call DTOR with DTOR_DATA when DUMMY_ID frame of thread PTID gets discarded.
6162 Dummy frame with DUMMY_ID must exist. There must be no other call of