Exemplo n.º 1
0
        public void GetBlockingObjects()
        {
            context.WriteLine(" --- Blocking objects in heap ---");

            if (this.context.Heap != null && this.context.Heap.CanWalkHeap)
            {
                context.WriteLine("{0,-20} {1,-10} {2,-8} {3,-20} {4,-20}", "Address", "Type", "Locked", "Owners", "Pending");
                foreach (BlockingObject obj in this.context.Heap.EnumerateBlockingObjects())
                {
                    this.blockingObjects.Add(obj.ToSDModel());
                }
            }
            else
            {
                context.WriteWarning("no heap information avaliable!");
            }
        }
Exemplo n.º 2
0
 public void GetBlockingObjects()
 {
     context.WriteLine(" --- Blocking objects in heap ---");
     try {
         if (this.context.Heap != null && this.context.Heap.CanWalkHeap)
         {
             context.WriteLine("{0,-20} {1,-10} {2,-8} {3,-20} {4,-20}", "Address", "Type", "Locked", "Owners", "Pending");
             foreach (BlockingObject obj in this.context.Heap.EnumerateBlockingObjects())
             {
                 this.blockingObjects.Add(obj.ToSDModel());
             }
         }
         else
         {
             context.WriteWarning("no heap information avaliable!");
         }
     } catch (NullReferenceException e) {
         context.WriteWarning("NullReferenceException in PrintChainForThread. Known CLRMD bug (https://github.com/Microsoft/clrmd/issues/85)");
     }
 }
Exemplo n.º 3
0
        public void PrintManagedCallStacks()
        {
            //Threads test, get info of all managed threads found in dump
            context.WriteInfo("--- Managed callstacks ---");
            if (context.Runtime != null)
            {
                foreach (ClrThread thread in context.Runtime.Threads)
                {
                    if (!thread.IsAlive)
                    {
                        continue;
                    }

                    context.WriteInfo("Thread        {0}, managed id: {1}:", thread.OSThreadId, thread.ManagedThreadId);
                    context.WriteInfo("GC mode:      {0} ", thread.GcMode);
                    context.WriteInfo("Thread type:  {0}", thread);
                    context.WriteInfo("Callstack: {0:X} - {1:X}", thread.StackBase, thread.StackLimit);

                    // get last thrown exception of thread
                    ClrException lastException = thread.CurrentException;
                    if (lastException != null)
                    {
                        this.PrintException(lastException);
                    }
                    // walk each stack frame
                    foreach (ClrStackFrame frame in thread.StackTrace)
                    {
                        SDFileAndLineNumber info = frame.GetSourceLocation();
                        context.WriteLine("{0,12:X} {1,12:X} {2} - {3}:{4}", frame.StackPointer, frame.InstructionPointer, frame.DisplayString, info.File, info.Line);
                    }
                    context.WriteLine(null);
                }
                context.WriteInfo("Total amount of all (managed) threads: " + context.Runtime.Threads.Count);
            }
        }
Exemplo n.º 4
0
        public void PrintCLRVersions()
        {
            context.WriteLine("\n--- CLR version list ---");
            foreach (SDClrVersion version in systemInfo.ClrVersions)
            {
                context.WriteLine("Found CLR Version:" + version.Version);

                // This is the data needed to request the dac from the symbol server:
                SDModule dacInfo = version.DacFile;

                context.WriteLine("Filesize:  {0:X}", dacInfo.FileSize);
                context.WriteLine("Timestamp: {0:X}", dacInfo.TimeStamp);
                context.WriteLine("Dac File:  {0}", dacInfo.FileName);

                context.WriteLine(null);
            }
            context.WriteLine("--- END CLR version list ---");
        }