aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorAndy Wingo <wingo@igalia.com>2015-03-11 13:07:53 +0100
committerAndy Wingo <wingo@igalia.com>2015-03-11 13:07:53 +0100
commit92fab5a61707cd3b487219ea9efa0e410cde3bc4 (patch)
tree809ea0e4bc4e5c49afd066aea5cbf5372b72f055 /gdb/guile
parente03f96456f2313854efff2377134af6cbda96af8 (diff)
downloadgdb-92fab5a61707cd3b487219ea9efa0e410cde3bc4.zip
gdb-92fab5a61707cd3b487219ea9efa0e410cde3bc4.tar.gz
gdb-92fab5a61707cd3b487219ea9efa0e410cde3bc4.tar.bz2
[guile] Run finalizers from GDB thread
gdb/ChangeLog: * guile/guile.c (_initialize_guile): Disable automatic finalization, if Guile offers us that possibility. * guile/guile.c (call_initialize_gdb_module): * guile/scm-safe-call.c (gdbscm_with_catch): Arrange to run finalizers in appropriate places. * config.in (HAVE_GUILE_MANUAL_FINALIZATION): New definition. * configure.ac (AC_TRY_LIBGUILE): Add a check for scm_set_automatic_finalization_enabled. * configure: Regenerated.
Diffstat (limited to 'gdb/guile')
-rw-r--r--gdb/guile/guile.c11
-rw-r--r--gdb/guile/scm-safe-call.c4
2 files changed, 15 insertions, 0 deletions
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 16d15b7..4abf5c5 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -704,6 +704,10 @@ call_initialize_gdb_module (void *data)
performed within the desired module. */
scm_c_define_module (gdbscm_module_name, initialize_gdb_module, NULL);
+#if HAVE_GUILE_MANUAL_FINALIZATION
+ scm_run_finalizers ();
+#endif
+
return NULL;
}
@@ -850,6 +854,13 @@ _initialize_guile (void)
side to define module "gdb" which imports "_gdb". There is evidently no
similar convention in Guile so we skip this. */
+#if HAVE_GUILE_MANUAL_FINALIZATION
+ /* Our SMOB free functions are not thread-safe, as GDB itself is not
+ intended to be thread-safe. Disable automatic finalization so that
+ finalizers aren't run in other threads. */
+ scm_set_automatic_finalization_enabled (0);
+#endif
+
#ifdef HAVE_SIGPROCMASK
/* Before we initialize Guile, block SIGCHLD.
This is done so that all threads created during Guile initialization
diff --git a/gdb/guile/scm-safe-call.c b/gdb/guile/scm-safe-call.c
index 9255556..6052214 100644
--- a/gdb/guile/scm-safe-call.c
+++ b/gdb/guile/scm-safe-call.c
@@ -155,6 +155,10 @@ gdbscm_with_catch (void *data)
d->unwind_handler, d,
d->pre_unwind_handler, d);
+#if HAVE_GUILE_MANUAL_FINALIZATION
+ scm_run_finalizers ();
+#endif
+
return NULL;
}