From patchwork Sat Aug 29 17:22:11 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 8510 Received: (qmail 77060 invoked by alias); 29 Aug 2015 17:23:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 77050 invoked by uid 89); 29 Aug 2015 17:23:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.3 required=5.0 tests=AWL, BAYES_00, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, MALFORMED_FREEMAIL, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-pa0-f54.google.com Received: from mail-pa0-f54.google.com (HELO mail-pa0-f54.google.com) (209.85.220.54) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Sat, 29 Aug 2015 17:23:13 +0000 Received: by pabzx8 with SMTP id zx8so94038181pab.1 for ; Sat, 29 Aug 2015 10:23:11 -0700 (PDT) X-Received: by 10.68.250.5 with SMTP id yy5mr25032215pbc.34.1440868991673; Sat, 29 Aug 2015 10:23:11 -0700 (PDT) Received: from seba.sebabeach.org.gmail.com (173-13-178-53-sfba.hfc.comcastbusiness.net. [173.13.178.53]) by smtp.gmail.com with ESMTPSA id j5sm9227231pdi.7.2015.08.29.10.23.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Aug 2015 10:23:11 -0700 (PDT) From: Doug Evans To: gdb-patches@sourceware.org Subject: [RFC] Block all async signals used by gdb when initializing Guile cc: guile-devel@gnu.org Date: Sat, 29 Aug 2015 10:22:11 -0700 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi. When Guile initializes it will start several GC threads (libgc). It's important that these threads block SIGCHLD (PR 17247). This patch extends this to all async signals used by gdb. One improvement on this patch would be to have event-top.c (or some such) provide a routine that calls sigaddset for each appropriate signal rather than defining the list in guile.c. 2015-08-29 Doug Evans * guile/guile.c (_initialize_guile): Block all asynchronous signals used by gdb when initializing Guile. diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c index 4abf5c5..e9ef70b 100644 --- a/gdb/guile/guile.c +++ b/gdb/guile/guile.c @@ -847,7 +847,7 @@ _initialize_guile (void) #if HAVE_GUILE { #ifdef HAVE_SIGPROCMASK - sigset_t sigchld_mask, prev_mask; + sigset_t guile_init_mask, prev_mask; #endif /* The Python support puts the C side in module "_gdb", leaving the Python @@ -867,9 +867,23 @@ _initialize_guile (void) have SIGCHLD blocked. PR 17247. Really libgc and Guile should do this, but we need to work with libgc 7.4.x. */ - sigemptyset (&sigchld_mask); - sigaddset (&sigchld_mask, SIGCHLD); - sigprocmask (SIG_BLOCK, &sigchld_mask, &prev_mask); + sigemptyset (&guile_init_mask); + sigaddset (&guile_init_mask, SIGCHLD); + /* Also block other asynchronous signals used by GDB. See event-top.c. + Really we want to block every signal here except for those specifically + used by Guile (e.g., GC threads), but this is safer for now. */ + sigaddset (&guile_init_mask, SIGINT); + sigaddset (&guile_init_mask, SIGTERM); +#ifdef SIGQUIT + sigaddset (&guile_init_mask, SIGQUIT); +#endif +#ifdef SIGHUP + sigaddset (&guile_init_mask, SIGHUP); +#endif +#ifdef SIGWINCH + sigaddset (&guile_init_mask, SIGWINCH); +#endif + sigprocmask (SIG_BLOCK, &guile_init_mask, &prev_mask); #endif /* scm_with_guile is the most portable way to initialize Guile.