ReactOS 0.4.16-dev-297-gc569aee
kdb_symbols.c File Reference
#include <ntoskrnl.h>
#include "kdb.h"
#include "debug.h"
Include dependency graph for kdb_symbols.c:

Go to the source code of this file.

Classes

struct  _IMAGE_SYMBOL_INFO_CACHE
 

Macros

#define NDEBUG
 

Typedefs

typedef struct _IMAGE_SYMBOL_INFO_CACHE IMAGE_SYMBOL_INFO_CACHE
 
typedef struct _IMAGE_SYMBOL_INFO_CACHEPIMAGE_SYMBOL_INFO_CACHE
 

Functions

static BOOLEAN KdbpSymSearchModuleList (IN PLIST_ENTRY current_entry, IN PLIST_ENTRY end_entry, IN PLONG Count, IN PVOID Address, IN INT Index, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
 
BOOLEAN KdbpSymFindModule (IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
 Find a module...
 
static PCHAR NTAPI KdbpSymUnicodeToAnsi (IN PUNICODE_STRING Unicode, OUT PCHAR Ansi, IN ULONG Length)
 
BOOLEAN KdbSymPrintAddress (IN PVOID Address, IN PCONTEXT Context)
 Print address...
 
_Use_decl_annotations_ VOID NTAPI LoadSymbolsRoutine (_In_ PVOID Context)
 The symbol loader thread routine. This opens the image file for reading and loads the symbols section from there.
 
VOID KdbSymProcessSymbols (_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry, _In_ BOOLEAN Load)
 Load symbols from image mapping. If this fails,.
 
BOOLEAN KdbSymInit (_In_ ULONG BootPhase)
 Initializes the KDB symbols implementation.
 

Variables

static BOOLEAN LoadSymbols = FALSE
 
static LIST_ENTRY SymbolsToLoad
 
static KSPIN_LOCK SymbolsToLoadLock
 
static KEVENT SymbolsToLoadEvent
 
static KSTART_ROUTINE LoadSymbolsRoutine
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 16 of file kdb_symbols.c.

Typedef Documentation

◆ IMAGE_SYMBOL_INFO_CACHE

◆ PIMAGE_SYMBOL_INFO_CACHE

Function Documentation

◆ KdbpSymFindModule()

BOOLEAN KdbpSymFindModule ( IN PVOID Address  OPTIONAL,
IN INT Index  OPTIONAL,
OUT PLDR_DATA_TABLE_ENTRY pLdrEntry 
)

Find a module...

Parameters
AddressIf Address is not NULL the module containing Address is searched.
NameIf Name is not NULL the module named Name will be searched.
IndexIf Index is >= 0 the Index'th module will be returned.
pLdrEntryPointer to a PLDR_DATA_TABLE_ENTRY which is filled.
Return values
TRUEModule was found, pLdrEntry was filled.
FALSENo module was found.

Definition at line 76 of file kdb_symbols.c.

80{
81 LONG Count = 0;
82 PEPROCESS CurrentProcess;
83
84 /* First try to look up the module in the kernel module list. */
88 &Count,
89 Address,
90 Index,
91 pLdrEntry))
92 {
94 return TRUE;
95 }
97
98 /* That didn't succeed. Try the module list of the current process now. */
99 CurrentProcess = PsGetCurrentProcess();
100
101 if(!CurrentProcess || !CurrentProcess->Peb || !CurrentProcess->Peb->Ldr)
102 return FALSE;
103
104 return KdbpSymSearchModuleList(CurrentProcess->Peb->Ldr->InLoadOrderModuleList.Flink,
105 &CurrentProcess->Peb->Ldr->InLoadOrderModuleList,
106 &Count,
107 Address,
108 Index,
109 pLdrEntry);
110}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOLEAN KdbpSymSearchModuleList(IN PLIST_ENTRY current_entry, IN PLIST_ENTRY end_entry, IN PLONG Count, IN PVOID Address, IN INT Index, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Definition: kdb_symbols.c:39
int Count
Definition: noreturn.cpp:7
long LONG
Definition: pedump.c:60
static WCHAR Address[46]
Definition: ping.c:68
KSPIN_LOCK PsLoadedModuleSpinLock
Definition: sysldr.c:23
LIST_ENTRY PsLoadedModuleList
Definition: sysldr.c:21
#define KeAcquireSpinLockAtDpcLevel(SpinLock)
Definition: ke.h:125
#define KeReleaseSpinLockFromDpcLevel(SpinLock)
Definition: ke.h:135
struct _PEB * Peb
Definition: pstypes.h:1345
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
_In_ WDFCOLLECTION _In_ ULONG Index
#define PsGetCurrentProcess
Definition: psfuncs.h:17

Referenced by KdbpCmdMod(), KdbSymPrintAddress(), and KdSendPacket().

◆ KdbpSymSearchModuleList()

static BOOLEAN KdbpSymSearchModuleList ( IN PLIST_ENTRY  current_entry,
IN PLIST_ENTRY  end_entry,
IN PLONG  Count,
IN PVOID  Address,
IN INT  Index,
OUT PLDR_DATA_TABLE_ENTRY pLdrEntry 
)
static

Definition at line 39 of file kdb_symbols.c.

46{
47 while (current_entry && current_entry != end_entry)
48 {
49 *pLdrEntry = CONTAINING_RECORD(current_entry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
50
51 if ((Address && Address >= (PVOID)(*pLdrEntry)->DllBase && Address < (PVOID)((ULONG_PTR)(*pLdrEntry)->DllBase + (*pLdrEntry)->SizeOfImage)) ||
52 (Index >= 0 && (*Count)++ == Index))
53 {
54 return TRUE;
55 }
56
57 current_entry = current_entry->Flink;
58 }
59
60 return FALSE;
61}
Definition: btrfs_drv.h:1876
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by KdbpSymFindModule().

◆ KdbpSymUnicodeToAnsi()

static PCHAR NTAPI KdbpSymUnicodeToAnsi ( IN PUNICODE_STRING  Unicode,
OUT PCHAR  Ansi,
IN ULONG  Length 
)
static

Definition at line 115 of file kdb_symbols.c.

118{
119 PCHAR p;
120 PWCHAR pw;
121 ULONG i;
122
123 /* Set length and normalize it */
124 i = Unicode->Length / sizeof(WCHAR);
125 i = min(i, Length - 1);
126
127 /* Set source and destination, and copy */
128 pw = Unicode->Buffer;
129 p = Ansi;
130 while (i--) *p++ = (CHAR)*pw++;
131
132 /* Null terminate and return */
133 *p = ANSI_NULL;
134 return Ansi;
135}
#define CHAR(Char)
GLfloat GLfloat p
Definition: glext.h:8902
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define min(a, b)
Definition: monoChain.cc:55
#define ANSI_NULL
_In_ ULONG _In_ ULONG _In_ ULONG Length
Definition: ntddpcm.h:102
uint16_t * PWCHAR
Definition: typedefs.h:56
uint32_t ULONG
Definition: typedefs.h:59
char * PCHAR
Definition: typedefs.h:51
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by KdbSymPrintAddress().

◆ KdbSymInit()

BOOLEAN KdbSymInit ( _In_ ULONG  BootPhase)

Initializes the KDB symbols implementation.

Parameters
[in]BootPhasePhase of initialization.
Returns
TRUE if symbols are to be loaded at this given BootPhase; FALSE if not.

Definition at line 343 of file kdb_symbols.c.

345{
346#if 1 // FIXME: This is a workaround HACK!!
347 static BOOLEAN OrigLoadSymbols = FALSE;
348#endif
349
350 DPRINT("KdbSymInit() BootPhase=%d\n", BootPhase);
351
352 if (BootPhase == 0)
353 {
354 PSTR CommandLine;
355 SHORT Found = FALSE;
356 CHAR YesNo;
357
358 /* By default, load symbols in DBG builds, but not in REL builds
359 or anything other than x86, because they only work on x86
360 and can cause the system to hang on x64. */
361#if DBG && defined(_M_IX86)
363#else
365#endif
366
367 /* Check the command line for LOADSYMBOLS, NOLOADSYMBOLS,
368 * LOADSYMBOLS={YES|NO}, NOLOADSYMBOLS={YES|NO} */
370 CommandLine = KeLoaderBlock->LoadOptions;
371 while (*CommandLine)
372 {
373 /* Skip any whitespace */
374 while (isspace(*CommandLine))
375 ++CommandLine;
376
377 Found = 0;
378 if (_strnicmp(CommandLine, "LOADSYMBOLS", 11) == 0)
379 {
380 Found = +1;
381 CommandLine += 11;
382 }
383 else if (_strnicmp(CommandLine, "NOLOADSYMBOLS", 13) == 0)
384 {
385 Found = -1;
386 CommandLine += 13;
387 }
388 if (Found != 0)
389 {
390 if (*CommandLine == '=')
391 {
392 ++CommandLine;
393 YesNo = toupper(*CommandLine);
394 if (YesNo == 'N' || YesNo == '0')
395 {
396 Found = -1 * Found;
397 }
398 }
399 LoadSymbols = (0 < Found);
400 }
401
402 /* Move on to the next option */
403 while (*CommandLine && !isspace(*CommandLine))
404 ++CommandLine;
405 }
406
407#if 1 // FIXME: This is a workaround HACK!!
408// Save the actual value of LoadSymbols but disable it for BootPhase 0.
409 OrigLoadSymbols = LoadSymbols;
411 return OrigLoadSymbols;
412#endif
413 }
414 else if (BootPhase == 1)
415 {
419 PLIST_ENTRY ListEntry;
420
421#if 1 // FIXME: This is a workaround HACK!!
422// Now, restore the actual value of LoadSymbols.
423 LoadSymbols = OrigLoadSymbols;
424#endif
425
426 /* Do not continue loading symbols if we have less than 96MB of RAM */
427 if (MmNumberOfPhysicalPages < (96 * 1024 * 1024 / PAGE_SIZE))
429
430 /* Continue this phase only if we need to load symbols */
431 if (!LoadSymbols)
432 return LoadSymbols;
433
434 /* Launch our worker thread */
438
441 NULL, NULL, NULL,
443 NULL);
444 if (!NT_SUCCESS(Status))
445 {
446 DPRINT1("Failed starting symbols loader thread: 0x%08x\n", Status);
448 return LoadSymbols;
449 }
450
452
454
455 for (ListEntry = PsLoadedModuleList.Flink;
456 ListEntry != &PsLoadedModuleList;
457 ListEntry = ListEntry->Flink)
458 {
459 PLDR_DATA_TABLE_ENTRY LdrEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InLoadOrderLinks);
460 KdbSymProcessSymbols(LdrEntry, TRUE);
461 }
462
464 }
465
466 return LoadSymbols;
467}
unsigned char BOOLEAN
#define isspace(c)
Definition: acclib.h:69
int toupper(int c)
Definition: utclib.c:881
LONG NTSTATUS
Definition: precomp.h:26
#define DPRINT1
Definition: precomp.h:8
return Found
Definition: dirsup.c:1270
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define _strnicmp(_String1, _String2, _MaxCount)
Definition: compat.h:23
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define PAGE_SIZE
Definition: env_spec_w32.h:49
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
Status
Definition: gdiplustypes.h:25
static KSPIN_LOCK SymbolsToLoadLock
Definition: kdb_symbols.c:32
VOID KdbSymProcessSymbols(_Inout_ PLDR_DATA_TABLE_ENTRY LdrEntry, _In_ BOOLEAN Load)
Load symbols from image mapping. If this fails,.
Definition: kdb_symbols.c:297
static BOOLEAN LoadSymbols
Definition: kdb_symbols.c:30
static KEVENT SymbolsToLoadEvent
Definition: kdb_symbols.c:33
static KSTART_ROUTINE LoadSymbolsRoutine
Definition: kdb_symbols.c:195
static LIST_ENTRY SymbolsToLoad
Definition: kdb_symbols.c:31
PLOADER_PARAMETER_BLOCK KeLoaderBlock
Definition: krnlinit.c:29
#define ASSERT(a)
Definition: mode.c:44
#define THREAD_ALL_ACCESS
Definition: nt_native.h:1339
@ SynchronizationEvent
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
NTSTATUS NTAPI PsCreateSystemThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN HANDLE ProcessHandle, IN PCLIENT_ID ClientId, IN PKSTART_ROUTINE StartRoutine, IN PVOID StartContext)
Definition: thread.c:602
short SHORT
Definition: pedump.c:59
VOID RosSymInitKernelMode(VOID)
Definition: initkm.c:32
#define DPRINT
Definition: sndvol32.h:73
Definition: typedefs.h:120
char * PSTR
Definition: typedefs.h:51
_Requires_lock_held_ Interrupt _Releases_lock_ Interrupt _In_ _IRQL_restores_ KIRQL OldIrql
Definition: kefuncs.h:778
char CHAR
Definition: xmlstorage.h:175

