kdump: Pretty-print signal codes.
MFC after: 1 week
This commit is contained in:
parent
787a64ddd2
commit
5677eef9a7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=240820
@ -1242,11 +1242,15 @@ ktrpsig(struct ktr_psig *psig)
|
|||||||
printf("SIG%s ", signames[psig->signo]);
|
printf("SIG%s ", signames[psig->signo]);
|
||||||
else
|
else
|
||||||
printf("SIG %d ", psig->signo);
|
printf("SIG %d ", psig->signo);
|
||||||
if (psig->action == SIG_DFL)
|
if (psig->action == SIG_DFL) {
|
||||||
printf("SIG_DFL code=0x%x\n", psig->code);
|
printf("SIG_DFL code=");
|
||||||
else {
|
sigcodename(psig->signo, psig->code);
|
||||||
printf("caught handler=0x%lx mask=0x%x code=0x%x\n",
|
putchar('\n');
|
||||||
(u_long)psig->action, psig->mask.__bits[0], psig->code);
|
} else {
|
||||||
|
printf("caught handler=0x%lx mask=0x%x code=",
|
||||||
|
(u_long)psig->action, psig->mask.__bits[0]);
|
||||||
|
sigcodename(psig->signo, psig->code);
|
||||||
|
putchar('\n');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,7 +388,13 @@ auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+"
|
|||||||
auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
|
auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
|
||||||
auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
|
auto_or_type "shmatname" "SHM_[A-Z]+[[:space:]]+[0-9]{6}+" "sys/shm.h"
|
||||||
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
|
auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
|
||||||
|
auto_switch_type "sigbuscodename" "BUS_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
|
auto_switch_type "sigchldcodename" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
|
auto_switch_type "sigfpecodename" "FPE_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
|
auto_switch_type "sigillcodename" "ILL_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
|
auto_switch_type "sigsegvcodename" "SEGV_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
|
auto_switch_type "sigtrapcodename" "TRAP_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
|
||||||
auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
|
auto_if_type "sockdomainname" "PF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
|
||||||
auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
|
auto_if_type "sockfamilyname" "AF_[[:alnum:]]+[[:space:]]+" "sys/socket.h"
|
||||||
auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
|
auto_if_type "sockipprotoname" "IPPROTO_[[:alnum:]]+[[:space:]]+" "netinet/in.h"
|
||||||
@ -501,4 +507,46 @@ cat <<_EOF_
|
|||||||
printf(">");
|
printf(">");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AUTO - Special
|
||||||
|
*
|
||||||
|
* Check general codes first, then defer to signal-specific codes.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
sigcodename(int sig, int code)
|
||||||
|
{
|
||||||
|
switch (code) {
|
||||||
_EOF_
|
_EOF_
|
||||||
|
egrep "^#[[:space:]]*define[[:space:]]+SI_[A-Z]+[[:space:]]+0(x[0-9abcdef]+)?[[:space:]]*" \
|
||||||
|
$include_dir/sys/signal.h | grep -v SI_UNDEFINED | \
|
||||||
|
awk '{ for (i = 1; i <= NF; i++) \
|
||||||
|
if ($i ~ /define/) \
|
||||||
|
break; \
|
||||||
|
++i; \
|
||||||
|
printf "\tcase %s:\n\t\tprintf(\"%s\");\n\t\tbreak;\n", $i, $i }'
|
||||||
|
cat <<_EOF_
|
||||||
|
default:
|
||||||
|
switch (sig) {
|
||||||
|
case SIGILL:
|
||||||
|
sigillcodename(code);
|
||||||
|
break;
|
||||||
|
case SIGBUS:
|
||||||
|
sigbuscodename(code);
|
||||||
|
break;
|
||||||
|
case SIGSEGV:
|
||||||
|
sigsegvcodename(code);
|
||||||
|
break;
|
||||||
|
case SIGFPE:
|
||||||
|
sigfpecodename(code);
|
||||||
|
break;
|
||||||
|
case SIGTRAP:
|
||||||
|
sigtrapcodename(code);
|
||||||
|
break;
|
||||||
|
case SIGCHLD:
|
||||||
|
sigchldcodename(code);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
printf("<invalid=%#x>", code);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user