xref: /reactos/ntoskrnl/include/internal/dbgk.h (revision 8a978a17)
1 /*
2  * PROJECT:         ReactOS Kernel
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * FILE:            ntoskrnl/include/internal/dbgk.h
5  * PURPOSE:         Internal header for the User-Mode Debugging Backend
6  * PROGRAMMERS:     Alex Ionescu (alex.ionescu@reactos.org)
7  */
8 
9 //
10 // Define this if you want debugging support
11 //
12 #define _DBGK_DEBUG_                                    0x00
13 
14 //
15 // These define the Debug Masks Supported
16 //
17 #define DBGK_THREAD_DEBUG                               0x01
18 #define DBGK_PROCESS_DEBUG                              0x02
19 #define DBGK_OBJECT_DEBUG                               0x04
20 #define DBGK_MESSAGE_DEBUG                              0x08
21 #define DBGK_EXCEPTION_DEBUG                            0x10
22 
23 //
24 // Debug/Tracing support
25 //
26 #if _DBGK_DEBUG_
27 #ifdef NEW_DEBUG_SYSTEM_IMPLEMENTED // enable when Debug Filters are implemented
28 #define DBGKTRACE(x, ...)                                   \
29     {                                                       \
30         DbgPrintEx("%s [%.16s] - ",                         \
31                    __FUNCTION__,                            \
32                    PsGetCurrentProcess()->ImageFileName);   \
33         DbgPrintEx(__VA_ARGS__);                            \
34     }
35 #else
36 #define DBGKTRACE(x, ...)                                   \
37     if (x & DbgkpTraceLevel)                                \
38     {                                                       \
39         DbgPrint("%s [%.16s] - ",                           \
40                  __FUNCTION__,                              \
41                  PsGetCurrentProcess()->ImageFileName);     \
42         DbgPrint(__VA_ARGS__);                              \
43     }
44 #endif
45 #else
46 #define DBGKTRACE(x, fmt, ...) DPRINT(fmt, ##__VA_ARGS__)
47 #endif
48 
49 VOID
50 NTAPI
51 DbgkInitialize(
52     VOID
53 );
54 
55 VOID
56 NTAPI
57 DbgkCreateThread(
58     IN PETHREAD Thread,
59     IN PVOID StartAddress
60 );
61 
62 VOID
63 NTAPI
64 DbgkExitProcess(
65     IN NTSTATUS ExitStatus
66 );
67 
68 VOID
69 NTAPI
70 DbgkExitThread(
71     IN NTSTATUS ExitStatus
72 );
73 
74 VOID
75 NTAPI
76 DbgkMapViewOfSection(
77     IN PVOID Section,
78     IN PVOID BaseAddress,
79     IN ULONG SectionOffset,
80     IN ULONG_PTR ViewSize
81 );
82 
83 VOID
84 NTAPI
85 DbgkUnMapViewOfSection(
86     IN PVOID BaseAddress
87 );
88 
89 BOOLEAN
90 NTAPI
91 DbgkpSuspendProcess(
92     VOID
93 );
94 
95 VOID
96 NTAPI
97 DbgkpResumeProcess(
98     VOID
99 );
100 
101 NTSTATUS
102 NTAPI
103 DbgkpSendApiMessage(
104     IN OUT PDBGKM_MSG ApiMsg,
105     IN BOOLEAN SuspendProcess
106 );
107 
108 HANDLE
109 NTAPI
110 DbgkpSectionToFileHandle(
111     IN PVOID Section
112 );
113 
114 VOID
115 NTAPI
116 DbgkCopyProcessDebugPort(
117     IN PEPROCESS Process,
118     IN PEPROCESS Parent
119 );
120 
121 BOOLEAN
122 NTAPI
123 DbgkForwardException(
124     IN PEXCEPTION_RECORD ExceptionRecord,
125     IN BOOLEAN DebugPort,
126     IN BOOLEAN SecondChance
127 );
128 
129 NTSTATUS
130 NTAPI
131 DbgkClearProcessDebugObject(
132     IN PEPROCESS Process,
133     IN PDEBUG_OBJECT SourceDebugObject
134 );
135 
136 NTSTATUS
137 NTAPI
138 DbgkOpenProcessDebugPort(
139     IN PEPROCESS Process,
140     IN KPROCESSOR_MODE PreviousMode,
141     OUT HANDLE *DebugHandle
142 );
143 
144 extern ULONG DbgkpTraceLevel;
145 extern POBJECT_TYPE DbgkDebugObjectType;
146 
147 /* EOF */
148