public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "palves at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/17247] gdb freezes on multi threaded app (test-case attached)
Date: Thu, 28 Aug 2014 08:28:00 -0000	[thread overview]
Message-ID: <bug-17247-4717-APhfOSkQ30@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-17247-4717@http.sourceware.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.


  parent reply	other threads:[~2014-08-28  8:28 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09 13:35 [Bug gdb/17247] New: " glibc at iamsergio dot de
2014-08-09 20:26 ` [Bug gdb/17247] " mail at milianw dot de
2014-08-09 20:28 ` mail at milianw dot de
2014-08-10  0:54 ` philip.rebohle@tu-dortmund.de
2014-08-11  6:18 ` xdje42 at gmail dot com
2014-08-11 10:12 ` mail at milianw dot de
2014-08-12  8:43 ` kugel at rockbox dot org
2014-08-16 21:39 ` ideasman42 at gmail dot com
2014-08-17  2:47 ` net147 at gmail dot com
2014-08-18 14:14 ` rggjan at gmail dot com
2014-08-18 22:17 ` dje at google dot com
2014-08-18 23:10 ` dje at google dot com
2014-08-21  9:34 ` nimajnebwild at gmail dot com
2014-08-23 13:26 ` bernd.amend at gmail dot com
2014-08-23 16:07 ` dje at google dot com
2014-08-23 16:19 ` bernd.amend at gmail dot com
2014-08-23 21:11 ` kugel at rockbox dot org
2014-08-23 21:28 ` philip.rebohle@tu-dortmund.de
2014-08-23 21:37 ` xdje42 at gmail dot com
2014-08-23 21:39 ` xdje42 at gmail dot com
2014-08-23 21:42 ` kugel at rockbox dot org
2014-08-23 21:59 ` xdje42 at gmail dot com
2014-08-23 22:13 ` xdje42 at gmail dot com
2014-08-23 22:22 ` xdje42 at gmail dot com
2014-08-23 22:51 ` philip.rebohle@tu-dortmund.de
2014-08-23 22:56 ` philip.rebohle@tu-dortmund.de
2014-08-23 23:07 ` xdje42 at gmail dot com
2014-08-24  3:41 ` bernd.amend at gmail dot com
2014-08-24 11:40 ` mail at milianw dot de
2014-08-25 13:02 ` chenmulong at gmail dot com
2014-08-25 17:30 ` evgeny.grablyk at gmail dot com
2014-08-25 17:34 ` evgeny.grablyk at gmail dot com
2014-08-26  7:57 ` xdje42 at gmail dot com
2014-08-28  5:50 ` xdje42 at gmail dot com
2014-08-28  5:51 ` xdje42 at gmail dot com
2014-08-28  5:52 ` xdje42 at gmail dot com
2014-08-28  5:53 ` xdje42 at gmail dot com
2014-08-28  8:28 ` palves at redhat dot com [this message]
2014-08-28 10:53 ` corinna at vinschen dot de
2014-08-28 11:52 ` jaap at jcz dot nl
2014-08-29 20:43 ` evgeny.grablyk at gmail dot com
2014-08-31  0:41 ` xdje42 at gmail dot com
2014-08-31 17:27 ` xdje42 at gmail dot com
2014-08-31 18:58 ` rosslagerwall at gmail dot com
2014-09-01 13:44 ` corinna at vinschen dot de
2014-09-09  5:50 ` cvs-commit at gcc dot gnu.org
2014-09-10  4:47 ` cvs-commit at gcc dot gnu.org
2014-09-11 15:59 ` xdje42 at gmail dot com
2014-09-11 18:29 ` kbrown at cornell dot edu
2014-10-29 19:48 ` cvs-commit at gcc dot gnu.org
2021-09-28  2:45 ` dianeBerlusconi at gmail dot com
2021-10-21  6:54 ` bap.fayol at gmail dot com
2021-10-25  8:57 ` jameszen29 at gmail dot com
2021-10-25  9:14 ` nimajnebwild at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-17247-4717-APhfOSkQ30@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).