Use free Windows DDK and compile with latest MinGW releases.
[reactos.git] / reactos / include / win32k / debug1.h
1 /*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: include/internal/debug.h
5 * PURPOSE: Useful debugging macros
6 * PROGRAMMER: David Welch (welch@mcmail.com)
7 * UPDATE HISTORY:
8 * 28/05/98: Created
9 */
10
11 /*
12 * NOTE: Define NDEBUG before including this header to disable debugging
13 * macros
14 */
15
16 #ifndef __INTERNAL_DEBUG
17 #define __INTERNAL_DEBUG
18
19 #define UNIMPLEMENTED do {DbgPrint("%s at %s:%d is unimplemented, have a nice day\n",__FUNCTION__,__FILE__,__LINE__); for(;;); } while(0);
20
21 /* FIXME: should probably remove this later */
22 #if !defined(CHECKED) && !defined(NDEBUG)
23 #define CHECKED
24 #endif
25
26 #undef ASSERT
27 #undef assert
28
29 #ifndef NASSERT
30 #define assert(x) if (!(x)) {DbgPrint("Assertion "#x" failed at %s:%d\n", __FILE__,__LINE__); KeBugCheck(0); }
31 #define ASSERT(x) assert(x)
32 #else
33 #define assert(x)
34 #define ASSERT(x)
35 #endif
36
37 #define DPRINT1(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); ExAllocatePool(NonPagedPool,0); } while(0);
38 #define CHECKPOINT1 do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
39
40 extern unsigned int old_idt[256][2];
41 //extern unsigned int idt;
42 extern unsigned int old_idt_valid;
43
44 #ifdef __NTOSKRNL__
45 //#define DPRINT_CHECKS ExAllocatePool(NonPagedPool,0); assert(old_idt_valid || (!memcmp(old_idt,KiIdt,256*2)));
46 //#define DPRINT_CHECKS ExAllocatePool(NonPagedPool,0);
47 #define DPRINT_CHECKS
48 #else
49 #define DPRINT_CHECKS
50 #endif
51
52 #ifndef NDEBUG
53 #define OLD_DPRINT(fmt,args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(fmt,args); } while(0);
54 #define DPRINT(args...) do { DbgPrint("(%s:%d) ",__FILE__,__LINE__); DbgPrint(args); DPRINT_CHECKS } while(0);
55 #define CHECKPOINT do { DbgPrint("%s:%d\n",__FILE__,__LINE__); ExAllocatePool(NonPagedPool,0); } while(0);
56 #else
57 //#define DPRINT(args...) do { DPRINT_CHECKS } while (0);
58 #define DPRINT(args...)
59 #define OLD_DPRINT(args...)
60 #define CHECKPOINT
61 #endif /* NDEBUG */
62
63 /*
64 * FUNCTION: Assert a maximum value for the current irql
65 * ARGUMENTS:
66 * x = Maximum irql
67 */
68 #define ASSERT_IRQL(x) assert(KeGetCurrentIrql()<=(x))
69 #define assert_irql(x) assert(KeGetCurrentIrql()<=(x))
70
71 #define HBP_EXECUTE (0)
72 #define HBP_WRITE (1)
73 #define HBP_READWRITE (3)
74
75 #define HBP_BYTE (0)
76 #define HBP_WORD (1)
77 #define HBP_DWORD (3)
78
79 /*
80 * FUNCTION: Sets a hardware breakpoint
81 * ARGUMENTS:
82 * i = breakpoint to set (0 to 3)
83 * addr = linear address to break on
84 * type = Type of access to break on
85 * len = length of the variable to watch
86 * NOTES:
87 * The variable to watch must be aligned to its length (i.e. a dword
88 * breakpoint must be aligned to a dword boundary)
89 *
90 * A fatal exception will be generated on the access to the variable.
91 * It is (at the moment) only really useful for catching undefined
92 * pointers if you know the variable effected but not the buggy
93 * routine.
94 *
95 * FIXME: Extend to call out to kernel debugger on breakpoint
96 * Add support for I/O breakpoints
97 * REFERENCES: See the i386 programmer manual for more details
98 */
99 void set_breakpoint(unsigned int i, unsigned int addr, unsigned int type,
100 unsigned int len);
101
102
103 #endif /* __INTERNAL_DEBUG */