VerifyHasHeapIndex() публичный статический Метод

public static VerifyHasHeapIndex ( CommandExecutionContext context ) : bool
context CommandExecutionContext
Результат bool
Пример #1
0
        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.");
            }
        }
Пример #2
0
        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);
            });
        }