This is the mail archive of the
gdb-prs@sourceware.org
mailing list for the GDB project.
[Bug gdb/17247] gdb freezes on multi threaded app (test-case attached)
- From: "palves at redhat dot com" <sourceware-bugzilla at sourceware dot org>
- To: gdb-prs at sourceware dot org
- Date: Thu, 28 Aug 2014 08:27:58 +0000
- Subject: [Bug gdb/17247] gdb freezes on multi threaded app (test-case attached)
- Auto-submitted: auto-generated
- References: <bug-17247-4717 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=17247
Pedro Alves <palves at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |palves at redhat dot com
--- Comment #33 from Pedro Alves <palves at redhat dot com> ---
Comment on attachment 7762
--> https://sourceware.org/bugzilla/attachment.cgi?id=7762
17247-experiment-1.patch
> +#ifdef HAVE_SIGPROCMASK
> + /* Before we initialize Guile, block SIGCHLD.
> + This is done so that all threads created during Guile initialization
> + have SIGCHLD blocked. PR 17247. */
> + sigprocmask (SIG_SETMASK, NULL, &sigset_for_guile);
> + sigaddset (&sigset_for_guile, SIGCHLD);
> + sigprocmask (SIG_SETMASK, &sigset_for_guile, NULL);
Using SIG_BLOCK lets this be a single syscall.
> +#endif
> +
> /* scm_with_guile is the most portable way to initialize Guile.
> Plus we need to initialize the Guile support while in Guile mode
> (e.g., called from within a call to scm_with_guile). */
> scm_with_guile (call_initialize_gdb_module, NULL);
>
> +#ifdef HAVE_SIGPROCMASK
> + /* Undo the blocking of SIGCHLD. */
> + sigdelset (&sigset_for_guile, SIGCHLD);
> + sigprocmask (SIG_SETMASK, &sigset_for_guile, NULL);
This assumes SIGCHLD wasn't blocked before. Best avoid that, like
in the below pseudo-patch.
+ sigset_t sigchld_set, prev_set;
...
+#ifdef HAVE_SIGPROCMASK
+ /* Before we initialize Guile, make sure SIGCHLD is blocked.
+ This is done so that all threads created during Guile initialization
+ have SIGCHLD blocked. PR 17247. */
+ sigemptyset (sigchld_set);
+ sigaddset (&sigchld_set, SIGCHLD);
+ sigprocmask (SIG_BLOCK, &sigchld_set, &prev_set);
+#endif
...
+#ifdef HAVE_SIGPROCMASK
+ /* Restore the previous mask. */
+ sigprocmask (SIG_SETMASK, &prev_set, NULL);
+#endif
--
You are receiving this mail because:
You are on the CC list for the bug.