]>
git.saurik.com Git - apple/xnu.git/blob - bsd/hfs/hfs_dbg.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
24 * (c) 1997 Apple Computer, Inc. All Rights Reserved
26 * hfs_dbg.h -- debugging macros for HFS file system.
29 * 10-Nov-1998 Pat Dirks Cleaned up definition of DBG_ASSERT to handle embedded '%' correctly.
30 * 28-Apr-1998 Scott Roberts Reorganized and added HFS_DEBUG_STAGE
31 * 17-Nov-1997 Pat Dirks Pat Dirks at Apple Computer
32 * Derived from old hfs version.
37 /* Define the debugging stage...
38 4 -> Do all, aggresive, call_kdp
39 3 -> debug asserts and debug err, panic instead of call_kdp
40 2 -> debug error, no kdb
41 1 -> very little, panic only
43 #ifndef HFS_DIAGNOSTIC
44 #define HFS_DIAGNOSTIC 0
45 #endif /* HFS_DIAGNOSTIC */
47 #ifndef HFS_DEBUG_STAGE
49 #define HFS_DEBUG_STAGE 4
51 #define HFS_DEBUG_STAGE 1
53 #endif /* HFS_DEBUG_STAGE */
56 #define PRINTIT kprintf
58 #define PRINTIT printf
61 #if (HFS_DEBUG_STAGE > 3)
62 #define DEBUG_BREAK Debugger("");
67 #if (HFS_DEBUG_STAGE == 4)
68 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; DEBUG_BREAK };
69 #elif (HFS_DEBUG_STAGE == 3)
70 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { panic PRINTF_ARGS;};
72 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; };
76 //#define PRINT_DELAY (void) tsleep((caddr_t)&lbolt, PPAUSE, "hfs kprintf", 0)
83 extern int hfs_dbg_all
;
84 extern int hfs_dbg_err
;
87 #if (HFS_DEBUG_STAGE == 4)
88 char gDebugAssertStr
[255];
89 #define DBG_ASSERT(a) { if (!(a)) { \
90 sprintf(gDebugAssertStr,"Oops - File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); \
91 Debugger(gDebugAssertStr); } }
93 #define DBG_ASSERT(a) { if (!(a)) { panic("File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); } }
94 #endif /* HFS_DEBUG_STAGE */
96 #define DBG_ASSERT(a) assert(a)
99 #define DBG_ERR(x) { \
100 if(hfs_dbg_all || hfs_dbg_err) { \
101 PRINTIT("%X: ", proc_selfpid()); \
102 PRINTIT("HFS ERROR: "); \
108 #else /* HFS_DIAGNOSTIC */
110 #define DBG_ASSERT(a)
113 #endif /* HFS_DIAGNOSTIC */