public static VerifyValidObjectAddress ( |
||
context | ||
objectAddress | ulong | |
return | bool |
public void Execute(CommandExecutionContext context) { if (!CommandHelpers.VerifyHasHeapIndex(context)) { return; } if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress)) { return; } int pathsDisplayed = 0; foreach (var path in context.HeapIndex.FindPaths(ObjectAddress, MaxResults, MaxLocalRoots, MaxDepth, RunInParallel)) { context.WriteLine("{0:x16} -> {1:x16} {2}", path.Root.Address, path.Root.Object, path.Root.DisplayText); foreach (var obj in path.Chain) { string objHex = String.Format("{0:x16}", obj); context.Write(" -> "); context.WriteLink(objHex, "!do " + objHex); context.WriteLine(" {0}", context.Heap.GetObjectType(obj).Name); } context.WriteLine(); ++pathsDisplayed; } context.WriteLine("Total paths displayed: {0}", pathsDisplayed); if (pathsDisplayed == 0) { context.WriteLine("Number of paths may be affected by maximum depth setting. " + "If you are not seeing enough results, consider increasing --maxDepth."); } }
public void Execute(CommandExecutionContext context) { if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress)) { return; } IEnumerable <Tuple <ulong, ClrType> > subgraph; if (Flat) { subgraph = context.Heap.FlatSubgraphOf(ObjectAddress); } else { subgraph = context.Heap.SubgraphOf(ObjectAddress); } ulong count = 0, size = 0; foreach (var objAndType in subgraph) { ++count; size += objAndType.Item2.GetSize(objAndType.Item1); } context.WriteLine("{0:x16} graph size is {1} objects, {2} bytes ({3})", ObjectAddress, count, size, size.ToMemoryUnits()); }
public void Execute(CommandExecutionContext context) { if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress)) { return; } var type = context.Heap.GetObjectType(ObjectAddress); var dynamicObj = context.Heap.GetDynamicObject(ObjectAddress); context.WriteLine("Type: {0}", type.Name); if (type.IsArray || dynamicObj.IsList()) { int length = dynamicObj.GetLength(); context.WriteLine("Length: {0}", length); for (int i = 0; i < length; ++i) { context.WriteLine("[{0}] {1}", i, dynamicObj[i]); } } else if (dynamicObj.IsDictionary()) { context.WriteLine("Size: {0}", dynamicObj.GetLength()); context.WriteLine("{0,-40} {1,-40}", "Key", "Value"); foreach (var kvp in dynamicObj.GetDictionaryItems()) { context.WriteLine("{0,-40} {1,-40}", kvp.Item1, kvp.Item2); } } else { context.WriteErrorLine("The specified object is not an array, list, or dictionary. " + "These are the only collection types that are currently supported. For other " + "collections, try using the !hq command to inspect the object's contents."); return; } }
public void Execute(CommandExecutionContext context) { if (!CommandHelpers.VerifyHasHeapIndex(context)) { return; } if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress)) { return; } var type = context.Heap.GetObjectType(ObjectAddress); context.WriteLine("Note: unrooted (dead) objects will not have any referencing objects displayed."); context.WriteLine("Object {0:x16} ({1}) is referenced by the following objects:", ObjectAddress, type.Name); foreach (var referencingObj in context.HeapIndex.FindRefs(ObjectAddress)) { string refHex = String.Format("{0:x16}", referencingObj); context.WriteLink(refHex, "!do " + refHex); context.WriteLine(" ({0})", context.Heap.GetObjectType(referencingObj).Name); } context.WriteLine("Object {0:x16} ({1}) references the following objects:", ObjectAddress, type.Name); type.EnumerateRefsOfObject(ObjectAddress, (child, _) => { var childType = context.Heap.GetObjectType(child); if (childType == null || String.IsNullOrEmpty(childType.Name)) { return; } string refHex = String.Format("{0:x16}", child); context.WriteLink(refHex, "!do " + refHex); context.WriteLine(" ({0})", childType.Name); }); }
public void Execute(CommandExecutionContext context) { _context = context; if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress)) { return; } _heap = context.Heap; if (!_heap.CanWalkHeap) { context.WriteError("The heap is not in a walkable state."); return; } var type = _heap.GetObjectType(ObjectAddress); _visitedObjects = new ObjectSet(_heap); _targets[ObjectAddress] = new Node(ObjectAddress, type); FillRootDictionary(); foreach (var root in _roots) { if (_visitedRoots.Contains(root) || _visitedObjects.Contains(root.Object)) { continue; } Node path = TryFindPathToTarget(root); if (path != null) { PrintOnePath(path); } } }
public void Execute(CommandExecutionContext context) { if (!CommandHelpers.VerifyValidObjectAddress(context, ObjectAddress)) { return; } var type = context.Heap.GetObjectType(ObjectAddress); if (!type.IsArray) { context.WriteError("The object at the specified address is not an array."); return; } var size = type.GetSize(ObjectAddress); var length = type.GetArrayLength(ObjectAddress); context.WriteLine("Name: {0}", type.Name); context.WriteLine("Size: {0}(0x{1:x}) bytes", size, size); context.WriteLine("Array: Number of elements {0}, Type {1} {2}", length, type.ArrayComponentType.Name, type.ArrayComponentType.IsValueClass ? "(value type)" : "(reference type)"); for (int i = 0; i < length; ++i) { context.Write("[{0}] ", i); object value; if (type.ArrayComponentType.IsValueClass) { value = type.GetArrayElementAddress(ObjectAddress, i); if (value != null) { context.WriteLink( String.Format("{0:x16}", value), String.Format("!do {0:x16} --type {1}", value, type.ArrayComponentType.Name) ); } else { context.Write("<null>"); } } else { value = type.GetArrayElementValue(ObjectAddress, i); ulong elementAddr = type.GetArrayElementAddress(ObjectAddress, i); ulong elementRef; if (context.Runtime.ReadPointer(elementAddr, out elementRef)) { context.WriteLink( String.Format("{0:x16}", value ?? "<null>"), String.Format("!do {0:x16}", elementRef) ); } else { context.Write("{0:x16}", value ?? "<null>"); } } context.WriteLine(); } }