]>
git.saurik.com Git - apple/xnu.git/blob - bsd/hfs/hfs_dbg.h
15d5a914f9851529c0b5a9e72bba4034cfe28508
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_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. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 * (c) 1997 Apple Computer, Inc. All Rights Reserved
27 * hfs_dbg.h -- debugging macros for HFS file system.
30 * 10-Nov-1998 Pat Dirks Cleaned up definition of DBG_ASSERT to handle embedded '%' correctly.
31 * 28-Apr-1998 Scott Roberts Reorganized and added HFS_DEBUG_STAGE
32 * 17-Nov-1997 Pat Dirks Pat Dirks at Apple Computer
33 * Derived from old hfs version.
38 /* Define the debugging stage...
39 4 -> Do all, aggresive, call_kdp
40 3 -> debug asserts and debug err, panic instead of call_kdp
41 2 -> debug error, no kdb
42 1 -> very little, panic only
44 #ifndef HFS_DIAGNOSTIC
45 #define HFS_DIAGNOSTIC 0
46 #endif /* HFS_DIAGNOSTIC */
48 #ifndef HFS_DEBUG_STAGE
50 #define HFS_DEBUG_STAGE 4
52 #define HFS_DEBUG_STAGE 1
54 #endif /* HFS_DEBUG_STAGE */
57 #define PRINTIT kprintf
59 #define PRINTIT printf
62 #if (HFS_DEBUG_STAGE > 3)
63 #define DEBUG_BREAK Debugger("");
68 #if (HFS_DEBUG_STAGE == 4)
69 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; DEBUG_BREAK };
70 #elif (HFS_DEBUG_STAGE == 3)
71 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { panic PRINTF_ARGS;};
73 #define DEBUG_BREAK_MSG(PRINTF_ARGS) { PRINTIT PRINTF_ARGS; };
77 //#define PRINT_DELAY (void) tsleep((caddr_t)&lbolt, PPAUSE, "hfs kprintf", 0)
84 extern int hfs_dbg_all
;
85 extern int hfs_dbg_err
;
88 #if (HFS_DEBUG_STAGE == 4)
89 char gDebugAssertStr
[255];
90 #define DBG_ASSERT(a) { if (!(a)) { \
91 sprintf(gDebugAssertStr,"Oops - File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); \
92 Debugger(gDebugAssertStr); } }
94 #define DBG_ASSERT(a) { if (!(a)) { panic("File "__FILE__", line %d: assertion '%s' failed.\n", __LINE__, #a); } }
95 #endif /* HFS_DEBUG_STAGE */
97 #define DBG_ASSERT(a) assert(a)
100 #define DBG_ERR(x) { \
101 if(hfs_dbg_all || hfs_dbg_err) { \
102 PRINTIT("%X: ", proc_selfpid()); \
103 PRINTIT("HFS ERROR: "); \
109 #else /* HFS_DIAGNOSTIC */
111 #define DBG_ASSERT(a)
114 #endif /* HFS_DIAGNOSTIC */