private void TryToPrimeDbgEngine() { DbgEngine debugEngine = iDebugEngine; // Exception primerException = null; CACmdLineFSEntityList <CACmdLineFSEntity> metaDataFiles = iInputs.MetaDataFiles; // try { debugEngine.Clear(); foreach (CACmdLineFileSource file in iInputs.SourceFiles) { // Tell all used RomIds to debugEngine. if (file.RomId != null) { debugEngine.AddActiveRomId(file.RomId.Value); } // Tell all RomIds which needs symbols to debugEngine so that // we load only symbols for those. if (file.ContentType == TMobileCrashContentType.EContentTypePanic || file.ContentType == TMobileCrashContentType.EContentTypeException) { debugEngine.AddSymbolRomId(file.RomId.Value); } } foreach (CACmdLineFSEntity entry in metaDataFiles) { Trace("[CA Cmd] Seeding debug meta engine with entry: " + entry.Name); DbgEntity entity = debugEngine.Add(entry.Name); if (entity != null) { Trace("[CA Cmd] Entry type detected as: [" + entity.CategoryName + "]"); entity.Tag = entry; } else { Trace("[CA Cmd] Entry not handled: " + entry.Name); entry.AddError("Meta-Data File Not Supported", "The file \'" + entry.Name + "\' is of unknown origin."); } } // Listen to prime events try { Trace("[CA Cmd] Starting prime operation... "); debugEngine.EntityPrimingStarted += new DbgEngine.EventHandler(DbgEngine_EntityPrimingStarted); debugEngine.EntityPrimingProgress += new DbgEngine.EventHandler(DbgEngine_EntityPrimingProgress); debugEngine.EntityPrimingComplete += new DbgEngine.EventHandler(DbgEngine_EntityPrimingComplete); debugEngine.Prime(TSynchronicity.ESynchronous); Trace("[CA Cmd] Debug meta data priming completed successfully."); } finally { debugEngine.EntityPrimingStarted -= new DbgEngine.EventHandler(DbgEngine_EntityPrimingStarted); debugEngine.EntityPrimingProgress -= new DbgEngine.EventHandler(DbgEngine_EntityPrimingProgress); debugEngine.EntityPrimingComplete -= new DbgEngine.EventHandler(DbgEngine_EntityPrimingComplete); } } catch (Exception exception) { Trace("[CA Cmd] Debug meta data priming exception: " + exception.Message + ", " + exception.StackTrace); primerException = exception; } // Go through each debug entity and check it for errors. Add diagnostics // and error messages where appropriate. foreach (DbgEntity entity in debugEngine) { string name = entity.FullName; // CACmdLineFSEntity file = metaDataFiles[name]; file.Clear(); // if (entity.PrimerResult.PrimedOkay) { if (!entity.Exists) { file.AddError("Meta-Data File Missing", string.Format("The file \'{0}\' could not be found.", file.Name)); } else if (entity.IsUnsupported) { file.AddError("Meta-Data File Not Supported", string.Format("The file \'{0}\' is of unknown origin.", file.Name)); } } else { // Add error file.AddError("Meta-Data Read Error", entity.PrimerResult.PrimeErrorMessage); // And diagnostic information Exception exception = entity.PrimerResult.PrimeException != null ? entity.PrimerResult.PrimeException : primerException; if (exception != null) { file.AddDiagnostic("Meta-Data Exception Message", entity.PrimerResult.PrimeException.Message); file.AddDiagnostic("Meta-Data Exception Stack", entity.PrimerResult.PrimeException.StackTrace); } else { file.AddDiagnostic("Meta-Data Unknown Failure", "No exception occurred at the primer or entity level?"); } } } }
private void TryToCreateOutput(CISink aXmlSink, CIContainer aContainer, CACmdLineFileSource aFile, CACmdLineMessage[] aMessagesToAdd) { Trace("[CA Cmd] TryToCreateOutput() - START - container source: {0}", aContainer.Source.MasterFileName); // By the time we are outputting a container, there should no longer be any messages // associated with the file. System.Diagnostics.Debug.Assert(aFile.Count == 0); // Check whether the file contained any errors or // messages of it own. if (aMessagesToAdd.Length > 0) { // Copy warnings, messages and errors into crash item container. // Diagnostic messages are not copied. CACmdLineFSEntity.CopyMessagesToContainer(aMessagesToAdd, aContainer); } // This is where we will record the output attempt CACmdLineFileSource.OutputEntry outputEntry = null; // try { // Finish preparing the sink parameters CISinkSerializationParameters sinkParams = iInputs.SinkParameters; sinkParams.Container = aContainer; // Perform serialization Trace("[CA Cmd] TryToCreateOutput() - serializing..."); object output = aXmlSink.Serialize(sinkParams); Trace("[CA Cmd] TryToCreateOutput() - serialization returned: " + output); if (aFile != null) { // Create new output string outputFileName = output is string?(string)output : string.Empty; // Save output file name outputEntry = aFile.AddOutput(aContainer, outputFileName, TOutputStatus.ESuccess); } // Merge in any diagnostic messages that were left into the output entry. // This ensure we output diagnostics in the final manifest data. outputEntry.AddRange(aMessagesToAdd, CACmdLineMessage.TType.ETypeDiagnostic); } catch (Exception outputException) { Trace("[CA Cmd] TryToCreateOutput() - outputException.Message: " + outputException.Message); Trace("[CA Cmd] TryToCreateOutput() - outputException.StackTrace: " + outputException.StackTrace); if (aFile != null) { // Something went wrong with CI serialisation for the specified container. outputEntry = aFile.AddOutput(aContainer, string.Empty, TOutputStatus.EFailed); // outputEntry.AddError("Could not Create CI", "CI output could not be created"); outputEntry.AddDiagnostic("CI Sink Exception Message", outputException.Message); outputEntry.AddDiagnostic("CI Sink Exception Stack", outputException.StackTrace); // Since we didn't manage to sink the container to CI successfully, we must // make sure we don't lose any associated messages from the original file. // Merge these into the output entry also. outputEntry.AddRange(aMessagesToAdd); } } }
public bool Contains(string aFileName) { CACmdLineFSEntity ret = this[aFileName]; return(ret != null); }