ReactOS  0.4.15-dev-1201-gb2cf5a4
kdbg.c File Reference
#include <ntoskrnl.h>
#include <debug.h>
Include dependency graph for kdbg.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

VOID NTAPI KdbInitialize (PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
 Initializes the KDB symbols implementation. More...
 
VOID NTAPI KdpKdbgInit (PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 11 of file kdbg.c.

Function Documentation

◆ KdbInitialize()

VOID NTAPI KdbInitialize ( PKD_DISPATCH_TABLE  DispatchTable,
ULONG  BootPhase 
)

Initializes the KDB symbols implementation.

Parameters
DispatchTablePointer to the KD dispatch table
BootPhasePhase of initialization

Definition at line 481 of file kdb_symbols.c.

484 {
485  PCHAR p1, p2;
486  SHORT Found = FALSE;
487  CHAR YesNo;
488  PLDR_DATA_TABLE_ENTRY LdrEntry;
489 
490  DPRINT("KdbSymInit() BootPhase=%d\n", BootPhase);
491 
492  LoadSymbols = FALSE;
493 
494 #if DBG
495  /* Load symbols only if we have 96Mb of RAM or more */
496  if (MmNumberOfPhysicalPages >= 0x6000)
497  LoadSymbols = TRUE;
498 #endif
499 
500  if (BootPhase == 0)
501  {
502  /* Write out the functions that we support for now */
503  DispatchTable->KdpInitRoutine = KdpKdbgInit;
504  DispatchTable->KdpPrintRoutine = KdbDebugPrint;
505 
506  /* Register as a Provider */
507  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
508 
509  /* Perform actual initialization of symbol module */
510  //NtoskrnlModuleObject->PatchInformation = NULL;
511  //LdrHalModuleObject->PatchInformation = NULL;
512 
515 
516  /* Check the command line for /LOADSYMBOLS, /NOLOADSYMBOLS,
517  * /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */
520  while('\0' != *p1 && NULL != (p2 = strchr(p1, '/')))
521  {
522  p2++;
523  Found = 0;
524  if (0 == _strnicmp(p2, "LOADSYMBOLS", 11))
525  {
526  Found = +1;
527  p2 += 11;
528  }
529  else if (0 == _strnicmp(p2, "NOLOADSYMBOLS", 13))
530  {
531  Found = -1;
532  p2 += 13;
533  }
534  if (0 != Found)
535  {
536  while (isspace(*p2))
537  {
538  p2++;
539  }
540  if ('=' == *p2)
541  {
542  p2++;
543  while (isspace(*p2))
544  {
545  p2++;
546  }
547  YesNo = toupper(*p2);
548  if ('N' == YesNo || 'F' == YesNo || '0' == YesNo)
549  {
550  Found = -1 * Found;
551  }
552  }
553  LoadSymbols = (0 < Found);
554  }
555  p1 = p2;
556  }
557 
559  }
560  else if (BootPhase == 1)
561  {
562  /* Load symbols for NTOSKRNL.EXE.
563  It is always the first module in PsLoadedModuleList. KeLoaderBlock can't be used here as its content is just temporary. */
564  LdrEntry = CONTAINING_RECORD(PsLoadedModuleList.Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
565  KdbSymProcessSymbols(LdrEntry);
566 
567  /* Also load them for HAL.DLL. */
568  LdrEntry = CONTAINING_RECORD(PsLoadedModuleList.Flink->Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
569  KdbSymProcessSymbols(LdrEntry);
570 
572  }
573 }
signed char * PCHAR
Definition: retypes.h:7
BOOLEAN KdbpSymbolsInitialized
Definition: kdb_symbols.c:32
#define isspace(c)
Definition: acclib.h:69
VOID RosSymInitKernelMode(VOID)
Definition: initkm.c:32
VOID NTAPI KdpKdbgInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdbg.c:21
#define TRUE
Definition: types.h:120
char CHAR
Definition: xmlstorage.h:175
#define InsertTailList(ListHead, Entry)
LIST_ENTRY KdProviders
Definition: kdinit.c:29
#define FALSE
Definition: types.h:117
static KSPIN_LOCK SymbolFileListLock
Definition: kdb_symbols.c:31
short SHORT
Definition: pedump.c:59
FORCEINLINE VOID KeInitializeSpinLock(_Out_ PKSPIN_LOCK SpinLock)
Definition: kefuncs.h:238
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
return Found
Definition: dirsup.c:1270
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
VOID NTAPI KdbDebugPrint(PCH Message, ULONG Length)
Definition: kdb_symbols.c:466
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
int toupper(int c)
Definition: utclib.c:881
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:34
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID KdbSymProcessSymbols(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: kdb_symbols.c:426
Definition: btrfs_drv.h:1922
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
static LSA_DISPATCH_TABLE DispatchTable
Definition: authpackage.c:164
char * strchr(const char *String, int ch)
Definition: utclib.c:501
static BOOLEAN LoadSymbols
Definition: kdb_symbols.c:29
static LIST_ENTRY SymbolFileListHead
Definition: kdb_symbols.c:30

Referenced by KdpKdbgInit().

◆ KdpKdbgInit()

VOID NTAPI KdpKdbgInit ( PKD_DISPATCH_TABLE  DispatchTable,
ULONG  BootPhase 
)

Definition at line 21 of file kdbg.c.

23 {
24 #ifdef KDBG
25  /* Forward the call */
26  KdbInitialize(DispatchTable, BootPhase);
27 #else
28  /* When KDBG is disabled, it is not used/initialized at all */
29 #endif
30 }
VOID NTAPI KdbInitialize(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Initializes the KDB symbols implementation.
Definition: kdb_symbols.c:481
static LSA_DISPATCH_TABLE DispatchTable
Definition: authpackage.c:164

Referenced by KdbInitialize().