Update recordng/tracing

This commit is contained in:
rfm 2024-06-18 12:29:17 +01:00
parent 0aa5ab38db
commit 54c8257e8f

View file

@ -5215,7 +5215,7 @@ With the single parameter 'no',\n\
With the single parameter 'default',\n\ With the single parameter 'default',\n\
the gathering of memory usage statistics reverts to the default setting.\n\ the gathering of memory usage statistics reverts to the default setting.\n\
With two parameters ('class' and a class name),\n\ With two parameters ('class' and a class name),\n\
new instances of the class are recorded.\n\ new instances of the class are recorded/traced.\n\
With two parameters ('list' and a class),\n\ With two parameters ('list' and a class),\n\
recorded instances of the class are reported.\n\ recorded instances of the class are reported.\n\
With two parameters ('alarm' and a severity name),\n\ With two parameters ('alarm' and a severity name),\n\
@ -5472,23 +5472,25 @@ With two parameters ('maximum' and a number),\n\
{ {
if ([op caseInsensitiveCompare: @"class"] == NSOrderedSame) if ([op caseInsensitiveCompare: @"class"] == NSOrderedSame)
{ {
GSDebugAllocationRecordObjects(c, YES); GSDebugAllocationRecordAndTrace(c,
[self cmdPrintf: @"Recording instances of '%@'.\n", arg]; YES, (NSObject*(*)(id))1);
[self cmdPrintf: @"Tracking instances of '%@'.\n", arg];
} }
else if ([op caseInsensitiveCompare: @"list"] else if ([op caseInsensitiveCompare: @"list"]
== NSOrderedSame) == NSOrderedSame)
{ {
NSArray *array; NSMapTable *map;
NSUInteger count; NSEnumerator *e;
NSUInteger index; NSObject *k;
array = GSDebugAllocationListRecordedObjects(c); map = GSDebugAllocationTaggedObjects(c);
[self cmdPrintf: @"Current instances of '%@':\n", arg]; [self cmdPrintf: @"Tracked instances of '%@':\n", arg];
count = [array count]; e = [map keyEnumerator];
for (index = 0; index < count; index++) while ((k = [e nextObject]) != nil)
{ {
[self cmdPrintf: @"%6lu %@\n", NSObject *v = [map objectForKey: k];
(unsigned long)index, [array objectAtIndex: index]];
[self cmdPrintf: @"%@ allocated at %@\n", k, v];
} }
} }
else else