PERFORCE change 55903 for review
David Xu
davidxu at FreeBSD.org
Sun Jun 27 05:40:01 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=55903
Change 55903 by davidxu at 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:
More information about the p4-projects
mailing list