mirror of
https://github.com/reactos/reactos.git
synced 2025-05-06 18:31:26 +00:00
[NTOSKRNL] Make the memory dumper available as a kdbg command: !poolused
This commit is contained in:
parent
89f9c9101a
commit
78b55550bb
2 changed files with 35 additions and 10 deletions
|
@ -92,6 +92,7 @@ static BOOLEAN KdbpCmdHelp(ULONG Argc, PCHAR Argv[]);
|
|||
static BOOLEAN KdbpCmdDmesg(ULONG Argc, PCHAR Argv[]);
|
||||
|
||||
BOOLEAN ExpKdbgExtPool(ULONG Argc, PCHAR Argv[]);
|
||||
BOOLEAN ExpKdbgExtPoolUsed(ULONG Argc, PCHAR Argv[]);
|
||||
|
||||
#ifdef __ROS_DWARF__
|
||||
static BOOLEAN KdbpCmdPrintStruct(ULONG Argc, PCHAR Argv[]);
|
||||
|
@ -183,7 +184,8 @@ static const struct
|
|||
{ "dmesg", "dmesg", "Display debug messages on screen, with navigation on pages.", KdbpCmdDmesg },
|
||||
{ "kmsg", "kmsg", "Kernel dmesg. Alias for dmesg.", KdbpCmdDmesg },
|
||||
{ "help", "help", "Display help screen.", KdbpCmdHelp },
|
||||
{ "!pool", "!pool [Address [Flags]]", "Display information about pool allocations.", ExpKdbgExtPool }
|
||||
{ "!pool", "!pool [Address [Flags]]", "Display information about pool allocations.", ExpKdbgExtPool },
|
||||
{ "!poolused", "!poolused", "Display non-paged pool usage.", ExpKdbgExtPoolUsed },
|
||||
};
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
|
|
@ -475,13 +475,23 @@ ExpTagAllowPrint(CHAR Tag)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
#define MiDumperPrint(dbg, fmt, ...) \
|
||||
if (dbg) KdbpPrint(fmt, ##__VA_ARGS__); \
|
||||
else DPRINT1(fmt, ##__VA_ARGS__)
|
||||
|
||||
VOID
|
||||
MiDumpNonPagedPoolConsumers(VOID)
|
||||
MiDumpNonPagedPoolConsumers(BOOLEAN CalledFromDbg)
|
||||
{
|
||||
SIZE_T i;
|
||||
|
||||
DPRINT1("---------------------\n");
|
||||
DPRINT1("Out of memory dumper!\n");
|
||||
//
|
||||
// Only print header if called from OOM situation
|
||||
//
|
||||
if (!CalledFromDbg)
|
||||
{
|
||||
DPRINT1("---------------------\n");
|
||||
DPRINT1("Out of memory dumper!\n");
|
||||
}
|
||||
|
||||
//
|
||||
// We'll extract allocations for all the tracked pools
|
||||
|
@ -517,21 +527,24 @@ MiDumpNonPagedPoolConsumers(VOID)
|
|||
//
|
||||
// Print in reversed order to match what is in source code
|
||||
//
|
||||
DPRINT1("Tag: '%c%c%c%c', Size: %ld\n", Tag[3], Tag[2], Tag[1], Tag[0], TableEntry->NonPagedBytes);
|
||||
MiDumperPrint(CalledFromDbg, "Tag: '%c%c%c%c', Size: %ld\n", Tag[3], Tag[2], Tag[1], Tag[0], TableEntry->NonPagedBytes);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("Tag: %x, Size: %ld\n", TableEntry->Key, TableEntry->NonPagedBytes);
|
||||
MiDumperPrint(CalledFromDbg, "Tag: %x, Size: %ld\n", TableEntry->Key, TableEntry->NonPagedBytes);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT1("Anon, Size: %ld\n", TableEntry->NonPagedBytes);
|
||||
MiDumperPrint(CalledFromDbg, "Anon, Size: %ld\n", TableEntry->NonPagedBytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DPRINT1("---------------------\n");
|
||||
if (!CalledFromDbg)
|
||||
{
|
||||
DPRINT1("---------------------\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1722,7 +1735,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
|||
//
|
||||
if ((OriginalType & BASE_POOL_TYPE_MASK) == NonPagedPool)
|
||||
{
|
||||
MiDumpNonPagedPoolConsumers();
|
||||
MiDumpNonPagedPoolConsumers(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2058,7 +2071,7 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
|||
//
|
||||
if ((OriginalType & BASE_POOL_TYPE_MASK) == NonPagedPool)
|
||||
{
|
||||
MiDumpNonPagedPoolConsumers();
|
||||
MiDumpNonPagedPoolConsumers(FALSE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -2914,6 +2927,16 @@ ExpKdbgExtPool(
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
ExpKdbgExtPoolUsed(
|
||||
ULONG Argc,
|
||||
PCHAR Argv[])
|
||||
{
|
||||
MiDumpNonPagedPoolConsumers(TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
#endif // DBG && KDBG
|
||||
|
||||
/* EOF */
|
||||
|
|
Loading…
Reference in a new issue