Exemple #1
0
        public bool Run(SptWrapper wrapper, string args)
        {
            ulong addr = wrapper.GetExpression(args);

            ClrMethodDescData mdd;
            uint n = 0;

            wrapper.Dac.GetMethodDescData(addr, 0, out mdd, 0, null, out n);
            ClrMethodTableData mtd = wrapper.Dac.GetMethodTableData(mdd.MethodTable);

            string methodName = wrapper.GetMethodDescName(addr);

            var tr = wrapper.CreateTableWriter();

            tr.AddColumn(17, true);
            tr.AddColumn(-1);

            tr.TextColumn("Method Name:").TextColumn(methodName.ToString()).NewRow()
            .TextColumn("Class:").PointerColumn(mtd.EEClass).NewRow()
            .TextColumn("MethodTable:").PointerColumn(mdd.MethodTable).NewRow()
            .TextColumn("mdToken:").Column("0x{0:x8}", mdd.mdToken).NewRow()
            .TextColumn("Module:").PointerColumn(mdd.Module).NewRow()
            .TextColumn("IsJitted:").TextColumn(mdd.IsJitted != 0 ? "yes" : "no").NewRow()
            .TextColumn("CodeAddr:").PointerColumn(mdd.CodeAddr).NewRow()
            .TextColumn("Transparency:").TextColumn(GetTransparency(wrapper, addr)).NewRow();

            return(true);
        }
Exemple #2
0
        public bool Run(SptWrapper wrapper, string args)
        {
            ulong addr = wrapper.GetExpression(args);

            ClrMethodDescData mdd;
            uint n = 0;
            wrapper.Dac.GetMethodDescData(addr, 0, out mdd, 0, null, out n);
            ClrMethodTableData mtd = wrapper.Dac.GetMethodTableData(mdd.MethodTable);

            string methodName = wrapper.GetMethodDescName(addr);

            var tr = wrapper.CreateTableWriter();

            tr.AddColumn(17, true);
            tr.AddColumn(-1);

            tr.TextColumn("Method Name:").TextColumn(methodName.ToString()).NewRow()
              .TextColumn("Class:").PointerColumn(mtd.EEClass).NewRow()
              .TextColumn("MethodTable:").PointerColumn(mdd.MethodTable).NewRow()
              .TextColumn("mdToken:").Column("0x{0:x8}", mdd.mdToken).NewRow()
              .TextColumn("Module:").PointerColumn(mdd.Module).NewRow()
              .TextColumn("IsJitted:").TextColumn(mdd.IsJitted != 0 ? "yes" : "no").NewRow()
              .TextColumn("CodeAddr:").PointerColumn(mdd.CodeAddr).NewRow()
              .TextColumn("Transparency:").TextColumn(GetTransparency(wrapper, addr)).NewRow();

            return true;
        }
Exemple #3
0
        private string GetTransparency(SptWrapper wrapper, ulong mdAddr)
        {
            var mttd = wrapper.Dac.GetMethodDescTransparencyData(mdAddr);

            string transparency;

            if (mttd.IsCalculated == 0)
            {
                transparency = "Not calculated";
            }
            else if (mttd.IsOpaque == 0)
            {
                transparency = "Transparent";
            }
            else if (mttd.IsSafe != 0)
            {
                transparency = "Critical";
            }
            else
            {
                transparency = "Safe Critical";
            }

            return(transparency);
        }
Exemple #4
0
 public static void EnsureInit(SptWrapper wrapper)
 {
     if (s_usefulMethodTables == null)
     {
         InitMethodTables(wrapper);
     }
 }
Exemple #5
0
        public static SptWrapper CreateFromDump(string dumpFile)
        {
            var bootstrapper = SptWrapper.GetBootstrapper();

            bootstrapper.ConfigureSymbolPath(@"q:\symcache");
            bootstrapper.ConfigureImagePath(@"q:\symcache");

            return(new SptWrapper(bootstrapper.InitFromDump(dumpFile)));
        }
Exemple #6
0
        private static void InitMethodTables(SptWrapper wrapper)
        {
            s_usefulMethodTables        = new Dictionary <ulong, Type>();
            s_usefulMethodTablesInverse = new Dictionary <Type, ulong>();

            foreach (var type in s_primitives)
            {
                var typeMt = wrapper.Proc.FindTypeByName("mscorlib.dll", type.FullName);
                s_usefulMethodTables.Add(typeMt, type);
                s_usefulMethodTablesInverse.Add(type, typeMt);
            }
        }
Exemple #7
0
        public bool Run(SptWrapper wrapper, string args)
        {
            string[] argSplit = args.Split(' ');

            string moduleName = argSplit[0];
            string typeName   = argSplit[1];

            if (argSplit.Length != 0)
            {
                wrapper.DbgOutput("Usage: !name2ee <module> <type>");
            }

            return(true);
        }
Exemple #8
0
        public bool Run(SptWrapper wrapper, string args)
        {
            string[] argSplit = args.Split(' ');

            string moduleName = argSplit[0];
            string typeName = argSplit[1];

            if (argSplit.Length != 0)
            {
                wrapper.DbgOutput("Usage: !name2ee <module> <type>");
            }

            return true;
        }
