xref: /reactos/ntoskrnl/include/internal/dbgk.h (revision 4561998a)
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 INIT_FUNCTION
50 VOID
51 NTAPI
52 DbgkInitialize(
53     VOID
54 );
55 
56 VOID
57 NTAPI
58 DbgkCreateThread(
59     IN PETHREAD Thread,
60     IN PVOID StartAddress
61 );
62 
63 VOID
64 NTAPI
65 DbgkExitProcess(
66     IN NTSTATUS ExitStatus
67 );
68 
69 VOID
70 NTAPI
71 DbgkExitThread(
72     IN NTSTATUS ExitStatus
73 );
74 
75 VOID
76 NTAPI
77 DbgkMapViewOfSection(
78     IN PVOID Section,
79     IN PVOID BaseAddress,
80     IN ULONG SectionOffset,
81     IN ULONG_PTR ViewSize
82 );
83 
84 VOID
85 NTAPI
86 DbgkUnMapViewOfSection(
87     IN PVOID BaseAddress
88 );
89 
90 BOOLEAN
91 NTAPI
92 DbgkpSuspendProcess(
93     VOID
94 );
95 
96 VOID
97 NTAPI
98 DbgkpResumeProcess(
99     VOID
100 );
101 
102 NTSTATUS
103 NTAPI
104 DbgkpSendApiMessage(
105     IN OUT PDBGKM_MSG ApiMsg,
106     IN BOOLEAN SuspendProcess
107 );
108 
109 HANDLE
110 NTAPI
111 DbgkpSectionToFileHandle(
112     IN PVOID Section
113 );
114 
115 VOID
116 NTAPI
117 DbgkCopyProcessDebugPort(
118     IN PEPROCESS Process,
119     IN PEPROCESS Parent
120 );
121 
122 BOOLEAN
123 NTAPI
124 DbgkForwardException(
125     IN PEXCEPTION_RECORD ExceptionRecord,
126     IN BOOLEAN DebugPort,
127     IN BOOLEAN SecondChance
128 );
129 
130 NTSTATUS
131 NTAPI
132 DbgkClearProcessDebugObject(
133     IN PEPROCESS Process,
134     IN PDEBUG_OBJECT SourceDebugObject
135 );
136 
137 NTSTATUS
138 NTAPI
139 DbgkOpenProcessDebugPort(
140     IN PEPROCESS Process,
141     IN KPROCESSOR_MODE PreviousMode,
142     OUT HANDLE *DebugHandle
143 );
144 
145 extern ULONG DbgkpTraceLevel;
146 extern POBJECT_TYPE DbgkDebugObjectType;
147 
148 /* EOF */
149