]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/debug.h
xnu-1228.12.14.tar.gz
[apple/xnu.git] / osfmk / kern / debug.h
CommitLineData
1c79356b 1/*
2d21ac55 2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
A
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.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b 27 */
9bccf70c 28
1c79356b
A
29#ifndef _KERN_DEBUG_H_
30#define _KERN_DEBUG_H_
31
91447636 32#include <sys/cdefs.h>
2d21ac55 33#include <stdint.h>
9bccf70c 34
91447636 35#ifdef KERNEL_PRIVATE
1c79356b
A
36
37extern unsigned int systemLogDiags;
593a1d5f 38extern char debug_buf[];
1c79356b
A
39
40#ifdef MACH_KERNEL_PRIVATE
41
42extern unsigned int halt_in_debugger;
43
44extern unsigned int switch_debugger;
45
46extern unsigned int current_debugger;
47#define NO_CUR_DB 0x0
48#define KDP_CUR_DB 0x1
49#define KDB_CUR_DB 0x2
50
51extern unsigned int active_debugger;
52extern unsigned int debug_mode;
593a1d5f 53extern unsigned int disable_debug_output;
9bccf70c 54
55e303ae 55extern unsigned int panicDebugging;
9bccf70c 56extern unsigned int logPanicDataToScreen;
1c79356b
A
57
58extern int db_run_mode;
59
60/* modes the system may be running in */
61
62#define STEP_NONE 0
63#define STEP_ONCE 1
64#define STEP_RETURN 2
65#define STEP_CALLT 3
66#define STEP_CONTINUE 4
67#define STEP_INVISIBLE 5
68#define STEP_COUNT 6
69#define STEP_TRACE 7 /* Show all calls to functions and returns */
70
91447636
A
71extern const char *panicstr;
72extern volatile unsigned int nestedpanic;
2d21ac55 73extern int unsigned long panic_caller;
1c79356b 74
9bccf70c
A
75extern char *debug_buf_ptr;
76extern unsigned int debug_buf_size;
77
78extern void debug_log_init(void);
79extern void debug_putc(char);
80
91447636
A
81extern void panic_init(void);
82
2d21ac55
A
83int packA(char *inbuf, uint32_t length, uint32_t buflen);
84void unpackA(char *inbuf, uint32_t length);
85
86void panic_display_system_configuration(void);
c910b4d9 87void panic_display_zprint(void);
2d21ac55 88
1c79356b
A
89#endif /* MACH_KERNEL_PRIVATE */
90
91#define DB_HALT 0x1
92#define DB_PRT 0x2
93#define DB_NMI 0x4
94#define DB_KPRT 0x8
95#define DB_KDB 0x10
96#define DB_SLOG 0x20
9bccf70c
A
97#define DB_ARP 0x40
98#define DB_KDP_BP_DIS 0x80
99#define DB_LOG_PI_SCRN 0x100
55e303ae 100#define DB_KDP_GETC_ENA 0x200
9bccf70c 101
55e303ae
A
102#define DB_KERN_DUMP_ON_PANIC 0x400 /* Trigger core dump on panic*/
103#define DB_KERN_DUMP_ON_NMI 0x800 /* Trigger core dump on NMI */
104#define DB_DBG_POST_CORE 0x1000 /*Wait in debugger after NMI core */
105#define DB_PANICLOG_DUMP 0x2000 /* Send paniclog on panic,not core*/
91447636 106
593a1d5f 107
91447636
A
108#endif /* KERNEL_PRIVATE */
109
110__BEGIN_DECLS
111
2d21ac55
A
112extern void panic(const char *string, ...) __printflike(1,2);
113#if CONFIG_NO_PANIC_STRINGS
114#define panic_plain(...) (panic)((char *)0)
115#define panic(...) (panic)((char *)0)
116#else /* CONFIGS_NO_PANIC_STRINGS */
117#define panic_plain(ex, ...) \
118 (panic)(ex, ## __VA_ARGS__)
119#define __STRINGIFY(x) #x
120#define LINE_NUMBER(x) __STRINGIFY(x)
121#define PANIC_LOCATION __FILE__ ":" LINE_NUMBER(__LINE__)
122#define panic(ex, ...) \
123 (panic)(# ex "@" PANIC_LOCATION, ## __VA_ARGS__)
124#endif /* CONFIGS_NO_PANIC_STRINGS */
125
126void populate_model_name(char *);
127unsigned panic_active(void);
91447636 128__END_DECLS
1c79356b
A
129
130#endif /* _KERN_DEBUG_H_ */