summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-09-19 22:00:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-09-19 22:00:38 +0000
commit0fa515f3b610c3f733b147d1ff8416995df741e6 (patch)
tree3d7ce747dbf41e06f261828e04b19e5fb6c42ffd
parentb7fc97d9812d76a1f7ba09d9ee3d6b89f31158a2 (diff)
teach kdump about "siginfo-style" signal sub-codes, and the (currently)
limited subset of information the kernel supplies. ok miod pirofti
-rw-r--r--usr.bin/kdump/kdump.c36
-rw-r--r--usr.bin/kdump/mksubr9
2 files changed, 41 insertions, 4 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index a4d08496715..80390b842f8 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kdump.c,v 1.62 2011/07/28 10:33:36 otto Exp $ */
+/* $OpenBSD: kdump.c,v 1.63 2011/09/19 22:00:37 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -41,7 +41,7 @@
#include <sys/shm.h>
#include <sys/socket.h>
#include <sys/sysctl.h>
-#include <sys/socket.h>
+#include <sys/siginfo.h>
#include <sys/un.h>
#include <sys/vmmeter.h>
#include <sys/stat.h>
@@ -1122,10 +1122,40 @@ ktrpsig(struct ktr_psig *psig)
{
(void)printf("SIG%s ", sys_signame[psig->signo]);
if (psig->action == SIG_DFL)
- (void)printf("SIG_DFL code %d", psig->code);
+ (void)printf("SIG_DFL");
else
(void)printf("caught handler=0x%lx mask=0x%x",
(u_long)psig->action, psig->mask);
+ if (psig->code) {
+ printf(" code ");
+ if (fancy) {
+ switch (psig->signo) {
+ case SIGILL:
+ sigill_name(psig->code);
+ break;
+ case SIGTRAP:
+ sigtrap_name(psig->code);
+ break;
+ case SIGEMT:
+ sigemt_name(psig->code);
+ break;
+ case SIGFPE:
+ sigfpe_name(psig->code);
+ break;
+ case SIGBUS:
+ sigbus_name(psig->code);
+ break;
+ case SIGSEGV:
+ sigsegv_name(psig->code);
+ break;
+ case SIGCHLD:
+ sigchld_name(psig->code);
+ break;
+ }
+ }
+ printf("<%d>", psig->code);
+ }
+
switch (psig->signo) {
case SIGSEGV:
case SIGILL:
diff --git a/usr.bin/kdump/mksubr b/usr.bin/kdump/mksubr
index 29150f81e9c..2bbcf2b4906 100644
--- a/usr.bin/kdump/mksubr
+++ b/usr.bin/kdump/mksubr
@@ -1,5 +1,5 @@
#!/bin/sh
-# $OpenBSD: mksubr,v 1.6 2011/07/19 18:20:12 matthew Exp $
+# $OpenBSD: mksubr,v 1.7 2011/09/19 22:00:37 deraadt Exp $
#
# Copyright (c) 2006 David Kirchner <dpk@dpk.net>
#
@@ -362,6 +362,13 @@ auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h"
#auto_switch_type "sendfileflagsname" "SF_[A-Z]+[[:space:]]+[0-9]+" "sys/socket.h"
#auto_switch_type "acltypename" "ACL_TYPE_[A-Z4_]+[[:space:]]+0x[0-9]+" "sys/acl.h"
auto_switch_type "sigprocmaskhowname" "SIG_[A-Z]+[[:space:]]+[0-9]+" "sys/signal.h"
+auto_switch_type "sigill_name" "ILL_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
+auto_switch_type "sigtrap_name" "TRAP_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
+auto_switch_type "sigemt_name" "EMT_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
+auto_switch_type "sigfpe_name" "FPE_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
+auto_switch_type "sigbus_name" "BUS_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
+auto_switch_type "sigsegv_name" "SEGV_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
+auto_switch_type "sigchld_name" "CLD_[A-Z]+[[:space:]]+[0-9]+" "sys/siginfo.h"
#auto_switch_type "lio_listioname" "LIO_(NO)?WAIT[[:space:]]+[0-9]+" "aio.h"
auto_switch_type "minheritname" "INHERIT_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h"
#auto_switch_type "quotactlname" "Q_[A-Z]+[[:space:]]+0x[0-9]+" "ufs/ufs/quota.h"