Пример #1
0
 internal CIElement(CIContainer aContainer)
     : this(aContainer, TAutoPopulateType.EAutoPopulateDisabled)
 {
 }
Пример #2
0
        internal void AddOstTraces(CIContainer aContainer)
        {
            CITraceData traceData = aContainer.Traces;

            //
            if (traceData != null && traceData.Lines.Length > 0)
            {
                foreach (CITrace ciTrace in traceData)
                {
                    System.Text.StringBuilder line = new System.Text.StringBuilder();

                    TraceLine trace = ciTrace;

                    // Type
                    string type = string.Empty;
                    switch (trace.Type)
                    {
                    case TraceLine.TType.ETypeBinary:
                        type = "Bin";
                        break;

                    case TraceLine.TType.ETypeRaw:
                        type = "Raw";
                        break;

                    case TraceLine.TType.ETypeText:
                        type = "Text";
                        break;

                    default:
                        type = "Unknown";
                        break;
                    }
                    if (string.IsNullOrEmpty(type) == false)
                    {
                        line.Append(type);
                    }

                    // Context id
                    if (trace.ContextId != 0)
                    {
                        line.Append(" " + "0x" + trace.ContextId.ToString("x8"));
                    }

                    // Time stamp
                    line.Append(" " + trace.TimeStamp.ToString());

                    // Prefix
                    string prefix = trace.Prefix;
                    if (string.IsNullOrEmpty(prefix) == false)
                    {
                        line.Append(" " + prefix);
                    }

                    // Suffix
                    string suffix = trace.Suffix;
                    if (string.IsNullOrEmpty(suffix) == false)
                    {
                        line.Append(" " + suffix);
                    }

                    if (trace.HasIdentifier)
                    {
                        // Component/group/id triplet
                        TraceIdentifier identifier = trace.Identifier;
                        line.Append(" C:" + "0x" + identifier.Component.ToString("x8"));
                        line.Append(" G:" + identifier.Group.ToString());
                        line.Append(" I:" + identifier.Id.ToString());
                        // File & line
                        TraceLocation location = identifier.Location;
                        //
                        string file       = location.File;
                        string lineNumber = location.Line.ToString();
                        //
                        if (string.IsNullOrEmpty(file) == false && string.IsNullOrEmpty(lineNumber) == false)
                        {
                            line.Append(" " + file);
                            line.Append(":" + lineNumber);
                        }
                    }

                    // Payload
                    string payload = trace.Payload;
                    line.Append(" " + payload);
                    iOstTraces.Add(line.ToString());
                }
            }
        }
Пример #3
0
 public static IEnumerable <CIRegisterVisBit> ExtractBits(CIContainer aContainer, uint aValue, string aByte3Mask, string aByte2Mask, string aByte1Mask, string aByte0Mask)
 {
     return(ExtractBits(aContainer, aValue, aByte3Mask + aByte2Mask + aByte1Mask + aByte0Mask));
 }
 public CIRegisterListCollection(CIContainer aContainer)
     : this(aContainer, null)
 {
 }
Пример #5
0
 public CIInfoEnvironment(CIContainer aContainer)
     : base(aContainer)
 {
 }