Exemple #9
0
        public bool Run(SptWrapper wrapper, string args)
        {
            var threads = wrapper.GetThreads();

            TableWriter tw = wrapper.CreateTableWriter();

            tw
            .AddColumn(4)
            .AddColumn(4)
            .AddColumn(4)
            .AddPointerColumn()
            .AddColumn(8)
            .AddColumn(11, true)
            .AddPointerColumn()
            .AddPointerColumn()
            .AddPointerColumn()
            .AddColumn(5, true)
            .AddColumn(3)
            .AddColumn(-1, true);

            tw.TextColumn("").TextColumn("ID").TextColumn("OSID").TextColumn("ThreadOb").TextColumn("State")
            .TextColumn("GC Mode").TextColumn("GC Alloc").TextColumn("Context").TextColumn("Domain  ").TextColumn("Lock").TextColumn("Apt")
            .TextColumn("Exception")
            .NewRow();

            foreach (var t in threads)
            {
                tw
                .HexColumn(0)
                .HexColumn(t.CorThreadId)
                .HexColumn(t.osThreadId)
                .PointerColumn(t.ThreadAddress)
                .HexColumn(t.State)
                .TextColumn(t.PreemptiveGCDisabled == 0 ? "Preemptive" : "Cooperative")
                .PointerColumn(t.GCAllocContext)
                .PointerColumn(t.GCAllocContextLimit)
                .PointerColumn(t.domain)
                .Column("{0}", t.LockCount)
                .TextColumn("MTA")
                .TextColumn("???");

                tw.NewRow();
            }

            return(true);
        }
Exemple #10
0
        public bool Run(SptWrapper wrapper, string args)
        {
            var threads = wrapper.GetThreads();

            TableWriter tw = wrapper.CreateTableWriter();
            tw
                .AddColumn(4)
                .AddColumn(4)
                .AddColumn(4)
                .AddPointerColumn()
                .AddColumn(8)
                .AddColumn(11, true)
                .AddPointerColumn()
                .AddPointerColumn()
                .AddPointerColumn()
                .AddColumn(5, true)
                .AddColumn(3)
                .AddColumn(-1, true);

            tw.TextColumn("").TextColumn("ID").TextColumn("OSID").TextColumn("ThreadOb").TextColumn("State")
                .TextColumn("GC Mode").TextColumn("GC Alloc").TextColumn("Context").TextColumn("Domain  ").TextColumn("Lock").TextColumn("Apt")
                .TextColumn("Exception")
                .NewRow();

            foreach (var t in threads)
            {
                tw
                    .HexColumn(0)
                    .HexColumn(t.CorThreadId)
                    .HexColumn(t.osThreadId)
                    .PointerColumn(t.ThreadAddress)
                    .HexColumn(t.State)
                    .TextColumn(t.PreemptiveGCDisabled == 0 ? "Preemptive" : "Cooperative")
                    .PointerColumn(t.GCAllocContext)
                    .PointerColumn(t.GCAllocContextLimit)
                    .PointerColumn(t.domain)
                    .Column("{0}", t.LockCount)
                    .TextColumn("MTA")
                    .TextColumn("???");

                tw.NewRow();
            }

            return true;
        }
Exemple #11
0
        private static bool RunMethod <T>(SptWrapper wrapper, string args)
            where T : IPluginMethod, new()
        {
            var plugin = new T();

            using (wrapper)
            {
                try
                {
                    return(plugin.Run(wrapper, args));
                }
                catch (Exception ex)
                {
                    wrapper.DbgOutput(ex.ToString());
                    return(false);
                }
            }
        }
Exemple #12
0
        private string GetTransparency(SptWrapper wrapper, ulong mdAddr)
        {
            var mttd = wrapper.Dac.GetMethodDescTransparencyData(mdAddr);

            string transparency;
            if (mttd.IsCalculated == 0)
            {
                transparency = "Not calculated";
            }
            else if (mttd.IsOpaque == 0)
            {
                transparency = "Transparent";
            }
            else if (mttd.IsSafe != 0)
            {
                transparency = "Critical";
            }
            else
            {
                transparency = "Safe Critical";
            }

            return transparency;
        }
Exemple #13
0
 public void Init()
 {
     _ext = Util.CreateFromDump(@"Q:\spt\Dumps\x86\sql.dmp");
 }
 public void Init()
 {
     _proc = Util.CreateFromDump(@"Q:\spt\Dumps\x86\iis_request.dmp");
 }
Exemple #15
0
        private static void InitMethodTables(SptWrapper wrapper)
        {
            s_usefulMethodTables = new Dictionary<ulong, Type>();
            s_usefulMethodTablesInverse = new Dictionary<Type, ulong>();

            foreach (var type in s_primitives)
            {
                var typeMt = wrapper.Proc.FindTypeByName("mscorlib.dll", type.FullName);
                s_usefulMethodTables.Add(typeMt, type);
                s_usefulMethodTablesInverse.Add(type, typeMt);
            }
        }
Exemple #16
0
 public static void EnsureInit(SptWrapper wrapper)
 {
     if (s_usefulMethodTables == null)
     {
         InitMethodTables(wrapper);
     }
 }
Exemple #17
0
 public static bool threads(SptWrapper wrapper, string args)
 {
     return(RunMethod <Threads>(wrapper, args));
 }
Exemple #18
0
 public static bool dumpmd(SptWrapper wrapper, string args)
 {
     return(RunMethod <DumpMD>(wrapper, args));
 }
Exemple #19
0
 public static bool name2ee(SptWrapper wrapper, string args)
 {
     return(RunMethod <Name2EE>(wrapper, args));
 }