public void Execute(CommandExecutionContext context) { context.EnterDbgEngNativeMode(); // In case the user is going to use sos/sosex, make sure they have // the appropriate DAC location configured. context.WriteLine("Loading DAC from " + context.DacLocation); context.NativeDbgEngTarget.ExecuteDbgEngCommand( ".cordll -ve -sd -lp " + Path.GetDirectoryName(context.DacLocation), context); // SOS hasn't necessarily been loaded at this point; try to load it // from the symbol server and then issue the appropriate .load command // so that the user can have it immediately available. string sosLocation = context.Runtime.TryDownloadSos(); if (sosLocation == null) { context.WriteWarning( "Unable to load SOS automatically from symbol server, " + "try to find and .load it manually if needed."); } else { context.WriteLine("Loading SOS from " + sosLocation); context.NativeDbgEngTarget.ExecuteDbgEngCommand( ".load " + sosLocation, context); } }
public void Execute(CommandExecutionContext context) { context.EnterDbgEngNativeMode(); // In case the user is going to use sos/sosex, make sure they have // the appropriate DAC location configured. context.WriteLine("Loading DAC from " + context.DacLocation); context.NativeDbgEngTarget.ExecuteDbgEngCommand( ".cordll -ve -sd -lp " + Path.GetDirectoryName(context.DacLocation), context); // SOS hasn't necessarily been loaded at this point; try to load it // from the symbol server and then issue the appropriate .load command // so that the user can have it immediately available. string sosLocation = context.Runtime.TryDownloadSos(); if (sosLocation == null) { context.WriteWarningLine( "Unable to load SOS automatically from symbol server, " + "try to find and .load it manually if needed."); } else { context.WriteLine("Loading SOS from " + sosLocation); context.NativeDbgEngTarget.ExecuteDbgEngCommand( ".load " + sosLocation, context); } }
public void Execute(CommandExecutionContext context) { var reportDocument = new ReportDocument(); var components = from type in Assembly.GetExecutingAssembly().GetTypes() where type.GetInterface(typeof(IReportComponent).FullName) != null where !type.IsAbstract select(IReportComponent) Activator.CreateInstance(type); // Many commands require a DbgEng target to be available, so it makes sense to // initialize it early-on and use it across all components that need it. context.EnterDbgEngNativeMode(); try { foreach (var component in components) { if (component.Generate(context)) { reportDocument.Components.Add(component); } } } catch (Exception ex) { reportDocument.AnalysisResult = AnalysisResult.InternalError; reportDocument.AnalysisError = ex.ToString(); } context.ExitDbgEngNativeMode(); reportDocument.AnalysisEndTime = DateTime.Now; string jsonReport = JsonConvert.SerializeObject(reportDocument, Formatting.Indented, new StringEnumConverter()); File.WriteAllText(FileName, jsonReport); }