private void PerformAutomaticAnalysis() { var threadToSwitchTo = _context.Runtime.ThreadWithActiveExceptionOrFirstThread(); if (threadToSwitchTo.CurrentException != null) { _context.WriteInfo("The current thread has an exception; use !pe to view it."); } new SwitchThread() { ManagedThreadId = threadToSwitchTo.ManagedThreadId }.Execute(_context); if (_context.Runtime.OutOfMemoryExceptionOccurred) { _context.WriteInfo("There was an out-of-memory condition in this target:"); var oomInfo = _context.Runtime.OutOfMemoryInformation; _context.WriteInfo("\tAn OOM occurred after GC {0} when trying to allocate {1}", oomInfo.GCNumber, oomInfo.AllocationSize.ToMemoryUnits()); _context.WriteInfo("\t" + oomInfo.Reason); } }
public void Execute(CommandExecutionContext context) { string aliasCommand; if (!context.Aliases.TryGetValue(AliasName, out aliasCommand)) { context.WriteError("Unknown alias '{0}'", AliasName); return; } int index = 1; foreach (var paramValue in AliasParameters.Split(' ')) { aliasCommand = aliasCommand.Replace("$" + index, paramValue); } context.WriteInfo("Alias '{0}' expanded to '{1}'", AliasName, aliasCommand); context.ExecuteCommand(aliasCommand); }
public int Output(DEBUG_OUTPUT mask, string text) { switch (mask) { case DEBUG_OUTPUT.ERROR: _context.WriteError(text); break; case DEBUG_OUTPUT.EXTENSION_WARNING: case DEBUG_OUTPUT.WARNING: _context.WriteWarning(text); break; case DEBUG_OUTPUT.SYMBOLS: _context.WriteInfo(text); break; default: _context.Write(text); break; } return(0); }
private void RunTriage() { string directory = Path.GetDirectoryName(_options.TriagePattern); string pattern = Path.GetFileName(_options.TriagePattern); string[] dumpFiles = Directory.GetFiles(directory, pattern /* TODO: recursively enumerate? */); _context.WriteInfo("Triage: enumerated {0} dump files in directory '{1}'", dumpFiles.Length, directory); Dictionary <string, TriageInformation> triages = new Dictionary <string, TriageInformation>(); for (int i = 0; i < dumpFiles.Length; ++i) { string dumpFile = dumpFiles[i]; string analysisProgressMessage = String.Format("Analyzing dump file '{0}' ({1}/{2})", dumpFile, i + 1, dumpFiles.Length); _context.WriteInfo(analysisProgressMessage); Console.Title = analysisProgressMessage; _target = new AnalysisTarget(dumpFile, _context); TriageInformation triageInformation = new Triage().GetTriageInformation(_context); triages.Add(dumpFile, triageInformation); } _context.WriteLine("{0,-30} {1,-30} {2,-50} {3,-30}", "DUMP", "EVENT", "METHOD", "MEMORY (CMT/RSV/MGD)"); foreach (var kvp in triages) { string dumpFile = kvp.Key; TriageInformation triageInformation = kvp.Value; _context.WriteLine("{0,-30} {1,-30} {2,-50} {3,-30}", dumpFile.TrimStartToLength(30), triageInformation.GetEventDisplayString().TrimStartToLength(30), (triageInformation.FaultingMethod ?? "N/A").TrimStartToLength(50), String.Format("{0}/{1}/{2}", triageInformation.CommittedMemoryBytes.ToMemoryUnits(), triageInformation.ReservedMemoryBytes.ToMemoryUnits(), triageInformation.GCHeapMemoryBytes.ToMemoryUnits() ) ); } var groupedByModule = from triage in triages.Values group triage by triage.FaultingModule into g let count = g.Count() select new { Module = g.Key, Count = count }; _context.WriteLine(); _context.WriteLine("{0,-30} {1,-12}", "MODULE", "COUNT"); foreach (var moduleCount in groupedByModule) { _context.WriteLine("{0,-30} {1,-12}", moduleCount.Module, moduleCount.Count); } var groupedByEvent = from triage in triages.Values group triage by triage.GetEventDisplayString() into g let count = g.Count() select new { Event = g.Key, Count = count }; _context.WriteLine(); _context.WriteLine("{0,-50} {1,-12}", "EVENT", "COUNT"); foreach (var eventCount in groupedByEvent) { _context.WriteLine("{0,-50} {1,-12}", eventCount.Event, eventCount.Count); } }
public void DecompressionComplete(string localPath) { _context.WriteInfo("Extracted symbol file to {0}", localPath); }