From 2b5dbafda7b349b54a9d6ecc45bcbd2e816181d0 Mon Sep 17 00:00:00 2001 From: Hiten Pandya Date: Sun, 3 Aug 2003 12:29:05 +0000 Subject: [PATCH] Move the backtrace() function from kern_subr.c to kern_debug.c. All debugging related kernel functions, and syscalls should be added into this file. Discussed with: Matt (about kern_debug.c) --- sys/conf/files | 3 ++- sys/kern/kern_debug.c | 63 +++++++++++++++++++++++++++++++++++++++++++ sys/kern/kern_subr.c | 20 +------------- 3 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 sys/kern/kern_debug.c diff --git a/sys/conf/files b/sys/conf/files index a9bddc30f4..f2b4211d55 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -1,5 +1,5 @@ # $FreeBSD: src/sys/conf/files,v 1.340.2.137 2003/06/04 17:10:30 sam Exp $ -# $DragonFly: src/sys/conf/files,v 1.8 2003/07/22 17:03:26 dillon Exp $ +# $DragonFly: src/sys/conf/files,v 1.9 2003/08/03 12:29:05 hmp Exp $ # # The long compile-with and dependency lines are required because of # limitations in config: backslash-newline doesn't work in strings, and @@ -602,6 +602,7 @@ kern/kern_acct.c standard kern/kern_acl.c standard kern/kern_clock.c standard kern/kern_conf.c standard +kern/kern_debug.c standard kern/kern_device.c standard kern/kern_descrip.c standard kern/kern_environment.c standard diff --git a/sys/kern/kern_debug.c b/sys/kern/kern_debug.c new file mode 100644 index 0000000000..0040c2d754 --- /dev/null +++ b/sys/kern/kern_debug.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2003 Hiten M. Pandya . All rights reserved. + * Copyright (c) 1986, 1988, 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice unmodified, this list of conditions, and the following + * disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. +* + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * Adoped from: + * src/sys/kern/kern_shutdown.c + * + * $DragonFly: src/sys/kern/kern_debug.c,v 1.1 2003/08/03 12:29:05 hmp Exp $ + * + */ + +/* + * Various debug routines. + * + */ + +#include "opt_ddb.h" + +#include +#include + +#include + +/* + * Simple DDB stack trace funtionality. + */ +void +backtrace(void) +{ + +#ifdef DDB + printf("Stack backtrace:\n"); + db_print_backtrace(); +#else + printf("Cannot print stack trace.\n"); + printf("DDB kernel option is needed.\n"); +#endif +} diff --git a/sys/kern/kern_subr.c b/sys/kern/kern_subr.c index 6c9fdd07b7..e38f2c3bc6 100644 --- a/sys/kern/kern_subr.c +++ b/sys/kern/kern_subr.c @@ -37,7 +37,7 @@ * * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/kern/kern_subr.c,v 1.31.2.2 2002/04/21 08:09:37 bde Exp $ - * $DragonFly: src/sys/kern/kern_subr.c,v 1.9 2003/07/28 04:56:35 hmp Exp $ + * $DragonFly: src/sys/kern/kern_subr.c,v 1.10 2003/08/03 12:29:05 hmp Exp $ */ #include "opt_ddb.h" @@ -51,8 +51,6 @@ #include #include -#include - #include #include #include @@ -425,19 +423,3 @@ phashinit(elements, type, nentries) *nentries = hashsize; return (hashtbl); } - -/* - * Simple DDB stack trace funtionality. - */ -void -backtrace(void) -{ - -#ifdef DDB - printf("Stack backtrace:\n"); - db_print_backtrace(); -#else - printf("Cannot print stack trace.\n"); - printf("DDB kernel option is needed.\n"); -#endif -} -- 2.41.0