11
11
#define NDEBUG
12
12
#include <debug.h>
13
13
14
- //
15
- // Retrieves the ComponentId and Level for BREAKPOINT_PRINT
16
- // and OutputString and OutputStringLength for BREAKPOINT_PROMPT.
17
- //
18
- #if defined(_X86_ )
19
-
20
- //
21
- // EBX/EDI on x86
22
- //
23
- #define KdpGetParameterThree (Context ) ((Context)->Ebx)
24
- #define KdpGetParameterFour (Context ) ((Context)->Edi)
25
-
26
- #elif defined(_AMD64_ )
27
-
28
- //
29
- // R8/R9 on AMD64
30
- //
31
- #define KdpGetParameterThree (Context ) ((Context)->R8)
32
- #define KdpGetParameterFour (Context ) ((Context)->R9)
33
-
34
- #elif defined(_ARM_ )
35
-
36
- //
37
- // R3/R4 on ARM
38
- //
39
- #define KdpGetParameterThree (Context ) ((Context)->R3)
40
- #define KdpGetParameterFour (Context ) ((Context)->R4)
41
-
42
- #else
43
- #error Unsupported Architecture
44
- #endif
45
-
46
14
/* VARIABLES ***************************************************************/
47
15
48
16
VOID NTAPI PspDumpThreads (BOOLEAN SystemThreads );
@@ -52,109 +20,40 @@ extern ANSI_STRING KdpLogFileName;
52
20
53
21
/* PRIVATE FUNCTIONS *********************************************************/
54
22
55
- BOOLEAN
23
+ VOID
56
24
NTAPI
57
- KdpTrap (IN PKTRAP_FRAME TrapFrame ,
58
- IN PKEXCEPTION_FRAME ExceptionFrame ,
59
- IN PEXCEPTION_RECORD ExceptionRecord ,
60
- IN PCONTEXT Context ,
61
- IN KPROCESSOR_MODE PreviousMode ,
62
- IN BOOLEAN SecondChance )
25
+ KdpReportCommandStringStateChange (IN PSTRING NameString ,
26
+ IN PSTRING CommandString ,
27
+ IN OUT PCONTEXT Context )
63
28
{
64
- KD_CONTINUE_TYPE Return = kdHandleException ;
65
- ULONG ExceptionCommand = ExceptionRecord -> ExceptionInformation [0 ];
66
-
67
- /* Check if this was a breakpoint due to DbgPrint or Load/UnloadSymbols */
68
- if ((ExceptionRecord -> ExceptionCode == STATUS_BREAKPOINT ) &&
69
- (ExceptionRecord -> NumberParameters > 0 ) &&
70
- ((ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS ) ||
71
- (ExceptionCommand == BREAKPOINT_UNLOAD_SYMBOLS ) ||
72
- (ExceptionCommand == BREAKPOINT_COMMAND_STRING ) ||
73
- (ExceptionCommand == BREAKPOINT_PRINT ) ||
74
- (ExceptionCommand == BREAKPOINT_PROMPT )))
75
- {
76
- /* Check if this is a debug print */
77
- if (ExceptionCommand == BREAKPOINT_PRINT )
78
- {
79
- /* Call KDBG */
80
- NTSTATUS ReturnStatus ;
81
- BOOLEAN Handled ;
82
- ReturnStatus = KdpPrint ((ULONG )KdpGetParameterThree (Context ),
83
- (ULONG )KdpGetParameterFour (Context ),
84
- (PCHAR )ExceptionRecord -> ExceptionInformation [1 ],
85
- (USHORT )ExceptionRecord -> ExceptionInformation [2 ],
86
- PreviousMode ,
87
- TrapFrame ,
88
- ExceptionFrame ,
89
- & Handled );
90
-
91
- /* Update the return value for the caller */
92
- KeSetContextReturnRegister (Context , ReturnStatus );
93
- }
94
- #ifdef KDBG
95
- else if (ExceptionCommand == BREAKPOINT_LOAD_SYMBOLS )
96
- {
97
- PKD_SYMBOLS_INFO SymbolsInfo ;
98
- KD_SYMBOLS_INFO CapturedSymbolsInfo ;
99
- PLDR_DATA_TABLE_ENTRY LdrEntry ;
100
-
101
- SymbolsInfo = (PKD_SYMBOLS_INFO )ExceptionRecord -> ExceptionInformation [2 ];
102
- if (PreviousMode != KernelMode )
103
- {
104
- _SEH2_TRY
105
- {
106
- ProbeForRead (SymbolsInfo ,
107
- sizeof (* SymbolsInfo ),
108
- 1 );
109
- KdpMoveMemory (& CapturedSymbolsInfo ,
110
- SymbolsInfo ,
111
- sizeof (* SymbolsInfo ));
112
- SymbolsInfo = & CapturedSymbolsInfo ;
113
- }
114
- _SEH2_EXCEPT (EXCEPTION_EXECUTE_HANDLER )
115
- {
116
- SymbolsInfo = NULL ;
117
- }
118
- _SEH2_END ;
119
- }
29
+ }
120
30
121
- if (SymbolsInfo != NULL )
122
- {
123
- /* Load symbols. Currently implemented only for KDBG! */
124
- if (KdbpSymFindModule (SymbolsInfo -> BaseOfDll , NULL , -1 , & LdrEntry ))
125
- {
126
- KdbSymProcessSymbols (LdrEntry );
127
- }
128
- }
129
- }
130
- else if (ExceptionCommand == BREAKPOINT_PROMPT )
131
- {
132
- /* Call KDBG */
133
- ULONG ReturnLength ;
134
- ReturnLength = KdpPrompt ((PCHAR )ExceptionRecord -> ExceptionInformation [1 ],
135
- (USHORT )ExceptionRecord -> ExceptionInformation [2 ],
136
- (PCHAR )KdpGetParameterThree (Context ),
137
- (USHORT )KdpGetParameterFour (Context ),
138
- PreviousMode ,
139
- TrapFrame ,
140
- ExceptionFrame );
141
-
142
- /* Update the return value for the caller */
143
- KeSetContextReturnRegister (Context , ReturnLength );
144
- }
145
- #endif
31
+ VOID
32
+ NTAPI
33
+ KdpReportLoadSymbolsStateChange (IN PSTRING PathName ,
34
+ IN PKD_SYMBOLS_INFO SymbolInfo ,
35
+ IN BOOLEAN Unload ,
36
+ IN OUT PCONTEXT Context )
37
+ {
38
+ }
146
39
147
- /* This we can handle: simply bump the Program Counter */
148
- KeSetContextPc (Context , KeGetContextPc (Context ) + KD_BREAKPOINT_SIZE );
149
- return TRUE;
150
- }
40
+ BOOLEAN
41
+ NTAPI
42
+ KdpReport (IN PKTRAP_FRAME TrapFrame ,
43
+ IN PKEXCEPTION_FRAME ExceptionFrame ,
44
+ IN PEXCEPTION_RECORD ExceptionRecord ,
45
+ IN PCONTEXT ContextRecord ,
46
+ IN KPROCESSOR_MODE PreviousMode ,
47
+ IN BOOLEAN SecondChanceException )
48
+ {
49
+ KD_CONTINUE_TYPE Return = kdHandleException ;
151
50
152
51
#ifdef KDBG
153
52
/* Check if this is an assertion failure */
154
53
if (ExceptionRecord -> ExceptionCode == STATUS_ASSERTION_FAILURE )
155
54
{
156
55
/* Bump EIP to the instruction following the int 2C */
157
- Context -> Eip += 2 ;
56
+ ContextRecord -> Eip += 2 ;
158
57
}
159
58
#endif
160
59
@@ -165,15 +64,15 @@ KdpTrap(IN PKTRAP_FRAME TrapFrame,
165
64
/* Call KDBG if available */
166
65
Return = KdbEnterDebuggerException (ExceptionRecord ,
167
66
PreviousMode ,
168
- Context ,
67
+ ContextRecord ,
169
68
TrapFrame ,
170
- !SecondChance );
69
+ !SecondChanceException );
171
70
#else /* not KDBG */
172
71
if (WrapperInitRoutine )
173
72
{
174
73
/* Call GDB */
175
74
Return = WrapperTable .KdpExceptionRoutine (ExceptionRecord ,
176
- Context ,
75
+ ContextRecord ,
177
76
TrapFrame );
178
77
}
179
78
0 commit comments