ReactOS  0.4.14-dev-1036-g3c5b10f
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 479 of file kdb_symbols.c.

482 {
483  PCHAR p1, p2;
484  SHORT Found = FALSE;
485  CHAR YesNo;
486  PLDR_DATA_TABLE_ENTRY LdrEntry;
487 
488  DPRINT("KdbSymInit() BootPhase=%d\n", BootPhase);
489 
490  LoadSymbols = FALSE;
491 
492 #if DBG
493  /* Load symbols only if we have 96Mb of RAM or more */
494  if (MmNumberOfPhysicalPages >= 0x6000)
495  LoadSymbols = TRUE;
496 #endif
497 
498  if (BootPhase == 0)
499  {
500  /* Write out the functions that we support for now */
501  DispatchTable->KdpInitRoutine = KdpKdbgInit;
502  DispatchTable->KdpPrintRoutine = KdbDebugPrint;
503 
504  /* Register as a Provider */
505  InsertTailList(&KdProviders, &DispatchTable->KdProvidersList);
506 
507  /* Perform actual initialization of symbol module */
508  //NtoskrnlModuleObject->PatchInformation = NULL;
509  //LdrHalModuleObject->PatchInformation = NULL;
510 
513 
514  /* Check the command line for /LOADSYMBOLS, /NOLOADSYMBOLS,
515  * /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */
518  while('\0' != *p1 && NULL != (p2 = strchr(p1, '/')))
519  {
520  p2++;
521  Found = 0;
522  if (0 == _strnicmp(p2, "LOADSYMBOLS", 11))
523  {
524  Found = +1;
525  p2 += 11;
526  }
527  else if (0 == _strnicmp(p2, "NOLOADSYMBOLS", 13))
528  {
529  Found = -1;
530  p2 += 13;
531  }
532  if (0 != Found)
533  {
534  while (isspace(*p2))
535  {
536  p2++;
537  }
538  if ('=' == *p2)
539  {
540  p2++;
541  while (isspace(*p2))
542  {
543  p2++;
544  }
545  YesNo = toupper(*p2);
546  if ('N' == YesNo || 'F' == YesNo || '0' == YesNo)
547  {
548  Found = -1 * Found;
549  }
550  }
551  LoadSymbols = (0 < Found);
552  }
553  p1 = p2;
554  }
555 
557  }
558  else if (BootPhase == 1)
559  {
560  /* Load symbols for NTOSKRNL.EXE.
561  It is always the first module in PsLoadedModuleList. KeLoaderBlock can't be used here as its content is just temporary. */
562  LdrEntry = CONTAINING_RECORD(PsLoadedModuleList.Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
563  KdbSymProcessSymbols(LdrEntry);
564 
565  /* Also load them for HAL.DLL. */
566  LdrEntry = CONTAINING_RECORD(PsLoadedModuleList.Flink->Flink, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
567  KdbSymProcessSymbols(LdrEntry);
568 
570  }
571 }
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
#define TRUE
Definition: types.h:120
VOID NTAPI KdpKdbgInit(PKD_DISPATCH_TABLE DispatchTable, ULONG BootPhase)
Definition: kdbg.c:21
char CHAR
Definition: xmlstorage.h:175
#define InsertTailList(ListHead, Entry)
LIST_ENTRY KdProviders
Definition: kdinit.c:29
static KSPIN_LOCK SymbolFileListLock
Definition: kdb_symbols.c:31
short SHORT
Definition: pedump.c:59
_Check_return_ _CRTIMP int __cdecl _strnicmp(_In_reads_or_z_(_MaxCount) const char *_Str1, _In_reads_or_z_(_MaxCount) const char *_Str2, _In_ size_t _MaxCount)
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:464
struct _LIST_ENTRY * Flink
Definition: typedefs.h:120
int toupper(int c)
Definition: utclib.c:881
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:34
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
VOID KdbSymProcessSymbols(IN PLDR_DATA_TABLE_ENTRY LdrEntry)
Definition: kdb_symbols.c:424
Definition: btrfs_drv.h:1853
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:479
static LSA_DISPATCH_TABLE DispatchTable
Definition: authpackage.c:164

Referenced by KdbInitialize().