From owner-p4-projects@FreeBSD.ORG Sun Jun 27 05:40:01 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id EF6AD16A4D0; Sun, 27 Jun 2004 05:40:00 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CA80B16A4CE for ; Sun, 27 Jun 2004 05:40:00 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id ACA7A43D1F for ; Sun, 27 Jun 2004 05:40:00 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i5R5dpPY090408 for ; Sun, 27 Jun 2004 05:39:51 GMT (envelope-from davidxu@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5R5dpOx090405 for perforce@freebsd.org; Sun, 27 Jun 2004 05:39:51 GMT (envelope-from davidxu@freebsd.org) Date: Sun, 27 Jun 2004 05:39:51 GMT Message-Id: <200406270539.i5R5dpOx090405@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to davidxu@freebsd.org using -f From: David Xu To: Perforce Change Reviews Subject: PERFORCE change 55903 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Jun 2004 05:40:01 -0000 http://perforce.freebsd.org/chv.cgi?CH=55903 Change 55903 by davidxu@davidxu_alona on 2004/06/27 05:39:46 Give debugger a chance to check signal. SIGINFO should work to dump thread info. Affected files ... .. //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_sig.c#2 edit Differences ... ==== //depot/projects/davidxu_ksedbg/src/lib/libpthread/thread/thr_sig.c#2 (text+ko) ==== @@ -347,6 +347,11 @@ err_save = errno; timeout_save = curthread->timeout; intr_save = curthread->interrupted; + /* Check if the signal requires a dump of thread information: */ + if (sig == SIGINFO) { + /* Dump thread information to file: */ + _thread_dump_info(); + } _kse_critical_enter(); /* Get a fresh copy of signal mask */ __sys_sigprocmask(SIG_BLOCK, NULL, &curthread->sigmask); @@ -505,6 +510,12 @@ { _kse_critical_leave(&curthread->tcb->tcb_tmbx); + /* Check if the signal requires a dump of thread information: */ + if (shi->sig == SIGINFO) { + /* Dump thread information to file: */ + _thread_dump_info(); + } + if (((__sighandler_t *)shi->sigfunc != SIG_DFL) && ((__sighandler_t *)shi->sigfunc != SIG_IGN)) { if ((shi->sa_flags & SA_SIGINFO) != 0 || shi->info == NULL) @@ -695,12 +706,18 @@ kse_wakeup(kmbx); return (NULL); } else if (!SIGISMEMBER(pthread->sigmask, sig)) { - sigfunc = _thread_sigact[sig - 1].sa_sigaction; - if ((__sighandler_t *)sigfunc == SIG_DFL) { - if (sigprop(sig) & SA_KILL) { - kse_thr_interrupt(NULL, - KSE_INTR_SIGEXIT, sig); - /* Never reach */ + /* + * If debugger is running, we don't quick exit, + * and give it a chance to check the signal. + */ + if (_libkse_debug == 0) { + sigfunc = _thread_sigact[sig - 1].sa_sigaction; + if ((__sighandler_t *)sigfunc == SIG_DFL) { + if (sigprop(sig) & SA_KILL) { + kse_thr_interrupt(NULL, + KSE_INTR_SIGEXIT, sig); + /* Never reach */ + } } } if (pthread->state == PS_SIGSUSPEND) { @@ -1198,13 +1215,8 @@ __sys_sigprocmask(SIG_SETMASK, &sigset, &_thr_initial->sigmask); /* Enter a loop to get the existing signal status: */ for (i = 1; i <= _SIG_MAXSIG; i++) { - /* Check for signals which cannot be trapped: */ - if (i == SIGKILL || i == SIGSTOP) { - } - /* Get the signal handler details: */ - else if (__sys_sigaction(i, NULL, - &_thread_sigact[i - 1]) != 0) { + if (__sys_sigaction(i, NULL, &_thread_sigact[i - 1]) != 0) { /* * Abort this process if signal * initialisation fails: