summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/man/man4/ddb.411
-rw-r--r--sys/ddb/db_command.c3
-rw-r--r--sys/ddb/db_interface.h3
-rw-r--r--sys/kern/kern_proc.c24
4 files changed, 36 insertions, 5 deletions
diff --git a/share/man/man4/ddb.4 b/share/man/man4/ddb.4
index ba65c8d0203..24537d083f2 100644
--- a/share/man/man4/ddb.4
+++ b/share/man/man4/ddb.4
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ddb.4,v 1.90 2017/09/12 08:27:44 mpi Exp $
+.\" $OpenBSD: ddb.4,v 1.91 2017/09/29 09:36:04 mpi Exp $
.\" $NetBSD: ddb.4,v 1.5 1994/11/30 16:22:09 jtc Exp $
.\"
.\" Mach Operating System
@@ -25,7 +25,7 @@
.\" any improvements or extensions that they make and grant Carnegie Mellon
.\" the rights to redistribute these changes.
.\"
-.Dd $Mdocdate: September 12 2017 $
+.Dd $Mdocdate: September 29 2017 $
.Dt DDB 4
.Os
.Sh NAME
@@ -542,6 +542,13 @@ The
command is a synonym for
.Ic match .
.\" --------------------
+.It Ic kill Ar pid
+Send an uncatchable
+.Dv SIGABRT
+signal to the process specified by the
+.Ar pid
+argument.
+.\" --------------------
.It Xo
.Ic trace
.Op Cm /pu
diff --git a/sys/ddb/db_command.c b/sys/ddb/db_command.c
index 0cf09c4c878..7ab47548594 100644
--- a/sys/ddb/db_command.c
+++ b/sys/ddb/db_command.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_command.c,v 1.77 2017/09/12 08:23:42 mpi Exp $ */
+/* $OpenBSD: db_command.c,v 1.78 2017/09/29 09:36:04 mpi Exp $ */
/* $NetBSD: db_command.c,v 1.20 1996/03/30 22:30:05 christos Exp $ */
/*
@@ -612,6 +612,7 @@ struct db_command db_command_table[] = {
/* this must be the first entry, if it exists */
{ "machine", NULL, 0, NULL},
#endif
+ { "kill", db_kill_cmd, 0, NULL },
{ "print", db_print_cmd, 0, NULL },
{ "p", db_print_cmd, 0, NULL },
{ "pprint", db_ctf_pprint_cmd, CS_OWN, NULL },
diff --git a/sys/ddb/db_interface.h b/sys/ddb/db_interface.h
index 9ae9d20024c..11d0409dd77 100644
--- a/sys/ddb/db_interface.h
+++ b/sys/ddb/db_interface.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.h,v 1.19 2017/01/09 17:58:44 mpi Exp $ */
+/* $OpenBSD: db_interface.h,v 1.20 2017/09/29 09:36:04 mpi Exp $ */
/* $NetBSD: db_interface.h,v 1.1 1996/02/05 01:57:03 christos Exp $ */
/*
@@ -40,6 +40,7 @@ void db_stack_trace_print(db_expr_t, int, db_expr_t, char *,
db_addr_t db_disasm(db_addr_t, boolean_t);
/* kern/kern_proc.c */
+void db_kill_cmd(db_expr_t, int, db_expr_t, char *);
void db_show_all_procs(db_expr_t, int, db_expr_t, char *);
/* kern/kern_timeout.c */
diff --git a/sys/kern/kern_proc.c b/sys/kern/kern_proc.c
index 2436de90016..37ad3232b75 100644
--- a/sys/kern/kern_proc.c
+++ b/sys/kern/kern_proc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_proc.c,v 1.76 2017/02/04 07:42:52 guenther Exp $ */
+/* $OpenBSD: kern_proc.c,v 1.77 2017/09/29 09:36:04 mpi Exp $ */
/* $NetBSD: kern_proc.c,v 1.14 1996/02/09 18:59:41 christos Exp $ */
/*
@@ -440,6 +440,28 @@ proc_printit(struct proc *p, const char *modif,
#include <ddb/db_output.h>
void
+db_kill_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
+{
+ struct process *pr;
+ struct sigaction sa;
+ struct proc *p;
+
+ pr = prfind(addr);
+ if (pr == NULL) {
+ db_printf("%ld: No such process", addr);
+ return;
+ }
+
+ p = TAILQ_FIRST(&pr->ps_threads);
+
+ /* Send uncatchable SIGABRT for coredump */
+ memset(&sa, 0, sizeof sa);
+ sa.sa_handler = SIG_DFL;
+ setsigvec(p, SIGABRT, &sa);
+ psignal(p, SIGABRT);
+}
+
+void
db_show_all_procs(db_expr_t addr, int haddr, db_expr_t count, char *modif)
{
char *mode;