00039 :
00040
00041 This routine
is called whenever a exception
is dispatched and
the kernel
00042 debugger
is active.
00043
00044 Arguments:
00045
00046 TrapFrame - Supplies a pointer to a trap frame that describes
the
00047 trap.
00048
00049 ExceptionFrame - Supplies a pointer to a exception frame that describes
00050
the trap.
00051
00052 ExceptionRecord - Supplies a pointer to an exception record that
00053 describes
the exception.
00054
00055 ContextRecord - Supplies
the context at
the time of
the exception.
00056
00057 PreviousMode - Supplies
the previous processor mode.
00058
00059 SecondChance - Supplies a
boolean value that determines whether
this is
00060
the second chance (TRUE) that the exception has been raised.
00061
00062 Return Value:
00063
00064 A value of TRUE is returned if the exception is handled. Otherwise a
00065 value of FALSE is returned.
00066
00067 --*/
00068
00069 {
00070
00071 BOOLEAN Completion;
00072 BOOLEAN Enable;
00073 BOOLEAN UnloadSymbols =
FALSE;
00074 STRING Input;
00075 ULONGLONG OldFir;
00076 STRING Output;
00077 PKPRCB Prcb;
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
if ((ExceptionRecord->ExceptionCode == STATUS_BREAKPOINT) &&
00089 (ExceptionRecord->ExceptionInformation[0] >= DEBUG_PRINT_BREAKPOINT)){
00090
00091
00092
00093
00094
00095
switch (ExceptionRecord->ExceptionInformation[0]) {
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
case DEBUG_PRINT_BREAKPOINT:
00107 ContextRecord->Fir += 4;
00108 Output.Buffer = (PCHAR)ContextRecord->IntA0;
00109 Output.Length = (
USHORT)ContextRecord->IntA1;
00110
00111
KdLogDbgPrint(&Output);
00112
00113
if (
KdDebuggerNotPresent ==
FALSE) {
00114
00115 Enable =
KdEnterDebugger(TrapFrame, ExceptionFrame);
00116
if (
KdpPrintString(&Output)) {
00117 ContextRecord->IntV0 = (ULONG)STATUS_BREAKPOINT;
00118 }
else {
00119 ContextRecord->IntV0 = (ULONG)STATUS_SUCCESS;
00120 }
00121
KdExitDebugger(Enable);
00122
00123 }
else {
00124 ContextRecord->IntV0 = (ULONG)STATUS_DEVICE_NOT_CONNECTED;
00125 }
00126
00127
return TRUE;
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
case BREAKIN_BREAKPOINT:
00138 ContextRecord->Fir += 4;
00139
break;
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
case DEBUG_PROMPT_BREAKPOINT:
00151 ContextRecord->Fir += 4;
00152 Output.Buffer = (PCHAR)ContextRecord->IntA0;
00153 Output.Length = (
USHORT)ContextRecord->IntA1;
00154 Input.Buffer = (PCHAR)ContextRecord->IntA2;
00155 Input.MaximumLength = (
USHORT)ContextRecord->IntA3;
00156
00157
KdLogDbgPrint(&Output);
00158
00159 Enable =
KdEnterDebugger(TrapFrame, ExceptionFrame);
00160
00161
KdpPromptString(&Output, &Input);
00162
00163 ContextRecord->IntV0 = Input.Length;
00164
00165
KdExitDebugger(Enable);
00166
return TRUE;
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
case DEBUG_UNLOAD_SYMBOLS_BREAKPOINT:
00179 UnloadSymbols =
TRUE;
00180
00181
00182
00183
00184
00185
case DEBUG_LOAD_SYMBOLS_BREAKPOINT:
00186 Enable =
KdEnterDebugger(TrapFrame, ExceptionFrame);
00187 Prcb =
KeGetCurrentPrcb();
00188 OldFir = ContextRecord->Fir;
00189 RtlCopyMemory(&Prcb->ProcessorState.ContextFrame,
00190 ContextRecord,
00191
sizeof(CONTEXT));
00192
00193
if (
KdDebuggerNotPresent ==
FALSE) {
00194
KdpReportLoadSymbolsStateChange((PSTRING)ContextRecord->IntA0,
00195 (
PKD_SYMBOLS_INFO) ContextRecord->IntA1,
00196 UnloadSymbols,
00197 &Prcb->ProcessorState.ContextFrame);
00198
00199 }
00200
00201 RtlCopyMemory(ContextRecord,
00202 &Prcb->ProcessorState.ContextFrame,
00203
sizeof(CONTEXT));
00204
00205
KdExitDebugger(Enable);
00206
00207
00208
00209
00210
00211
00212
if (ContextRecord->Fir == OldFir) {
00213 ContextRecord->Fir += 4;
00214 }
00215
00216
return TRUE;
00217
00218
00219
00220
00221
00222
default:
00223
break;
00224 }
00225 }
00226
00227
00228
00229
00230
00231 Enable =
KdEnterDebugger(TrapFrame, ExceptionFrame);
00232 Prcb =
KeGetCurrentPrcb();
00233
00234 RtlCopyMemory(&Prcb->ProcessorState.ContextFrame,
00235 ContextRecord,
00236 sizeof (CONTEXT));
00237
00238 Completion =
KdpReportExceptionStateChange(ExceptionRecord,
00239 &Prcb->ProcessorState.ContextFrame,
00240 SecondChance);
00241
00242 RtlCopyMemory(ContextRecord,
00243 &Prcb->ProcessorState.ContextFrame,
00244
sizeof(CONTEXT));
00245
00246
KdExitDebugger(Enable);
00247
00248
KdpControlCPressed =
FALSE;
00249
00250
00251
00252
00253
00254
00255
00256
if( SecondChance ){
00257
return Completion;
00258 }
else {
00259
return TRUE;
00260 }
00261 }