From d5738f5104b3915d9a9672736c38ad9feb844fd0 Mon Sep 17 00:00:00 2001 From: dbj Date: Sat, 5 Jan 2002 22:57:38 +0000 Subject: [PATCH] add support for the `D' kgdb detach command add comment about minimum requirement for KGDB_BUFLEN --- sys/kern/kgdb_stub.c | 7 +++++-- sys/sys/kgdb.h | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/kern/kgdb_stub.c b/sys/kern/kgdb_stub.c index 068b183b8e93..5baf4887d111 100644 --- a/sys/kern/kgdb_stub.c +++ b/sys/kern/kgdb_stub.c @@ -1,4 +1,4 @@ -/* $NetBSD: kgdb_stub.c,v 1.11 2001/11/20 08:43:46 lukem Exp $ */ +/* $NetBSD: kgdb_stub.c,v 1.12 2002/01/05 22:57:38 dbj Exp $ */ /* * Copyright (c) 1990, 1993 @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kgdb_stub.c,v 1.11 2001/11/20 08:43:46 lukem Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kgdb_stub.c,v 1.12 2002/01/05 22:57:38 dbj Exp $"); #include "opt_kgdb.h" @@ -88,6 +88,7 @@ static int (*kgdb_getc) __P((void *)); static void (*kgdb_putc) __P((void *, int)); static void *kgdb_ioarg; +/* KGDB_BUFLEN must be at least (2*KGDB_NUMREGS*sizeof(kgdb_reg_t)+1) */ static u_char buffer[KGDB_BUFLEN]; static kgdb_reg_t gdb_regs[KGDB_NUMREGS]; @@ -497,10 +498,12 @@ kgdb_trap(type, regs) kgdb_send("OK"); continue; + case KGDB_DETACH: case KGDB_KILL: kgdb_active = 0; printf("kgdb detached\n"); db_clear_single_step(regs); + kgdb_send("OK"); goto out; case KGDB_CONT: diff --git a/sys/sys/kgdb.h b/sys/sys/kgdb.h index 58c8fb2675e8..6e6b153cecd3 100644 --- a/sys/sys/kgdb.h +++ b/sys/sys/kgdb.h @@ -1,4 +1,4 @@ -/* $NetBSD: kgdb.h,v 1.5 1998/09/13 14:46:24 christos Exp $ */ +/* $NetBSD: kgdb.h,v 1.6 2002/01/05 22:57:38 dbj Exp $ */ /* * Copyright (c) 1992, 1993 @@ -64,6 +64,7 @@ #define KGDB_CONT 'c' #define KGDB_STEP 's' #define KGDB_KILL 'k' +#define KGDB_DETACH 'D' #define KGDB_SIGNAL '?' #define KGDB_DEBUG 'd'