Referenced by KdbInitialize().

◆ KdbSymPrintAddress()

BOOLEAN KdbSymPrintAddress ( IN PVOID  Address,
IN PCONTEXT  Context 
)

Print address...

Tries to lookup line number, file name and function name for the given address and prints it. If no such information is found the address is printed in the format <module: offset>, otherwise the format will be <module: offset (filename:linenumber (functionname))>

Return values
TRUEModule containing Address was found, Address was printed.
FALSENo module containing Address was found, nothing was printed.

Definition at line 149 of file kdb_symbols.c.

152{
153 PLDR_DATA_TABLE_ENTRY LdrEntry;
154 ULONG_PTR RelativeAddress;
155 BOOLEAN Printed = FALSE;
156 CHAR ModuleNameAnsi[64];
157
158 if (!KdbpSymFindModule(Address, -1, &LdrEntry))
159 return FALSE;
160
161 RelativeAddress = (ULONG_PTR)Address - (ULONG_PTR)LdrEntry->DllBase;
162
164 ModuleNameAnsi,
165 sizeof(ModuleNameAnsi));
166
167 if (LdrEntry->PatchInformation)
168 {
170 CHAR FileName[256];
171 CHAR FunctionName[256];
172
174 RelativeAddress,
175 &LineNumber,
176 FileName,
178 {
179 KdbPrintf("<%s:%x (%s:%d (%s))>",
180 ModuleNameAnsi, RelativeAddress,
182 Printed = TRUE;
183 }
184 }
185
186 if (!Printed)
187 {
188 /* Just print module & address */
189 KdbPrintf("<%s:%x>", ModuleNameAnsi, RelativeAddress);
190 }
191
192 return TRUE;
193}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 LineNumber
Definition: acpixf.h:1220
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char * FunctionName
Definition: acpixf.h:1279
#define ULONG_PTR
Definition: config.h:101
VOID __cdecl KdbPrintf(_In_ PCSTR Format,...)
Definition: kdb_print.c:160
BOOLEAN KdbpSymFindModule(IN PVOID Address OPTIONAL, IN INT Index OPTIONAL, OUT PLDR_DATA_TABLE_ENTRY *pLdrEntry)
Find a module...
Definition: kdb_symbols.c:76
static PCHAR NTAPI KdbpSymUnicodeToAnsi(IN PUNICODE_STRING Unicode, OUT PCHAR Ansi, IN ULONG Length)
Definition: kdb_symbols.c:115
BOOLEAN RosSymGetAddressInformation(PROSSYM_INFO RosSymInfo, ULONG_PTR RelativeAddress, ULONG *LineNumber, char *FileName, char *FunctionName)
Definition: find.c:94
PVOID DllBase
Definition: btrfs_drv.h:1880
UNICODE_STRING BaseDllName
Definition: ldrtypes.h:145
PVOID PatchInformation
Definition: ldrtypes.h:164

