Merge from vendor branch GCC:
[dragonfly.git] / sys / kern / kern_debug.c
1 /*
2  * Copyright (c) 2003 Hiten Pandya <hmp@backplane.com>.
3  *
4  * All rights reserved.
5  * 
6  * Copyright (c) 1986, 1988, 1991, 1993
7  *      The Regents of the University of California.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice unmodified, this list of conditions, and the following
14  *    disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. Neither the name of the University nor the names of its contributors
19  *    may be used to endorse or promote products derived from this software
20  *    without specific prior written permission.
21 *
22  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25  * IN NO EVENT SHALL THE AUTHOR OR THE VOICES IN HIS HEAD BE LIABLE FOR ANY
26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Adopted from:
34  *      src/sys/kern/kern_shutdown.c
35  *
36  * $DragonFly: src/sys/kern/kern_debug.c,v 1.4 2004/02/14 03:54:36 hmp Exp $
37  *
38  */
39
40 /*
41  * Various debug routines.
42  *
43  */
44
45 #include "opt_ddb.h"
46
47 #include <sys/param.h>
48 #include <sys/systm.h>
49
50 #include <ddb/ddb.h>
51
52 /*
53  * Simple DDB stack trace funtionality.
54  */
55 void
56 backtrace(void)
57 {
58
59 #ifdef DDB
60                 printf("Stack backtrace:\n");
61                 db_print_backtrace();
62 #else
63                 printf("Cannot print stack trace.\n");
64                 printf("DDB kernel option is needed.\n");
65 #endif
66 }