Пример #6
0
        private void TryToCreateXmlOutput()
        {
            CACmdLineFSEntityList <CACmdLineFileSource> inputFiles = iInputs.SourceFiles;
            //
            CISink xmlSink = FindXmlSink();

            if (xmlSink == null)
            {
                throw new CACmdLineException("XML Output Plugin Not Available", CAPlugin.KErrCommandLinePluginSinkNotAvailable);
            }

            CACmdLineFSEntityList <CACmdLineFileSource> sourceFileNames = iInputs.SourceFiles;
            int count = sourceFileNames.Count;

            // Emit progress banner
            iProgressReporter.StepBegin("Creating crash XML content...", KStepKeyWritingOutputXml, count);

            for (int i = 0; i < count; i++)
            {
                CACmdLineFileSource file = sourceFileNames[i];

                // If the file has a corresponding source then we know that crash item recognised it.
                if (file.Source == null)
                {
                    // File is not supported by crash item engine. Create dummy container which we'll
                    // serialize below.
                    CACmdLineSource cmdLineSource   = new CACmdLineSource(file.File);
                    CIContainer     failedContainer = CIContainer.NewErrorContainer(CrashItemEngine, cmdLineSource);
                    file.Add(failedContainer);
                }

                // We copy and remove all the file-level messages. These will be added to the container
                // (where appropriate) or then to an output entry otherwise.
                CACmdLineMessage[] fileMessages = file.ToArray();
                file.Clear();

                // At this point, the input file is guaranteed to have associated containers. Either
                // valid ones (created by crash item engine) or a single 'FAILED' one which we just
                // added above.
                foreach (CIContainer container in file.Containers)
                {
                    // Firstly, add any meta-data errors/messages/warnings to this container
                    // as crash item message entries
                    AddMetaDataMessagesToContainer(container);

                    // Now we can try to serialize the container to XML. This method will
                    // not throw an exception.
                    //
                    // If the operation succeeds, then the input file will have an associated
                    // container object (and associated xml output file name) and we need not
                    // do anymore.
                    //
                    // If it fails, then the input file will not be assigned the container
                    // object and therefore, later on, we'll invoke the XML Sink directly to
                    // create a stub 'FAILED' XML output file.
                    TryToCreateXmlOutput(xmlSink, container, file, fileMessages);
                }

                // Report progress as we work through the sources
                iProgressReporter.StepProgress(string.Empty, i, KStepKeyWritingOutputXml);
            }

            iProgressReporter.StepEnd(string.Empty, KStepKeyWritingOutputXml);
        }
Пример #7
0
 public CIHeader(CIContainer aContainer)
     : base(aContainer)
 {
 }
Пример #8
0
 public CIMessageWarning(CIContainer aContainer, string aTitle)
     : base(aContainer, aTitle)
 {
     Type  = TType.ETypeWarning;
     Color = System.Drawing.Color.DarkBlue;
 }
Пример #9
0
        public override void Check(CIContainer aContainer)
        {
            CISummarisableEntityList list = aContainer.Summaries;

            foreach (CISummarisableEntity entry in list)
            {
                // Check that each stack contains some registers and at least the SP.
                bool stackAvailable = entry.IsAvailable(CISummarisableEntity.TElement.EElementStack);
                bool regsAvailable  = entry.IsAvailable(CISummarisableEntity.TElement.EElementRegisters);
                //
                if (stackAvailable)
                {
                    CIStack stack = entry.Stack;
                    //
                    if (regsAvailable)
                    {
                        CIRegisterList regs = stack.Registers;

                        // Check that SP, LR and PC are available
                        bool pointerAvailable = regs.Contains(TArmRegisterType.EArmReg_SP);
                        if (!pointerAvailable)
                        {
                            base.CreateWarning(aContainer, stack,
                                               LibResources.CIPDRegAvailability_MissingSP_Title,
                                               string.Format(LibResources.CIPDRegAvailability_MissingSP_Description, base.CreateIdentifierText(entry))
                                               );
                        }
                        //
                        bool lrAvailable = regs.Contains(TArmRegisterType.EArmReg_LR);
                        if (!lrAvailable)
                        {
                            base.CreateWarning(aContainer, stack,
                                               LibResources.CIPDRegAvailability_MissingLR_Title,
                                               string.Format(LibResources.CIPDRegAvailability_MissingLR_Description, base.CreateIdentifierText(entry))
                                               );
                        }
                        //
                        bool pcAvailable = regs.Contains(TArmRegisterType.EArmReg_PC);
                        if (!pcAvailable)
                        {
                            base.CreateWarning(aContainer, stack,
                                               LibResources.CIPDRegAvailability_MissingPC_Title,
                                               string.Format(LibResources.CIPDRegAvailability_MissingPC_Description, base.CreateIdentifierText(entry))
                                               );
                        }

                        // If R0 is available, check if it is 0 and check whether an exception occurred - if so, it was possibly
                        // caused by de-referencing a NULL this pointer.
                        bool threadAvailable = entry.IsAvailable(CISummarisableEntity.TElement.EElementThread);
                        if (threadAvailable)
                        {
                            if (regs.Contains(TArmRegisterType.EArmReg_00))
                            {
                                CIRegister r0 = regs[TArmRegisterType.EArmReg_00];
                                //
                                bool r0WasNull    = (r0.Value == 0);
                                bool wasException = entry.IsAbnormalTermination && (entry.Thread.ExitInfo.Type == CrashItemLib.Crash.ExitInfo.CIExitInfo.TExitType.EExitTypeException);
                                bool wasKernExec3 = entry.IsAbnormalTermination && (entry.Thread.ExitInfo.Type == CrashItemLib.Crash.ExitInfo.CIExitInfo.TExitType.EExitTypePanic &&
                                                                                    entry.Thread.ExitInfo.Category.ToUpper() == "KERN-EXEC" &&
                                                                                    entry.Thread.ExitInfo.Reason == 3);
                                //
                                if (r0WasNull && (wasException || wasKernExec3))
                                {
                                    base.CreateWarning(aContainer, r0,
                                                       LibResources.CIPDRegAvailability_NullThisPointer_Title,
                                                       string.Format(LibResources.CIPDRegAvailability_NullThisPointer_Description, base.CreateIdentifierText(entry))
                                                       );
                                }
                            }
                        }
                    }
                    else
                    {
                        base.CreateWarning(aContainer, stack,
                                           LibResources.CIPDRegAvailability_NoRegsForStack_Title,
                                           string.Format(LibResources.CIPDRegAvailability_NoRegsForStack_Description, base.CreateIdentifierText(entry))
                                           );
                    }
                }
            }
        }
