- Correct the value of SIZE_OF_FX_REGISTERS -- it was 4 times too low which resulted in KeContextToTrapFrame not properly clearing out the XMM register area. Correct the define and move it out from ke.h to x86's ketypes.h and use it in the FXSAVE format structure. Also remove the IOPM definitions from ke.h as they have been in the NDK for a while.
- KD uses STRINGs, not ANSI_STRINGs -- they are the same thing, but let's be consistent.
- ExceptionRecord32To64 should be available for both 32 and 64 bit builds (and it shouldn't be a forceinline). Get rid of CopyExceptionRecord and determine if we need to convert or can just copy it directly instead.
- Use _WIN64 instead of _M_AMD64 when determining if we need to set the DBGKD_VERS_FLAG_PTR64 flag.
- Don't check Nt/DbgQueryDebugFilterState for zero or nonzero -- it actually returns TRUE, FALSE or STATUS_INVALID_PARAMETER_1! Check for != TRUE in preparation for proper implementation of NtSet/QueryDebugFilterState.
- Fix Format parameter of DbgPrintReturnControlC -- it is const like the other DbgPrint* routines.
- Be consistent with the types used in debug.c and don't set local variables to zero if we are going to return to caller -- this doesn't seem to be required anymore.
- Fix DebugService and DebugService2: DebugService should take a ULONG followed by 4 pointers and DebugService2 doesn't return anything.
- Use ZwCurrentProcess() instead of -1 or 0xFFFFFFFF (which is incorrect for 64-bit) for the ProcessId parameter of DbgLoad/UnloadImageSymbols to clarify what is being passed. Don't use ZwCurrentProcess() in KeBugCheckWithTf for the pointer parameter of DbgUnLoadImageSymbols either. Use MAXULONG_PTR casted to PVOID instead.
- Use better named and sized variables in KdpTrap for setting the "return register" in the caller's CONTEXT.
- Correct and clarify the comment documenting under what conditions we pass user mode exceptions to the kernel debugger.
svn path=/trunk/; revision=43741
vDbgPrintEx(
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap);
ULONG
NTAPI
vDbgPrintExWithPrefix(
- IN LPCSTR Prefix,
+ IN PCCH Prefix,
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap);
NTKERNELAPI
ULONG
DDKCDECLAPI
DbgPrintReturnControlC(
- IN PCH Format,
+ IN PCCH Format,
IN ...);
ULONG
(USHORT)(sizeof(KTSS)) : \
(USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
+//
+// Size of the XMM register save area in the FXSAVE format
+//
+#define SIZE_OF_FX_REGISTERS 128
+
//
// Static Kernel-Mode Address start (use MM_KSEG0_BASE for actual)
//
ULONG DataSelector;
ULONG MXCsr;
ULONG MXCsrMask;
- UCHAR RegisterArea[128];
+ UCHAR RegisterArea[SIZE_OF_FX_REGISTERS];
UCHAR Reserved3[128];
UCHAR Reserved4[224];
UCHAR Align16Byte[8];
VOID
NTAPI
DbgLoadImageSymbols(
- IN PANSI_STRING Name,
+ IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId
);
VOID
NTAPI
DbgUnLoadImageSymbols(
- IN PANSI_STRING Name,
+ IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId
);
DBGKM_EXCEPTION32 Exception;
DBGKD_LOAD_SYMBOLS32 LoadSymbols;
} u;
- DBGKD_CONTROL_REPORT ControlReport;
- CONTEXT Context;
} DBGKD_WAIT_STATE_CHANGE32, *PDBGKD_WAIT_STATE_CHANGE32;
typedef struct _DBGKD_WAIT_STATE_CHANGE64
DBGKM_EXCEPTION64 Exception;
DBGKD_LOAD_SYMBOLS64 LoadSymbols;
} u;
- DBGKD_CONTROL_REPORT ControlReport;
- CONTEXT Context;
} DBGKD_WAIT_STATE_CHANGE64, *PDBGKD_WAIT_STATE_CHANGE64;
typedef struct _DBGKD_ANY_WAIT_STATE_CHANGE
} u;
} DBGKD_TRACE_IO, *PDBGKD_TRACE_IO;
-#if defined(_M_AMD64)
-
-#define CopyExceptionRecord(Ex64From, Ex64To) \
- RtlCopyMemory(Ex64To, Ex64From, sizeof(EXCEPTION_RECORD64))
-
-#else
-
-FORCEINLINE
+static
+__inline
VOID
+NTAPI
ExceptionRecord32To64(IN PEXCEPTION_RECORD32 Ex32,
OUT PEXCEPTION_RECORD64 Ex64)
{
}
}
-#define CopyExceptionRecord(Ex32From, Ex64To) \
- ExceptionRecord32To64((PEXCEPTION_RECORD32)Ex32From, Ex64To)
-
-#endif
-
#endif
UINT Length;
PCHAR Buffer;
- if (!(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) ||
- !(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK))) {
+ if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE) ||
+ (DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_TCP | DPFLTR_MASK) != TRUE)) {
return;
}
PNDIS_BUFFER NextBuffer;
PCHAR CharBuffer;
- if (!(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK)) ||
- !(DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK))) {
+ if ((DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_PBUFFER | DPFLTR_MASK) != TRUE) ||
+ (DbgQueryDebugFilterState(DPFLTR_TCPIP_ID, DEBUG_IP | DPFLTR_MASK) != TRUE)) {
return;
}
/* PRIVATE FUNCTIONS ********************************************************/
-NTSTATUS
+ULONG
NTAPI
-DebugPrint(IN PANSI_STRING DebugString,
+DebugPrint(IN PSTRING DebugString,
IN ULONG ComponentId,
IN ULONG Level)
{
/* Call the Debug Service */
return DebugService(BREAKPOINT_PRINT,
DebugString->Buffer,
- DebugString->Length,
+ UlongToPtr(DebugString->Length),
UlongToPtr(ComponentId),
UlongToPtr(Level));
}
-NTSTATUS
+ULONG
NTAPI
-DebugPrompt(IN PCSTRING Output,
+DebugPrompt(IN PSTRING Output,
IN PSTRING Input)
{
/* Call the Debug Service */
return DebugService(BREAKPOINT_PROMPT,
Output->Buffer,
- Output->Length,
+ UlongToPtr(Output->Length),
Input->Buffer,
UlongToPtr(Input->MaximumLength));
}
ULONG
NTAPI
-vDbgPrintExWithPrefixInternal(IN LPCSTR Prefix,
+vDbgPrintExWithPrefixInternal(IN PCCH Prefix,
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap,
IN BOOLEAN HandleBreakpoint)
{
NTSTATUS Status;
- ANSI_STRING DebugString;
+ STRING DebugString;
CHAR Buffer[512];
ULONG Length, PrefixLength;
EXCEPTION_RECORD ExceptionRecord;
/* Check if we should print it or not */
if ((ComponentId != MAXULONG) &&
- !(NtQueryDebugFilterState(ComponentId, Level)))
+ (NtQueryDebugFilterState(ComponentId, Level)) != TRUE)
{
/* This message is masked */
return STATUS_SUCCESS;
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
{
/* Fail */
- Length = PrefixLength = 0;
_SEH2_YIELD(return _SEH2_GetExceptionCode());
}
_SEH2_END;
*/
ULONG
NTAPI
-vDbgPrintExWithPrefix(IN LPCSTR Prefix,
+vDbgPrintExWithPrefix(IN PCCH Prefix,
IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap)
{
/* Call the internal routine that also handles ControlC */
NTAPI
vDbgPrintEx(IN ULONG ComponentId,
IN ULONG Level,
- IN LPCSTR Format,
+ IN PCCH Format,
IN va_list ap)
{
/* Call the internal routine that also handles ControlC */
DbgPrint(PCCH Format,
...)
{
- ULONG n;
+ ULONG Status;
va_list ap;
/* Call the internal routine that also handles ControlC */
va_start(ap, Format);
- n = vDbgPrintExWithPrefixInternal("",
- -1,
- DPFLTR_ERROR_LEVEL,
- Format,
- ap,
- TRUE);
+ Status = vDbgPrintExWithPrefixInternal("",
+ -1,
+ DPFLTR_ERROR_LEVEL,
+ Format,
+ ap,
+ TRUE);
va_end(ap);
- return n;
+ return Status;
}
/*
IN PCCH Format,
...)
{
- ULONG n;
+ ULONG Status;
va_list ap;
/* Call the internal routine that also handles ControlC */
va_start(ap, Format);
- n = vDbgPrintExWithPrefixInternal("",
- ComponentId,
- Level,
- Format,
- ap,
- TRUE);
+ Status = vDbgPrintExWithPrefixInternal("",
+ ComponentId,
+ Level,
+ Format,
+ ap,
+ TRUE);
va_end(ap);
- return n;
+ return Status;
}
/*
*/
ULONG
__cdecl
-DbgPrintReturnControlC(PCH Format,
+DbgPrintReturnControlC(PCCH Format,
...)
{
- ULONG n;
+ ULONG Status;
va_list ap;
/* Call the internal routine that also handles ControlC */
va_start(ap, Format);
- n = vDbgPrintExWithPrefixInternal("",
- -1,
- DPFLTR_ERROR_LEVEL,
- Format,
- ap,
- FALSE);
+ Status = vDbgPrintExWithPrefixInternal("",
+ -1,
+ DPFLTR_ERROR_LEVEL,
+ Format,
+ ap,
+ FALSE);
va_end(ap);
- return n;
+ return Status;
}
/*
OUT PCH Response,
IN ULONG MaximumResponseLength)
{
- CSTRING Output;
+ STRING Output;
STRING Input;
/* Setup the input string */
/* Setup the output string */
Output.Length = strlen(Prompt);
- Output.Buffer = Prompt;
+ Output.Buffer = (PCH)Prompt;
/* Call the system service */
return DebugPrompt(&Output, &Input);
*/
VOID
NTAPI
-DbgLoadImageSymbols(IN PANSI_STRING Name,
+DbgLoadImageSymbols(IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId)
{
/* Setup the symbol data */
SymbolInfo.BaseOfDll = Base;
- SymbolInfo.ProcessId = (ULONG)ProcessId;
+ SymbolInfo.ProcessId = ProcessId;
/* Get NT Headers */
NtHeader = RtlImageNtHeader(Base);
*/
VOID
NTAPI
-DbgUnLoadImageSymbols(IN PANSI_STRING Name,
+DbgUnLoadImageSymbols(IN PSTRING Name,
IN PVOID Base,
IN ULONG_PTR ProcessId)
{
/* Setup the symbol data */
SymbolInfo.BaseOfDll = Base;
- SymbolInfo.ProcessId = (ULONG)ProcessId;
+ SymbolInfo.ProcessId = ProcessId;
SymbolInfo.CheckSum = SymbolInfo.SizeOfImage = 0;
/* Load the symbols */
VOID
DbgBreakPointWithStatus(ULONG Status) { __asm__("ti 31,0,0"); }
-NTSTATUS
+ULONG
NTAPI
DebugService
-(ULONG Service, const void *Buffer, ULONG Length, PVOID Arg1, PVOID Arg2)
+(ULONG Service, PVOID Argument1, PVOID Argument1, PVOID Argument3, PVOID Argument4)
{
- NTSTATUS Result;
+ ULONG Result;
__asm__("mr 0,%1\n\t"
"mr 3,%2\n\t"
"mr 4,%3\n\t"
"=r" (Result) :
"r" (0x10000),
"r" (Service),
- "r" (Buffer),
- "r" (Length),
- "r" (Arg1),
- "r" (Arg2) );
+ "r" (Argument1),
+ "r" (Argument2),
+ "r" (Argument3),
+ "r" (Argument4) );
return Result;
}
-NTSTATUS
+VOID
NTAPI
DebugService2
(PVOID Arg1, PVOID Arg2, ULONG Service)
{
- return STATUS_SUCCESS;
}
NTAPI
RtlpCaptureContext(OUT PCONTEXT ContextRecord);
-/* i386/debug.S */
-NTSTATUS
-NTAPI
-DebugService(IN ULONG Service,
- IN const void* Buffer,
- IN ULONG Length,
- IN PVOID Argument1,
- IN PVOID Argument2);
+//
+// Debug Service calls
+//
+ULONG
+NTAPI
+DebugService(
+ IN ULONG Service,
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN PVOID Argument3,
+ IN PVOID Argument4
+);
-NTSTATUS
+VOID
NTAPI
-DebugService2(IN PVOID Argument1,
- IN PVOID Argument2,
- IN ULONG Service);
+DebugService2(
+ IN PVOID Argument1,
+ IN PVOID Argument2,
+ IN ULONG Service
+);
/* Tags for the String Allocators */
#define TAG_USTR 'RTSU'
PLDR_DATA_TABLE_ENTRY LdrEntry;
BOOLEAN OverFlow = FALSE;
CHAR NameBuffer[256];
- ANSI_STRING SymbolString;
+ STRING SymbolString;
/* Loop the driver list */
NextEntry = LoaderBlock->LoadOrderListHead.Flink;
/* Check if the buffer was ok */
if (!OverFlow)
{
- /* Initialize the ANSI_STRING for the debugger */
+ /* Initialize the STRING for the debugger */
RtlInitString(&SymbolString, NameBuffer);
/* Load the symbols */
DbgLoadImageSymbols(&SymbolString,
LdrEntry->DllBase,
- 0xFFFFFFFF);
+ (ULONG_PTR)ZwCurrentProcess());
}
}
NTAPI
KdpSymbol(
IN PSTRING DllPath,
- IN PKD_SYMBOLS_INFO DllBase,
+ IN PKD_SYMBOLS_INFO SymbolInfo,
IN BOOLEAN Unload,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
VOID
NTAPI
KdpSetContextState(
- IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+ IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context
);
/* One of the Reserved Wait Blocks, this one is for the Thread's Timer */
#define TIMER_WAIT_BLOCK 0x3L
-/* IOPM Definitions */
-#define IO_ACCESS_MAP_NONE 0
-#define IOPM_OFFSET FIELD_OFFSET(KTSS, IoMaps[0].IoMap)
-#define KiComputeIopmOffset(MapNumber) \
- (MapNumber == IO_ACCESS_MAP_NONE) ? \
- (USHORT)(sizeof(KTSS)) : \
- (USHORT)(FIELD_OFFSET(KTSS, IoMaps[MapNumber-1].IoMap))
-
-#define SIZE_OF_FX_REGISTERS 32
-
/* INTERNAL KERNEL FUNCTIONS ************************************************/
VOID
if (ComponentId == KdComponentTable[i].ComponentId)
{
/* Check if mask are matching */
- return (Level & KdComponentTable[i].Level) != 0;
+ return (Level & KdComponentTable[i].Level) ? TRUE : FALSE;
}
}
}
/* Entry not found in the table, use default mask */
- return (Level & Kd_DEFAULT_MASK) != 0;
+ return (Level & Kd_DEFAULT_MASK) ? TRUE : FALSE;
}
NTSTATUS
VOID
NTAPI
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context)
{
UNIMPLEMENTED;
VOID
NTAPI
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context)
{
UNIMPLEMENTED;
VOID
NTAPI
-KdpSetContextState(IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange,
+KdpSetContextState(IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange,
IN PCONTEXT Context)
{
PKPRCB Prcb = KeGetCurrentPrcb();
NTAPI
KdpSetCommonState(IN ULONG NewState,
IN PCONTEXT Context,
- IN PDBGKD_WAIT_STATE_CHANGE64 WaitStateChange)
+ IN PDBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange)
{
USHORT InstructionCount;
BOOLEAN HadBreakpoints;
WaitStateChange->Thread = (ULONG64)(LONG_PTR)KeGetCurrentThread();
WaitStateChange->ProgramCounter = (ULONG64)(LONG_PTR)KeGetContextPc(Context);
- /* Zero out the Control Report */
- RtlZeroMemory(&WaitStateChange->ControlReport,
- sizeof(DBGKD_CONTROL_REPORT));
+ /* Zero out the entire Control Report */
+ RtlZeroMemory(&WaitStateChange->AnyControlReport,
+ sizeof(DBGKD_ANY_CONTROL_REPORT));
/* Now copy the instruction stream and set the count */
RtlCopyMemory(&WaitStateChange->ControlReport.InstructionStream[0],
{
PSTRING ExtraData;
STRING Data, Header;
- DBGKD_WAIT_STATE_CHANGE64 WaitStateChange;
+ DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
KCONTINUE_STATUS Status;
/* Start wait loop */
}
/* Setup the header */
- Header.Length = sizeof(DBGKD_WAIT_STATE_CHANGE64);
+ Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
Header.Buffer = (PCHAR)&WaitStateChange;
/* Send the packet */
IN BOOLEAN SecondChanceException)
{
STRING Header, Data;
- DBGKD_WAIT_STATE_CHANGE64 WaitStateChange;
+ DBGKD_ANY_WAIT_STATE_CHANGE WaitStateChange;
KCONTINUE_STATUS Status;
/* Start report loop */
KdpSetCommonState(DbgKdExceptionStateChange, Context, &WaitStateChange);
/* Copy the Exception Record and set First Chance flag */
- CopyExceptionRecord(ExceptionRecord,
- &WaitStateChange.u.Exception.ExceptionRecord);
+#if !defined(_WIN64)
+ ExceptionRecord32To64((PEXCEPTION_RECORD32)ExceptionRecord,
+ &WaitStateChange.u.Exception.ExceptionRecord);
+#else
+ RtlCopyMemory(&WaitStateChange.u.Exception.ExceptionRecord,
+ ExceptionRecord,
+ sizeof(EXCEPTION_RECORD));
+#endif
WaitStateChange.u.Exception.FirstChance = !SecondChanceException;
/* Now finish creating the structure */
KdpSetContextState(&WaitStateChange, Context);
/* Setup the actual header to send to KD */
- Header.Length = sizeof(DBGKD_WAIT_STATE_CHANGE64);
+ Header.Length = sizeof(DBGKD_ANY_WAIT_STATE_CHANGE);
Header.Buffer = (PCHAR)&WaitStateChange;
/* Setup the trace data */
return KdDebuggerNotPresent;
}
+/*
+ * @unimplemented
+ */
NTSTATUS
NTAPI
-NtQueryDebugFilterState(ULONG ComponentId,
- ULONG Level)
+NtQueryDebugFilterState(IN ULONG ComponentId,
+ IN ULONG Level)
{
/* HACK */
return STATUS_SUCCESS;
}
+/*
+ * @unimplemented
+ */
NTSTATUS
NTAPI
-NtSetDebugFilterState(ULONG ComponentId,
- ULONG Level,
- BOOLEAN State)
+NtSetDebugFilterState(IN ULONG ComponentId,
+ IN ULONG Level,
+ IN BOOLEAN State)
{
/* HACK */
return STATUS_SUCCESS;
0,
DBGKD_64BIT_PROTOCOL_VERSION2,
CURRENT_KD_SECONDARY_VERSION,
-#if defined(_M_AMD64)
+#if defined(_WIN64)
DBGKD_VERS_FLAG_DATA | DBGKD_VERS_FLAG_PTR64,
#else
DBGKD_VERS_FLAG_DATA,
{
BOOLEAN EnableKd, DisableKdAfterInit = FALSE, BlockEnable;
LPSTR CommandLine, DebugLine, DebugOptionStart, DebugOptionEnd;
- ANSI_STRING ImageName;
+ STRING ImageName;
PLDR_DATA_TABLE_ENTRY LdrEntry;
PLIST_ENTRY NextEntry;
ULONG i, j, Length, DebugOptionLength;
NameBuffer[j] = ANSI_NULL;
/* Load symbols for image */
- RtlInitAnsiString(&ImageName, NameBuffer);
- DbgLoadImageSymbols(&ImageName, LdrEntry->DllBase, -1);
+ RtlInitString(&ImageName, NameBuffer);
+ DbgLoadImageSymbols(&ImageName,
+ LdrEntry->DllBase,
+ (ULONG_PTR)ZwCurrentProcess());
/* Go to the next entry */
NextEntry = NextEntry->Flink;
VOID
NTAPI
KdpSymbol(IN PSTRING DllPath,
- IN PKD_SYMBOLS_INFO DllBase,
+ IN PKD_SYMBOLS_INFO SymbolInfo,
IN BOOLEAN Unload,
IN KPROCESSOR_MODE PreviousMode,
IN PCONTEXT ContextRecord,
/* Report the new state */
Status = KdpReportLoadSymbolsStateChange(DllPath,
- DllBase,
+ SymbolInfo,
Unload,
&Prcb->ProcessorState.
ContextFrame);
{
NTSTATUS ReturnStatus;
BOOLEAN Entered;
- ANSI_STRING AnsiString;
+ STRING OutputString;
/* Assume failure */
*Status = FALSE;
/* FIXME: Support user-mode */
}
- /* Setup the ANSI string */
- AnsiString.Buffer = String;
- AnsiString.Length = Length;
+ /* Setup the output string */
+ OutputString.Buffer = String;
+ OutputString.Length = Length;
/* Log the print */
- //KdLogDbgPrint(&AnsiString);
+ //KdLogDbgPrint(&OutputString);
/* Check for a debugger */
if (KdDebuggerNotPresent)
Entered = KdEnterDebugger(TrapFrame, ExceptionFrame);
/* Print the string */
- if (KdpPrintString(&AnsiString))
+ if (KdpPrintString(&OutputString))
{
/* User pressed CTRL-C, breakpoint on return */
ReturnStatus = STATUS_BREAKPOINT;
IN BOOLEAN SecondChanceException)
{
BOOLEAN Unload = FALSE;
- ULONG_PTR ProgramCounter, ReturnValue;
+ ULONG_PTR ProgramCounter;
BOOLEAN Status = FALSE;
+ NTSTATUS ReturnStatus;
+ USHORT ReturnLength;
/*
* Check if we got a STATUS_BREAKPOINT with a SubID for Print, Prompt or
case BREAKPOINT_PRINT:
/* Call the worker routine */
- ReturnValue = KdpPrint((ULONG)KdpGetFirstParameter(ContextRecord),
- (ULONG)KdpGetSecondParameter(ContextRecord),
- (LPSTR)ExceptionRecord->
- ExceptionInformation[1],
- (USHORT)ExceptionRecord->
- ExceptionInformation[2],
- PreviousMode,
- TrapFrame,
- ExceptionFrame,
- &Status);
+ ReturnStatus = KdpPrint((ULONG)KdpGetFirstParameter(ContextRecord),
+ (ULONG)KdpGetSecondParameter(ContextRecord),
+ (LPSTR)ExceptionRecord->
+ ExceptionInformation[1],
+ (USHORT)ExceptionRecord->
+ ExceptionInformation[2],
+ PreviousMode,
+ TrapFrame,
+ ExceptionFrame,
+ &Status);
/* Update the return value for the caller */
- KeSetContextReturnRegister(ContextRecord, ReturnValue);
+ KeSetContextReturnRegister(ContextRecord, ReturnStatus);
break;
/* DbgPrompt */
case BREAKPOINT_PROMPT:
/* Call the worker routine */
- ReturnValue = KdpPrompt((LPSTR)ExceptionRecord->
- ExceptionInformation[1],
- (USHORT)ExceptionRecord->
- ExceptionInformation[2],
- (LPSTR)KdpGetFirstParameter(ContextRecord),
- (USHORT)KdpGetSecondParameter(ContextRecord),
- PreviousMode,
- TrapFrame,
- ExceptionFrame);
+ ReturnLength = KdpPrompt((LPSTR)ExceptionRecord->
+ ExceptionInformation[1],
+ (USHORT)ExceptionRecord->
+ ExceptionInformation[2],
+ (LPSTR)KdpGetFirstParameter(ContextRecord),
+ (USHORT)KdpGetSecondParameter(ContextRecord),
+ PreviousMode,
+ TrapFrame,
+ ExceptionFrame);
Status = TRUE;
/* Update the return value for the caller */
- KeSetContextReturnRegister(ContextRecord, ReturnValue);
+ KeSetContextReturnRegister(ContextRecord, ReturnLength);
break;
/* DbgUnLoadImageSymbols */
if (Reboot)
{
/* Unload symbols */
- DbgUnLoadImageSymbols(NULL, NtCurrentProcess(), 0);
+ DbgUnLoadImageSymbols(NULL, (PVOID)MAXULONG_PTR, 0);
HalReturnToFirmware(HalRebootRoutine);
}
{
/*
* Break into the kernel debugger unless a user mode debugger
- * is present or user mode exceptions are ignored, unless this is
- * a breakpoint or a debug service in which case we have to
- * handle it.
+ * is present or user mode exceptions are ignored, except if this
+ * is a debug service which we must always pass to KD
*/
if ((!(PsGetCurrentProcess()->DebugPort) &&
!(KdIgnoreUmExceptions)) ||
PLDR_DATA_TABLE_ENTRY LdrEntry = ImageHandle;
PVOID BaseAddress = LdrEntry->DllBase;
NTSTATUS Status;
- ANSI_STRING TempName;
+ STRING TempName;
BOOLEAN HadEntry = FALSE;
/* Acquire the loader lock */
if (NT_SUCCESS(Status))
{
/* Unload the symbols */
- DbgUnLoadImageSymbols(&TempName, BaseAddress, -1);
+ DbgUnLoadImageSymbols(&TempName,
+ BaseAddress,
+ (ULONG_PTR)ZwCurrentProcess());
RtlFreeAnsiString(&TempName);
}
}
BOOLEAN LockOwned = FALSE;
PLIST_ENTRY NextEntry;
IMAGE_INFO ImageInfo;
- ANSI_STRING AnsiTemp;
+ STRING AnsiTemp;
PAGED_CODE();
/* Detect session-load */
RtlInitString(&AnsiTemp, Buffer);
/* Notify the debugger */
- DbgLoadImageSymbols(&AnsiTemp, LdrEntry->DllBase, -1);
+ DbgLoadImageSymbols(&AnsiTemp,
+ LdrEntry->DllBase,
+ (ULONG_PTR)ZwCurrentProcess());
LdrEntry->Flags |= LDRP_DEBUG_SYMBOLS_LOADED;
}