[Midnightbsd-cvs] src [7896] trunk/sys/amd64/amd64/trap.c: Add a hackish debugging facility to provide a bit of information about
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Wed Sep 14 14:53:28 EDT 2016
Revision: 7896
http://svnweb.midnightbsd.org/src/?rev=7896
Author: laffer1
Date: 2016-09-14 14:53:28 -0400 (Wed, 14 Sep 2016)
Log Message:
-----------
Add a hackish debugging facility to provide a bit of information about
reason for generated trap. The dump of basic signal information and 8
bytes of the faulting instruction are printed on the controlling
terminal of the process, if the machdep.uprintf_signal syscal is
enabled.
Modified Paths:
--------------
trunk/sys/amd64/amd64/trap.c
Modified: trunk/sys/amd64/amd64/trap.c
===================================================================
--- trunk/sys/amd64/amd64/trap.c 2016-09-14 18:52:10 UTC (rev 7895)
+++ trunk/sys/amd64/amd64/trap.c 2016-09-14 18:53:28 UTC (rev 7896)
@@ -176,9 +176,14 @@
SYSCTL_INT(_machdep, OID_AUTO, panic_on_nmi, CTLFLAG_RW,
&panic_on_nmi, 0, "Panic on NMI");
TUNABLE_INT("machdep.panic_on_nmi", &panic_on_nmi);
-static int prot_fault_translation = 0;
+static int prot_fault_translation;
SYSCTL_INT(_machdep, OID_AUTO, prot_fault_translation, CTLFLAG_RW,
- &prot_fault_translation, 0, "Select signal to deliver on protection fault");
+ &prot_fault_translation, 0,
+ "Select signal to deliver on protection fault");
+static int uprintf_signal;
+SYSCTL_INT(_machdep, OID_AUTO, uprintf_signal, CTLFLAG_RW,
+ &uprintf_signal, 0,
+ "Print debugging information on trap signal to ctty");
/*
* Exception, fault, and trap interface to the FreeBSD kernel.
@@ -607,6 +612,19 @@
ksi.ksi_code = ucode;
ksi.ksi_trapno = type;
ksi.ksi_addr = (void *)addr;
+ if (uprintf_signal) {
+ uprintf("pid %d comm %s: signal %d err %lx code %d type %d "
+ "addr 0x%lx <%02x %02x %02x %02x %02x %02x %02x %02x>\n",
+ p->p_pid, p->p_comm, i, frame->tf_err, ucode, type, addr,
+ fubyte((void *)(frame->tf_rip + 0)),
+ fubyte((void *)(frame->tf_rip + 1)),
+ fubyte((void *)(frame->tf_rip + 2)),
+ fubyte((void *)(frame->tf_rip + 3)),
+ fubyte((void *)(frame->tf_rip + 4)),
+ fubyte((void *)(frame->tf_rip + 5)),
+ fubyte((void *)(frame->tf_rip + 6)),
+ fubyte((void *)(frame->tf_rip + 7)));
+ }
trapsignal(td, &ksi);
user:
More information about the Midnightbsd-cvs
mailing list