Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern Add some debugging in case someone else wants to de...
details: https://anonhg.NetBSD.org/src/rev/2c36eb28583a
branches: trunk
changeset: 320102:2c36eb28583a
user: christos <christos%NetBSD.org@localhost>
date: Sat Jun 23 03:32:48 2018 +0000
description:
Add some debugging in case someone else wants to debug gdb...
diffstat:
sys/kern/sys_ptrace_common.c | 34 +++++++++++++++++++++++++++++-----
1 files changed, 29 insertions(+), 5 deletions(-)
diffs (135 lines):
diff -r 6d3ecdadb6b7 -r 2c36eb28583a sys/kern/sys_ptrace_common.c
--- a/sys/kern/sys_ptrace_common.c Sat Jun 23 03:18:49 2018 +0000
+++ b/sys/kern/sys_ptrace_common.c Sat Jun 23 03:32:48 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_ptrace_common.c,v 1.44 2018/05/30 23:54:03 kamil Exp $ */
+/* $NetBSD: sys_ptrace_common.c,v 1.45 2018/06/23 03:32:48 christos Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.44 2018/05/30 23:54:03 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.45 2018/06/23 03:32:48 christos Exp $");
#ifdef _KERNEL_OPT
#include "opt_ptrace.h"
@@ -154,8 +154,7 @@
#include <machine/reg.h>
#ifdef PTRACE
-
-# ifdef DEBUG
+# ifdef PTRACE_DEBUG
# define DPRINTF(a) uprintf a
# else
# define DPRINTF(a)
@@ -573,6 +572,8 @@
psi.psi_siginfo._info = t->p_sigctx.ps_info;
psi.psi_lwpid = t->p_sigctx.ps_lwp;
+ DPRINTF(("%s: lwp=%d signal=%d\n", __func__, psi.psi_lwpid,
+ psi.psi_siginfo.si_signo));
return ptm->ptm_copyout_siginfo(&psi, addr, data);
}
@@ -597,6 +598,8 @@
t->p_sigctx.ps_faked = true;
t->p_sigctx.ps_info = psi.psi_siginfo._info;
t->p_sigctx.ps_lwp = psi.psi_lwpid;
+ DPRINTF(("%s: lwp=%d signal=%d\n", __func__, psi.psi_lwpid,
+ psi.psi_siginfo.si_signo));
return 0;
}
@@ -620,6 +623,8 @@
PTRACE_LWP_CREATE : 0;
pe.pe_set_event |= ISSET(t->p_slflag, PSL_TRACELWP_EXIT) ?
PTRACE_LWP_EXIT : 0;
+ DPRINTF(("%s: lwp=%d event=%#x\n", __func__,
+ t->p_sigctx.ps_lwp, pe.pe_set_event));
return copyout(&pe, addr, sizeof(pe));
}
@@ -636,6 +641,8 @@
if ((error = copyin(addr, &pe, sizeof(pe))) != 0)
return error;
+ DPRINTF(("%s: lwp=%d event=%#x\n", __func__,
+ t->p_sigctx.ps_lwp, pe.pe_set_event));
if (pe.pe_set_event & PTRACE_FORK)
SET(t->p_slflag, PSL_TRACEFORK);
else
@@ -690,6 +697,9 @@
ps.pe_report_event = PTRACE_LWP_EXIT;
ps.pe_lwp = t->p_lwp_exited;
}
+ DPRINTF(("%s: lwp=%d event=%#x pid=%d lwp=%d\n", __func__,
+ t->p_sigctx.ps_lwp, ps.pe_report_event,
+ ps.pe_other_pid, ps.pe_lwp));
return copyout(&ps, addr, sizeof(ps));
}
@@ -739,10 +749,16 @@
*/
else if ((*lt)->l_lid == t->p_sigctx.ps_lwp
|| (t->p_sigctx.ps_lwp == 0 &&
- t->p_sigctx.ps_info._signo))
+ t->p_sigctx.ps_info._signo)) {
+ DPRINTF(("%s: lwp=%d siglwp=%d signo %d\n", __func__,
+ pl.pl_lwpid, t->p_sigctx.ps_lwp,
+ t->p_sigctx.ps_info._signo));
pl.pl_event = PL_EVENT_SIGNAL;
+ }
}
mutex_exit(t->p_lock);
+ DPRINTF(("%s: lwp=%d event=%#x\n", __func__,
+ pl.pl_lwpid, pl.pl_event));
return copyout(&pl, addr, sizeof(pl));
}
@@ -756,6 +772,7 @@
if ((error = ptrace_update_lwp(t, lt, data)) != 0)
return error;
+ DPRINTF(("%s: lwp=%d request=%d\n", __func__, (*lt)->l_lid, rq));
lwp_lock(*lt);
if (rq == PT_SUSPEND)
(*lt)->l_flag |= LW_WSUSPEND;
@@ -798,6 +815,8 @@
size_t size;
int (*func)(struct lwp *, struct lwp *, struct uio *);
+ DPRINTF(("%s: lwp=%d request=%d\n", __func__, l->l_lid, rq));
+
switch (rq) {
#if defined(PT_SETREGS) || defined(PT_GETREGS)
case_PT_GETREGS
@@ -899,6 +918,8 @@
} else {
ksi.ksi_signo = signo;
}
+ DPRINTF(("%s: pid=%d.%d signal=%d resume_all=%d\n", __func__, t->p_pid,
+ t->p_sigctx.ps_lwp, signo, resume_all));
kpsignal2(t, &ksi);
return 0;
@@ -920,6 +941,7 @@
goto out;
path[len] = '\0';
}
+ DPRINTF(("%s: lwp=%d\n", __func__, lt->l_lid));
error = (*coredump_vec)(lt, path);
out:
if (path)
@@ -943,6 +965,8 @@
uio.uio_offset = (off_t)(unsigned long)piod->piod_offs;
uio.uio_resid = piod->piod_len;
+ DPRINTF(("%s: lwp=%d request=%d\n", __func__, l->l_lid, piod->piod_op));
+
switch (piod->piod_op) {
case PIOD_READ_D:
case PIOD_READ_I:
Home |
Main Index |
Thread Index |
Old Index