private void CreateRuntime() { ClrInfo clrInfo = _target.ClrVersions[_clrVersionIndex]; string dacLocation = clrInfo.TryDownloadDac(); _context.WriteInfo("Using Data Access DLL at: " + dacLocation); _context.DacLocation = dacLocation; _context.ClrVersion = clrInfo; _context.Runtime = _target.CreateRuntime(dacLocation); _context.Heap = _context.Runtime.GetHeap(); _target.DefaultSymbolNotification = new SymbolNotification(_context); }
private void StartRuntime(string Target) { DataTarget dataTarget = DataTarget.LoadCrashDump(Target); ClrInfo latest = null; foreach (var version in dataTarget.ClrVersions) { WriteLine("Version: {0}.{1}.{2}.{3} from {4}", version.Version.Major, version.Version.Minor, version.Version.Patch, version.Version.Revision, version.DacInfo.FileName); latest = version; } m_runtime = dataTarget.CreateRuntime(latest.TryDownloadDac()); ulong strMT, arrMT, freeMT = 0; AdHoc.GetCommonMT(m_runtime, out strMT, out arrMT, out freeMT); WriteLine("Free MT: {0:x16}, String MT: {1:x16}, Array MT: {2:x16}", freeMT, strMT, arrMT); WriteLine("== App Domains ==="); int i = 0; DumpDomains(); //foreach (var appDomain in AdHoc.GetDomains(m_runtime)) //{ // i++; // if (i == 1) // { // WriteLine("{0:x16} System", appDomain.Address); // WriteLine(" Modules: {0}", appDomain.Modules.Count); // continue; // } // if (i == 2) // { // WriteLine("{0:x16} Shared", appDomain.Address); // WriteLine(" Modules: {0}", appDomain.Modules.Count); // continue; // } // WriteLine("{0:x16} {1}", appDomain.Address, appDomain.Name); // WriteLine(" {0}{1}", appDomain.ApplicationBase, appDomain.ConfigurationFile); // WriteLine(" Modules: {0}", appDomain.Modules.Count); //} WriteLine("=================="); WriteLine("Heap(s): {0} GC Server Mode: {1}", m_runtime.HeapCount, m_runtime.ServerGC); m_heap = m_runtime.GetHeap(); heapObjs = m_heap.EnumerateObjects().GetEnumerator(); count = 0; }
public void OpenDacLocation(ClrInfo selectedClr) { if (selectedClr == null) { return; } var location = selectedClr.TryGetDacLocation() ?? selectedClr.TryDownloadDac(); if (File.Exists(location)) { Process.Start("explorer.exe", "/select, " + location); } }
private static string LoadCorrectDacForMemoryDump(ClrInfo version) { // First try the main location, i.e.: // C:\Windows\Microsoft.NET\Framework\v4.0.30319\mscordacwks.dll if (version.LocalMatchingDac != null && File.Exists(version.LocalMatchingDac)) { Console.WriteLine("\nDac already exists on the local machine at:\n{0}", version.LocalMatchingDac); return(version.LocalMatchingDac); } // Location: <TEMP>\symbols\mscordacwks_amd64_amd64_4.0.30319.18444.dll\52717f9a96b000\mscordacwks_amd64_amd64_4.0.30319.18444.dll ModuleInfo dacInfo = version.DacInfo; var dacLocation = string.Format(@"{0}symbols\{1}\{2:x}{3:x}\{4}", Path.GetTempPath(), dacInfo.FileName, dacInfo.TimeStamp, dacInfo.FileSize, dacInfo.FileName); if (File.Exists(dacLocation)) { Console.WriteLine("\nDac {0} already exists in the local cache at:\n{1}", dacInfo.FileName, dacLocation); return(dacLocation); } else { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nUnable to find copy of the dac ({0}) on the local machine.", dacInfo); Console.WriteLine("Expected location:\n" + dacLocation); Console.WriteLine("\nIt will now be downloaded from the Microsoft Symbol Server."); Console.WriteLine("Press <ENTER> if you are okay with this, if not you can just type Ctrl-C to exit"); Console.ResetColor(); Console.ReadLine(); string downloadLocation = version.TryDownloadDac(new SymbolNotification()); Console.WriteLine("Downloaded a copy of the dac to:\n" + downloadLocation); return(downloadLocation); } }