Пример #10
0
        public CIContainer CreateErrorContainer(CFFSource aDescriptor)
        {
            CIContainer item = CIContainer.NewErrorContainer(Engine, aDescriptor);

            return(item);
        }
Пример #11
0
 public CIMessageWarning(CIContainer aContainer)
     : this(aContainer, string.Empty)
 {
 }
Пример #12
0
 internal CIElement(CIContainer aContainer, CIElement aParent, TAutoPopulateType aDataBindingAutoPopulate)
     : this(aContainer, aDataBindingAutoPopulate)
 {
     iParent = aParent;
 }
Пример #13
0
 internal CIElement(CIContainer aContainer, TAutoPopulateType aDataBindingAutoPopulate)
     : this(aContainer.GetNextElementId(), aDataBindingAutoPopulate == TAutoPopulateType.EAutoPopulateEnabled)
 {
     iContainer = aContainer;
 }
Пример #14
0
 internal CIElement(CIContainer aContainer, CIElement aParent)
     : this( aContainer )
 {
     iParent = aParent;
 }
Пример #15
0
 public CIRegisterVisBitGroup(CIContainer aContainer, string aCategory)
     : base(aContainer)
 {
     base.Category = aCategory;
 }
Пример #16
0
 internal CISymbol(CIContainer aContainer, uint aAddress)
     : base(aContainer)
 {
     iAddress = aAddress;
 }
Пример #17
0
 public CITrace(CIContainer aContainer, TraceLine aLine)
     : base(aContainer)
 {
     iLine = aLine;
 }
Пример #18
0
 internal CISymbol(CIContainer aContainer, Symbol aSymbol)
     : this(aContainer, aSymbol.Address)
 {
     AssignPermanentSymbol(aSymbol);
 }
Пример #19
0
        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);
                }
            }
        }
Пример #20
0
 public CIMessageError(CIContainer aContainer)
     : this(aContainer, string.Empty)
 {
 }
Пример #21
0
 public CIInfoHW(CIContainer aContainer)
     : base(aContainer)
 {
 }
Пример #22
0
 public CIMessageError(CIContainer aContainer, string aTitle)
     : base(aContainer, aTitle)
 {
     Type  = TType.ETypeError;
     Color = System.Drawing.Color.Red;
 }
 internal CIRegisterListCollection(CIContainer aContainer, CIElement aParent)
     : base(aContainer, aParent)
 {
 }
Пример #24
0
 public abstract void Check(CIContainer aContainer);
 protected CIRegisterVisBitList(CIContainer aContainer)
     : base(aContainer)
 {
 }
Пример #26
0
 protected void CreateError(CIContainer aContainer, CIElement aAssociatedElement, string aTitle)
 {
     CreateError(aContainer, aAssociatedElement, aTitle, string.Empty);
 }
Пример #27
0
 public CIMemoryInfo(CIContainer aContainer)
     : base(aContainer)
 {
 }
Пример #28
0
 public CIRegisterVisBitGroup(CIContainer aContainer)
     : base(aContainer)
 {
 }
Пример #29
0
 protected CIMessage(CIContainer aContainer)
     : this(aContainer, string.Empty)
 {
 }
Пример #30
0
 internal CISymbolDictionary(CIContainer aContainer)
     : base(aContainer)
 {
     base.IsToBeFinalizedLast = true;
 }