Referenced by KdbpCliMainLoop(), KdbpCmdBackTrace(), KdbpCmdDisassembleX(), KdbpPrintAddressInCode(), and KeRosDumpStackFrameArray().

◆ KdbSymProcessSymbols()

VOID KdbSymProcessSymbols ( _Inout_ PLDR_DATA_TABLE_ENTRY  LdrEntry,
_In_ BOOLEAN  Load 
)

Load symbols from image mapping. If this fails,.

Parameters
LdrEntryThe entry to load symbols from

Definition at line 297 of file kdb_symbols.c.

300{
301 if (!LoadSymbols)
302 return;
303
304 /* Check if this is unload */
305 if (!Load)
306 {
307 /* Did we process it */
308 if (LdrEntry->PatchInformation)
309 {
310 RosSymDelete(LdrEntry->PatchInformation);
311 LdrEntry->PatchInformation = NULL;
312 }
313 return;
314 }
315
316 if (RosSymCreateFromMem(LdrEntry->DllBase, LdrEntry->SizeOfImage, (PROSSYM_INFO*)&LdrEntry->PatchInformation))
317 {
318 return;
319 }
320
321 /* Add a ref until we really process it */
322 LdrEntry->LoadCount++;
323
324 /* Tell our worker thread to read from it */
326 InsertTailList(&SymbolsToLoad, &LdrEntry->InInitializationOrderLinks);
328
330}
#define InsertTailList(ListHead, Entry)
#define KeSetEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:476
VOID RosSymDelete(PROSSYM_INFO RosSymInfo)
Definition: delete.c:15
BOOLEAN RosSymCreateFromMem(PVOID ImageStart, ULONG_PTR ImageSize, PROSSYM_INFO *RosSymInfo)
Definition: frommem.c:19
#define IO_NO_INCREMENT
Definition: iotypes.h:598

