signal, and replace lookups in signalent[] with calls to it.
extern int setbpt P((struct tcb *));
extern int sigishandled P((struct tcb *, int));
extern void printcall P((struct tcb *));
+extern char *signame P((int));
extern void printsignal P((int));
extern void printleader P((struct tcb *));
extern void printtrailer P((struct tcb *));
*/
if (WIFSTOPPED(status))
tprintf("[WIFSTOPPED(s) && WSTOPSIG(s) == %s]",
- signalent[WSTOPSIG(status)]);
+ signame(WSTOPSIG(status)));
else if WIFSIGNALED(status)
tprintf("[WIFSIGNALED(s) && WTERMSIG(s) == %s%s]",
- signalent[WTERMSIG(status)],
+ signame(WTERMSIG(status)),
WCOREDUMP(status) ? " && WCOREDUMP(s)" : "");
else if WIFEXITED(status) {
tprintf("[WIFEXITED(s) && WEXITSTATUS(s) == %d]",
#endif /* HAVE_SIGACTION */
+/* Anonymous realtime signals. */
+/* Under glibc 2.1, SIGRTMIN et al are functions, but __SIGRTMIN is a
+ constant. This is what we want. Otherwise, just use SIGRTMIN. */
+#ifdef SIGRTMIN
+#ifndef __SIGRTMIN
+#define __SIGRTMIN SIGRTMIN
+#define __SIGRTMAX SIGRTMAX /* likewise */
+#endif
+#endif
+
+char *
+signame(sig)
+int sig;
+{
+ static char buf[30];
+ if (sig < nsignals) {
+ return signalent[sig];
+#ifdef SIGRTMIN
+ } else if (sig <= __SIGRTMIN && sig <= __SIGRTMAX) {
+ sprintf(buf, "SIGRT_%d", sig);
+ return buf;
+#endif /* SIGRTMIN */
+ } else {
+ sprintf(buf, "%d", sig);
+ return buf;
+ }
+}
static char *
sprintsigmask(s, mask)
*s++ = '[';
for (i = 1; i < nsignals; i++) {
if (sigismember(mask, i) == 1) {
- sprintf(s, format, signalent[i] + 3); s += strlen(s);
+ sprintf(s, format, signame(i) + 3); s += strlen(s);
format = " %s";
}
}
printsignal(nr)
int nr;
{
- if (nr > 0 && nr < nsignals)
- tprintf("%s", signalent[nr]);
- else
- tprintf("%d", nr);
+ tprintf(signame(nr));
}
/*
struct tcb *tcp;
{
if (entering(tcp)) {
- long sig = tcp->u_arg[1];
-
- if (sig >= 0 && sig < NSIG)
- tprintf("%ld, %s", tcp->u_arg[0], signalent[sig]);
- else
- tprintf("%ld, %ld", tcp->u_arg[0], sig);
+ tprintf("%ld, %s", tcp->u_arg[0], signame(tcp->u_arg[1]));
}
return 0;
}
if (!cflag && (qual_flags[what] & QUAL_SIGNAL)) {
printleader(tcp);
tprintf("--- %s (%s) ---",
- signalent[what], strsignal(what));
+ signame(what), strsignal(what));
printtrailer(tcp);
}
break;
&& (qual_flags[WTERMSIG(status)] & QUAL_SIGNAL)) {
printleader(tcp);
tprintf("+++ killed by %s +++",
- signalent[WTERMSIG(status)]);
+ signame(WTERMSIG(status)));
printtrailer(tcp);
}
droptcb(tcp);
}
if (debug)
fprintf(stderr, "pid %u stopped, [%s]\n",
- pid, signalent[WSTOPSIG(status)]);
+ pid, signame(WSTOPSIG(status)));
if (tcp->flags & TCB_STARTUP) {
/*
&& (qual_flags[WSTOPSIG(status)] & QUAL_SIGNAL)) {
printleader(tcp);
tprintf("--- %s (%s) ---",
- signalent[WSTOPSIG(status)],
+ signame(WSTOPSIG(status)),
strsignal(WSTOPSIG(status)));
printtrailer(tcp);
}
if (strncmp(s, "SIG", 3) == 0)
s += 3;
for (i = 0; i <= NSIG; i++) {
- if (strcmp(s, signalent[i] + 3) == 0)
+ if (strcmp(s, signame(i) + 3) == 0)
return i;
}
return -1;