]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/debug.h
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 #ifndef _KERN_DEBUG_H_
30 #define _KERN_DEBUG_H_
32 #include <sys/cdefs.h>
37 extern unsigned int systemLogDiags
;
39 #ifdef MACH_KERNEL_PRIVATE
41 extern unsigned int halt_in_debugger
;
43 extern unsigned int switch_debugger
;
45 extern unsigned int current_debugger
;
47 #define KDP_CUR_DB 0x1
48 #define KDB_CUR_DB 0x2
50 extern unsigned int active_debugger
;
51 extern unsigned int debug_mode
;
52 extern unsigned int disable_debug_output
;
54 extern unsigned int panicDebugging
;
55 extern unsigned int logPanicDataToScreen
;
57 extern int db_run_mode
;
59 /* modes the system may be running in */
65 #define STEP_CONTINUE 4
66 #define STEP_INVISIBLE 5
68 #define STEP_TRACE 7 /* Show all calls to functions and returns */
70 extern const char *panicstr
;
71 extern volatile unsigned int nestedpanic
;
72 extern int unsigned long panic_caller
;
74 extern char *debug_buf
;
75 extern char *debug_buf_ptr
;
76 extern unsigned int debug_buf_size
;
78 extern void debug_log_init(void);
79 extern void debug_putc(char);
81 extern void panic_init(void);
83 int packA(char *inbuf
, uint32_t length
, uint32_t buflen
);
84 void unpackA(char *inbuf
, uint32_t length
);
86 void panic_display_system_configuration(void);
88 #endif /* MACH_KERNEL_PRIVATE */
97 #define DB_KDP_BP_DIS 0x80
98 #define DB_LOG_PI_SCRN 0x100
99 #define DB_KDP_GETC_ENA 0x200
101 #define DB_KERN_DUMP_ON_PANIC 0x400 /* Trigger core dump on panic*/
102 #define DB_KERN_DUMP_ON_NMI 0x800 /* Trigger core dump on NMI */
103 #define DB_DBG_POST_CORE 0x1000 /*Wait in debugger after NMI core */
104 #define DB_PANICLOG_DUMP 0x2000 /* Send paniclog on panic,not core*/
106 #endif /* KERNEL_PRIVATE */
110 extern void panic(const char *string
, ...) __printflike(1,2);
111 #if CONFIG_NO_PANIC_STRINGS
112 #define panic_plain(...) (panic)((char *)0)
113 #define panic(...) (panic)((char *)0)
114 #else /* CONFIGS_NO_PANIC_STRINGS */
115 #define panic_plain(ex, ...) \
116 (panic)(ex, ## __VA_ARGS__)
117 #define __STRINGIFY(x) #x
118 #define LINE_NUMBER(x) __STRINGIFY(x)
119 #define PANIC_LOCATION __FILE__ ":" LINE_NUMBER(__LINE__)
120 #define panic(ex, ...) \
121 (panic)(# ex "@" PANIC_LOCATION, ## __VA_ARGS__)
122 #endif /* CONFIGS_NO_PANIC_STRINGS */
124 void populate_model_name(char *);
125 unsigned panic_active(void);
128 #endif /* _KERN_DEBUG_H_ */