Referenced by KdbSymInit(), and KdSendPacket().

◆ LoadSymbolsRoutine()

_Use_decl_annotations_ VOID NTAPI LoadSymbolsRoutine ( _In_ PVOID  Context)

The symbol loader thread routine. This opens the image file for reading and loads the symbols section from there.

Note
We must do this because KdbSymProcessSymbols is called at high IRQL and we can't set the event from here
Parameters
ContextUnused

Definition at line 208 of file kdb_symbols.c.

210{
212
213 while (TRUE)
214 {
215 PLIST_ENTRY ListEntry;
217 if (!NT_SUCCESS(Status))
218 {
219 DPRINT1("KeWaitForSingleObject failed?! 0x%08x\n", Status);
221 return;
222 }
223
225 {
226 PLDR_DATA_TABLE_ENTRY LdrEntry = CONTAINING_RECORD(ListEntry, LDR_DATA_TABLE_ENTRY, InInitializationOrderLinks);
228 OBJECT_ATTRIBUTES Attrib;
231 DPRINT1("Trying %wZ\n", &LdrEntry->FullDllName);
234 &Attrib,
235 &Iosb,
238 if (!NT_SUCCESS(Status))
239 {
240 /* Try system paths */
241 static const UNICODE_STRING System32Dir = RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\");
242 UNICODE_STRING ImagePath;
243 WCHAR ImagePathBuffer[256];
244 RtlInitEmptyUnicodeString(&ImagePath, ImagePathBuffer, sizeof(ImagePathBuffer));
245 RtlCopyUnicodeString(&ImagePath, &System32Dir);
246 RtlAppendUnicodeStringToString(&ImagePath, &LdrEntry->BaseDllName);
248 DPRINT1("Trying %wZ\n", &ImagePath);
251 &Attrib,
252 &Iosb,
255 if (!NT_SUCCESS(Status))
256 {
257 static const UNICODE_STRING DriversDir= RTL_CONSTANT_STRING(L"\\SystemRoot\\system32\\drivers\\");
258
259 RtlInitEmptyUnicodeString(&ImagePath, ImagePathBuffer, sizeof(ImagePathBuffer));
260 RtlCopyUnicodeString(&ImagePath, &DriversDir);
261 RtlAppendUnicodeStringToString(&ImagePath, &LdrEntry->BaseDllName);
263 DPRINT1("Trying %wZ\n", &ImagePath);
266 &Attrib,
267 &Iosb,
270 }
271 }
272
273 if (!NT_SUCCESS(Status))
274 {
275 DPRINT1("Failed opening file %wZ (%wZ) for reading symbols (0x%08x)\n", &LdrEntry->FullDllName, &LdrEntry->BaseDllName, Status);
276 /* We took a ref previously */
277 MmUnloadSystemImage(LdrEntry);
278 continue;
279 }
280
281 /* Hand it to Rossym */
283 LdrEntry->PatchInformation = NULL;
284
285 /* We're done for this one. */
287 MmUnloadSystemImage(LdrEntry);
288 }
289 }
290}
#define FILE_SHARE_READ
Definition: compat.h:136
return Iosb
Definition: create.c:4402
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
_Must_inspect_result_ _In_opt_ PFLT_INSTANCE _Out_ PHANDLE FileHandle
Definition: fltkernel.h:1231
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define OBJ_KERNEL_HANDLE
Definition: winternl.h:231
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
PLIST_ENTRY NTAPI ExInterlockedRemoveHeadList(IN OUT PLIST_ENTRY ListHead, IN OUT PKSPIN_LOCK Lock)
Definition: interlocked.c:166
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
#define KernelMode
Definition: asm.h:34
NTSYSAPI NTSTATUS NTAPI ZwOpenFile(_Out_ PHANDLE FileHandle, _In_ ACCESS_MASK DesiredAccess, _In_ POBJECT_ATTRIBUTES ObjectAttributes, _Out_ PIO_STATUS_BLOCK IoStatusBlock, _In_ ULONG ShareAccess, _In_ ULONG OpenOptions)
NTSYSAPI VOID NTAPI RtlCopyUnicodeString(PUNICODE_STRING DestinationString, PUNICODE_STRING SourceString)
#define SYNCHRONIZE
Definition: nt_native.h:61
NTSYSAPI NTSTATUS NTAPI RtlAppendUnicodeStringToString(PUNICODE_STRING Destination, PUNICODE_STRING Source)
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
#define FILE_READ_ACCESS
Definition: nt_native.h:610
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:325
NTSTATUS NTAPI MmUnloadSystemImage(IN PVOID ImageHandle)
Definition: sysldr.c:945
#define L(x)
Definition: ntvdm.h:50
BOOLEAN RosSymCreateFromFile(PVOID FileContext, PROSSYM_INFO *RosSymInfo)
Definition: fromfile.c:19
UNICODE_STRING FullDllName
Definition: btrfs_drv.h:1882
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14
@ WrKernel
Definition: ketypes.h:441

Variable Documentation

◆ LoadSymbols

BOOLEAN LoadSymbols = FALSE
static

◆ LoadSymbolsRoutine

KSTART_ROUTINE LoadSymbolsRoutine
static

Definition at line 195 of file kdb_symbols.c.

Referenced by KdbSymInit().

◆ SymbolsToLoad

LIST_ENTRY SymbolsToLoad
static

Definition at line 31 of file kdb_symbols.c.

Referenced by KdbSymInit(), KdbSymProcessSymbols(), and LoadSymbolsRoutine().

◆ SymbolsToLoadEvent

KEVENT SymbolsToLoadEvent
static

Definition at line 33 of file kdb_symbols.c.

Referenced by KdbSymInit(), KdbSymProcessSymbols(), and LoadSymbolsRoutine().

◆ SymbolsToLoadLock

KSPIN_LOCK SymbolsToLoadLock
static

Definition at line 32 of file kdb_symbols.c.

Referenced by KdbSymInit(), KdbSymProcessSymbols(), and LoadSymbolsRoutine().