From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22269 invoked by alias); 28 Aug 2014 08:28:02 -0000 Mailing-List: contact gdb-prs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-prs-owner@sourceware.org Received: (qmail 21753 invoked by uid 48); 28 Aug 2014 08:28:01 -0000 From: "palves at redhat dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: 7.7 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: palves at redhat dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: xdje42 at gmail dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-q3/txt/msg00368.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17247 Pedro Alves changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |palves at redhat dot com --- Comment #33 from Pedro Alves --- 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.