Hi. I think(!) I understand why gdb is hanging when used with libgc 7.4.x. This is gdb bug 17247. https://sourceware.org/bugzilla/show_bug.cgi?id=17247#c30
First, libgc 7.4.x was the first release to default PARALLEL_MARK to on, so I'm guessing the same "bug" exists in 7.2, it's just not visible unless one builds libgc with --enable-parallel-mark. gdb/linux-nat.c calls sigsuspend when the inferior is running and gdb needs to wait for it to stop. gdb is waiting on a SIGCHLD at this point. However, if the SIGCHLD goes to a different thread, say the guile finalizer thread or a libgc marker thread then the sigsuspend that gdb calls doesn't wake up and gdb is hung. So question: Any suggestions for how to approach this? Here's the hack that I applied to Guile to see if this removes the gdb hang. I'm not suggesting checking this in. It's just data to help advance the discussion. I think there's a general issue here that these threads should block every signal they're not expecting, or at least provide a hook to let the app specify which signals to block. gdb's need to use SIGCHLD is just one example of a general problem. diff --git a/libguile/finalizers.c b/libguile/finalizers.c index 82f292c..95a022c 100644 --- a/libguile/finalizers.c +++ b/libguile/finalizers.c @@ -239,6 +239,12 @@ finalization_thread_proc (void *unused) static void* run_finalization_thread (void *arg) { + { + sigset_t blocked_mask; + sigemptyset (&blocked_mask); + sigaddset (&blocked_mask, SIGCHLD); + sigprocmask (SIG_BLOCK, &blocked_mask, NULL); + } return scm_with_guile (finalization_thread_proc, arg); }