https://git.reactos.org/?p=reactos.git;a=commitdiff;h=de892d5bc715d68af757a…
commit de892d5bc715d68af757a36173e9f99e7927115f
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Tue Mar 14 00:51:03 2023 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Tue Mar 14 01:17:42 2023 +0100
[NTOS:KDBG] Fix the support for /(NO)LOADSYMBOLS as we didn't respect them
properly.
LoadSymbols was reset to its default value whenever KdbSymInit() was
called, thus we would e.g. load symbols even if /NOLOADSYMBOLS or
/LOADSYMBOLS=NO were specified at the command line.
---
ntoskrnl/kdbg/kdb_symbols.c | 33 ++++++++++++++++++++-------------
1 file changed, 20 insertions(+), 13 deletions(-)
diff --git a/ntoskrnl/kdbg/kdb_symbols.c b/ntoskrnl/kdbg/kdb_symbols.c
index 46294733d89..2ac4d29b30f 100644
--- a/ntoskrnl/kdbg/kdb_symbols.c
+++ b/ntoskrnl/kdbg/kdb_symbols.c
@@ -26,7 +26,7 @@ typedef struct _IMAGE_SYMBOL_INFO_CACHE
}
IMAGE_SYMBOL_INFO_CACHE, *PIMAGE_SYMBOL_INFO_CACHE;
-static BOOLEAN LoadSymbols;
+static BOOLEAN LoadSymbols = FALSE;
static LIST_ENTRY SymbolsToLoad;
static KSPIN_LOCK SymbolsToLoadLock;
static KEVENT SymbolsToLoadEvent;
@@ -345,23 +345,22 @@ KdbSymInit(
{
DPRINT("KdbSymInit() BootPhase=%d\n", BootPhase);
- LoadSymbols = FALSE;
-
-#if DBG
- /* Load symbols only if we have 96Mb of RAM or more */
- if (MmNumberOfPhysicalPages >= 0x6000)
- LoadSymbols = TRUE;
-#endif
-
if (BootPhase == 0)
{
PCHAR p1, p2;
SHORT Found = FALSE;
CHAR YesNo;
- /* Perform actual initialization of symbol module */
- //NtoskrnlModuleObject->PatchInformation = NULL;
- //LdrHalModuleObject->PatchInformation = NULL;
+ /*
+ * Default symbols loading strategy:
+ * In DBG builds, load symbols only if we have 96MB of RAM or more.
+ * In REL builds, do not load them by default.
+ */
+#if DBG
+ LoadSymbols = (MmNumberOfPhysicalPages >= 0x6000);
+#else
+ LoadSymbols = FALSE;
+#endif
/* Check the command line for /LOADSYMBOLS, /NOLOADSYMBOLS,
* /LOADSYMBOLS={YES|NO}, /NOLOADSYMBOLS={YES|NO} */
@@ -405,13 +404,21 @@ KdbSymInit(
p1 = p2;
}
}
- else if ((BootPhase == 1) && LoadSymbols)
+ else if (BootPhase == 1)
{
HANDLE Thread;
NTSTATUS Status;
KIRQL OldIrql;
PLIST_ENTRY ListEntry;
+ /* Do not load symbols if we have less than 96MB of RAM */
+ if (MmNumberOfPhysicalPages < 0x6000)
+ LoadSymbols = FALSE;
+
+ /* Continue this phase only if we need to load symbols */
+ if (!LoadSymbols)
+ return;
+
/* Launch our worker thread */
InitializeListHead(&SymbolsToLoad);
KeInitializeSpinLock(&SymbolsToLoadLock);