mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[NTOS:KDBG] Split KdbInitialize into KdbSymInit and KDBG initialization proper.
- KdbSymInit() in kdb_symbols.c only initializes symbols implementation support. - The rest of KdbInitialize gets moved into kdb_cli.c and initializes the KDBG debugger itself. - Move KdbDebugPrint to kdb_cli.c as well.
This commit is contained in:
parent
793e9f20ef
commit
dfb6996b45
5 changed files with 80 additions and 56 deletions
|
@ -78,11 +78,7 @@ KdpDebugLogInit(
|
|||
_In_ ULONG BootPhase);
|
||||
|
||||
#ifdef KDBG
|
||||
VOID
|
||||
NTAPI
|
||||
KdpKdbgInit(
|
||||
_In_ struct _KD_DISPATCH_TABLE *DispatchTable,
|
||||
_In_ ULONG BootPhase);
|
||||
#define KdpKdbgInit KdbInitialize
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -577,24 +577,6 @@ KdpScreenInit(
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef KDBG
|
||||
/* KDBG FUNCTIONS ************************************************************/
|
||||
|
||||
/* NOTE: This may be moved completely into kdb_symbols.c */
|
||||
VOID NTAPI
|
||||
KdbInitialize(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase);
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdpKdbgInit(
|
||||
_In_ PKD_DISPATCH_TABLE DispatchTable,
|
||||
_In_ ULONG BootPhase)
|
||||
{
|
||||
/* Forward the call */
|
||||
KdbInitialize(DispatchTable, BootPhase);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* GENERAL FUNCTIONS *********************************************************/
|
||||
|
||||
|
|
|
@ -82,6 +82,12 @@ KdbpStackSwitchAndCall(
|
|||
|
||||
extern PCHAR KdbInitFileBuffer;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdbInitialize(
|
||||
_In_ PKD_DISPATCH_TABLE DispatchTable,
|
||||
_In_ ULONG BootPhase);
|
||||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
KdbRegisterCliCallback(
|
||||
|
@ -158,14 +164,17 @@ KdbpSymFindModule(
|
|||
BOOLEAN
|
||||
KdbSymPrintAddress(
|
||||
IN PVOID Address,
|
||||
IN PCONTEXT Context
|
||||
);
|
||||
IN PCONTEXT Context);
|
||||
|
||||
VOID
|
||||
KdbSymProcessSymbols(
|
||||
_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||
_In_ BOOLEAN Load);
|
||||
|
||||
VOID
|
||||
KdbSymInit(
|
||||
_In_ ULONG BootPhase);
|
||||
|
||||
/* from kdb.c */
|
||||
|
||||
extern PEPROCESS KdbCurrentProcess;
|
||||
|
|
|
@ -3880,3 +3880,50 @@ KdbpCliInit(VOID)
|
|||
|
||||
ExFreePool(FileBuffer);
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
NTAPI
|
||||
KdbDebugPrint(
|
||||
PCH Message,
|
||||
ULONG Length)
|
||||
{
|
||||
/* Nothing here */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initializes the KDBG debugger.
|
||||
*
|
||||
* @param[in] DispatchTable
|
||||
* Pointer to the KD dispatch table.
|
||||
*
|
||||
* @param[in] BootPhase
|
||||
* Phase of initialization.
|
||||
*
|
||||
* @return None.
|
||||
* @note Also known as "KdpKdbgInit".
|
||||
**/
|
||||
VOID
|
||||
NTAPI
|
||||
KdbInitialize(
|
||||
_In_ PKD_DISPATCH_TABLE DispatchTable,
|
||||
_In_ ULONG BootPhase)
|
||||
{
|
||||
if (BootPhase == 0)
|
||||
{
|
||||
/* Write out the functions that we support for now */
|
||||
DispatchTable->KdpInitRoutine = KdbInitialize;
|
||||
DispatchTable->KdpPrintRoutine = KdbDebugPrint;
|
||||
|
||||
/* Register as a Provider */
|
||||
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
|
||||
}
|
||||
|
||||
if (BootPhase <= 1)
|
||||
{
|
||||
/* Initialize symbols support */
|
||||
KdbSymInit(BootPhase);
|
||||
}
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
|
|
@ -330,31 +330,19 @@ KdbSymProcessSymbols(
|
|||
KeSetEvent(&SymbolsToLoadEvent, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
KdbDebugPrint(
|
||||
PCH Message,
|
||||
ULONG Length)
|
||||
{
|
||||
/* Nothing here */
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Initializes the KDB symbols implementation.
|
||||
/**
|
||||
* @brief Initializes the KDB symbols implementation.
|
||||
*
|
||||
* \param DispatchTable Pointer to the KD dispatch table
|
||||
* \param BootPhase Phase of initialization
|
||||
*/
|
||||
* @param[in] BootPhase
|
||||
* Phase of initialization.
|
||||
*
|
||||
* @return None.
|
||||
**/
|
||||
VOID
|
||||
NTAPI
|
||||
KdbInitialize(
|
||||
_In_ PKD_DISPATCH_TABLE DispatchTable,
|
||||
KdbSymInit(
|
||||
_In_ ULONG BootPhase)
|
||||
{
|
||||
PCHAR p1, p2;
|
||||
SHORT Found = FALSE;
|
||||
CHAR YesNo;
|
||||
|
||||
DPRINT("KdbSymInit() BootPhase=%d\n", BootPhase);
|
||||
|
||||
LoadSymbols = FALSE;
|
||||
|
@ -367,19 +355,16 @@ KdbInitialize(
|
|||
|
||||
if (BootPhase == 0)
|
||||
{
|
||||
/* Write out the functions that we support for now */
|
||||
DispatchTable->KdpInitRoutine = KdbInitialize;
|
||||
DispatchTable->KdpPrintRoutine = KdbDebugPrint;
|
||||
|
||||
/* Register as a Provider */
|
||||
InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
|
||||
PCHAR p1, p2;
|
||||
SHORT Found = FALSE;
|
||||
CHAR YesNo;
|
||||
|
||||
/* Perform actual initialization of symbol module */
|
||||
//NtoskrnlModuleObject->PatchInformation = NULL;
|
||||
//LdrHalModuleObject->PatchInformation = NULL;
|
||||
|
||||
/* Check the command line for /LOADSYMBOLS, /NOLOADSYMBOLS,
|
||||
* /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */
|
||||
* /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */
|
||||
ASSERT(KeLoaderBlock);
|
||||
p1 = KeLoaderBlock->LoadOptions;
|
||||
while ('\0' != *p1 && NULL != (p2 = strchr(p1, '/')))
|
||||
|
@ -425,13 +410,18 @@ KdbInitialize(
|
|||
HANDLE Thread;
|
||||
NTSTATUS Status;
|
||||
KIRQL OldIrql;
|
||||
PLIST_ENTRY ListEntry;
|
||||
|
||||
/* Launch our worker thread */
|
||||
InitializeListHead(&SymbolsToLoad);
|
||||
KeInitializeSpinLock(&SymbolsToLoadLock);
|
||||
KeInitializeEvent(&SymbolsToLoadEvent, SynchronizationEvent, FALSE);
|
||||
|
||||
Status = PsCreateSystemThread(&Thread, THREAD_ALL_ACCESS, NULL, NULL, NULL, LoadSymbolsRoutine, NULL);
|
||||
Status = PsCreateSystemThread(&Thread,
|
||||
THREAD_ALL_ACCESS,
|
||||
NULL, NULL, NULL,
|
||||
LoadSymbolsRoutine,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("Failed starting symbols loader thread: 0x%08x\n", Status);
|
||||
|
@ -443,12 +433,12 @@ KdbInitialize(
|
|||
|
||||
KeAcquireSpinLock(&PsLoadedModuleSpinLock, &OldIrql);
|
||||
|
||||
PLIST_ENTRY ListEntry = PsLoadedModuleList.Flink;
|
||||
while (ListEntry != &PsLoadedModuleList)
|
||||
for (ListEntry = PsLoadedModuleList.Flink;
|
||||
ListEntry != &PsLoadedModuleList;
|
||||
ListEntry = ListEntry->Flink)
|
||||
{
|
||||
PLDR_DATA_TABLE_ENTRY LdrEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
|
||||
KdbSymProcessSymbols(LdrEntry, TRUE);
|
||||
ListEntry = ListEntry->Flink;
|
||||
}
|
||||
|
||||
KeReleaseSpinLock(&PsLoadedModuleSpinLock, OldIrql);
|
||||
|
|
Loading…
Reference in a new issue