mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 02:34:53 +00:00
[NTOS] Add compile time option to trace callers of pool allocations
This commit is contained in:
parent
24f240be8a
commit
8b20755040
|
@ -22,6 +22,10 @@
|
||||||
|
|
||||||
#define POOL_BIG_TABLE_ENTRY_FREE 0x1
|
#define POOL_BIG_TABLE_ENTRY_FREE 0x1
|
||||||
|
|
||||||
|
/* DEBUGGING ******************************************************************/
|
||||||
|
|
||||||
|
//#define DBG_NUMBER_OF_FRAMES_TO_CAPTURE 5
|
||||||
|
|
||||||
typedef struct _POOL_DPC_CONTEXT
|
typedef struct _POOL_DPC_CONTEXT
|
||||||
{
|
{
|
||||||
PPOOL_TRACKER_TABLE PoolTrackTable;
|
PPOOL_TRACKER_TABLE PoolTrackTable;
|
||||||
|
@ -1847,9 +1851,14 @@ ExReturnPoolQuota(IN PVOID P)
|
||||||
*/
|
*/
|
||||||
PVOID
|
PVOID
|
||||||
NTAPI
|
NTAPI
|
||||||
ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
#ifdef DBG_NUMBER_OF_FRAMES_TO_CAPTURE
|
||||||
IN SIZE_T NumberOfBytes,
|
ExAllocatePoolWithTagInternal(
|
||||||
IN ULONG Tag)
|
#else
|
||||||
|
ExAllocatePoolWithTag(
|
||||||
|
#endif
|
||||||
|
_In_ POOL_TYPE PoolType,
|
||||||
|
_In_ SIZE_T NumberOfBytes,
|
||||||
|
_In_ ULONG Tag)
|
||||||
{
|
{
|
||||||
PPOOL_DESCRIPTOR PoolDesc;
|
PPOOL_DESCRIPTOR PoolDesc;
|
||||||
PLIST_ENTRY ListHead;
|
PLIST_ENTRY ListHead;
|
||||||
|
@ -2417,6 +2426,33 @@ ExAllocatePoolWithTag(IN POOL_TYPE PoolType,
|
||||||
return Allocation;
|
return Allocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DBG_NUMBER_OF_FRAMES_TO_CAPTURE
|
||||||
|
PVOID
|
||||||
|
NTAPI
|
||||||
|
ExAllocatePoolWithTag(
|
||||||
|
_In_ POOL_TYPE PoolType,
|
||||||
|
_In_ SIZE_T NumberOfBytes,
|
||||||
|
_In_ ULONG Tag)
|
||||||
|
{
|
||||||
|
SIZE_T FullSize;
|
||||||
|
PVOID Allocation, *DbgData;
|
||||||
|
|
||||||
|
/* Allocate a larger chunk to add the debug data */
|
||||||
|
FullSize = NumberOfBytes + (DBG_NUMBER_OF_FRAMES_TO_CAPTURE + 2) * sizeof(PVOID);
|
||||||
|
Allocation = ExAllocatePoolWithTagInternal(PoolType, FullSize, Tag);
|
||||||
|
if (Allocation == NULL)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Append the debug data, separated by a '####' */
|
||||||
|
DbgData = ALIGN_UP_POINTER_BY((PUCHAR)Allocation + NumberOfBytes, sizeof(PVOID));
|
||||||
|
DbgData[0] = (PVOID)(ULONG_PTR)'####';
|
||||||
|
RtlWalkFrameChain(&DbgData[1], DBG_NUMBER_OF_FRAMES_TO_CAPTURE, 0);
|
||||||
|
return Allocation;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue