Example #1
0
        private void XmlSerializeRegisters(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            // Must obtain the registers in advance to avoid creating an empty list.
            List <CIRegisterList> regs = new List <CIRegisterList>();

            // Find register lists
            CIElementList <CIRegisterListCollection> allRegs = iThread.ChildrenByType <CIRegisterListCollection>();

            foreach (CIRegisterListCollection registerListCol in allRegs)
            {
                foreach (CIRegisterList registerList in registerListCol)
                {
                    if (registerList.Count > 0)
                    {
                        regs.Add(registerList);
                    }
                }
            }

            // Only write something if we have some entries
            if (regs.Count > 0)
            {
                CXmlNode.WriteLinkListStart(aParameters.Writer, SegConstants.Registers);
                foreach (CIRegisterList registerList in regs)
                {
                    CXmlNode.WriteLink(registerList.Id, SegConstants.Registers, aParameters.Writer);
                }
                CXmlNode.WriteLinkListEnd(aParameters.Writer);
            }
        }
Example #2
0
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            if (!iEntry.IsRegisterBasedEntry)
            {
                aParameters.Writer.WriteElementString(SegConstants.CmnAddress, iEntry.Address.ToString("x8"));
            }
            //
            aParameters.Writer.WriteElementString(SegConstants.CmnValue, iEntry.Data.ToString("x8"));
            aParameters.Writer.WriteElementString(SegConstants.CmnText, iEntry.DataAsString);
            if (iEntry.FunctionOffset != 0)
            {
                aParameters.Writer.WriteElementString(SegConstants.Stacks_Stack_Data_Offset, iEntry.FunctionOffset.ToString("x4"));
            }
            //
            if (iEntry.IsRegisterBasedEntry)
            {
                // Get the corresponding register from the stack
                CIStack    stack    = iEntry.Stack;
                CIRegister register = iEntry.Register;
                if (register != null)
                {
                    CXmlNode.WriteLink(register.Id, SegConstants.Registers, aParameters.Writer);
                }
            }

            if (iEntry.Symbol != null)
            {
                CXmlNode.WriteLink(iEntry.Symbol.Id, SegConstants.Symbols, aParameters.Writer);
            }
        }
Example #3
0
        protected override void XmlSerializeChildren(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CIElementList <CIRegisterVisualization> visList = iRegister.ChildrenByType <CIRegisterVisualization>();

            foreach (CIRegisterVisualization vis in visList)
            {
                CXmlNode.WriteLink(vis.Id, SegConstants.ValueInterpretation, aParameters.Writer);
            }
        }
Example #4
0
        public static void XmlSerializeMessages(CXmlDocumentSerializationParameters aParameters, CIElement aElement)
        {
            CIElementList <CIMessage> messages = aElement.ChildrenByType <CIMessage>();

            foreach (CIMessage msg in messages)
            {
                CXmlNode.WriteLink(msg.Id, SegConstants.Messages, aParameters.Writer);
            }
        }
Example #5
0
        private void XmlSerializeStacks(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            // Find stacks
            CIElementList <CIStack> stacks = iThread.ChildrenByType <CIStack>();

            // Only write something if we have some entries
            if (stacks.Count > 0)
            {
                CXmlNode.WriteLinkListStart(aParameters.Writer, SegConstants.Stacks);
                foreach (CIStack item in stacks)
                {
                    CXmlNode.WriteLink(item.Id, SegConstants.Stacks, aParameters.Writer);
                }
                CXmlNode.WriteLinkListEnd(aParameters.Writer);
            }
        }
Example #6
0
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CXmlNode.WriteId(iSymbol, aParameters.Writer);

            aParameters.Writer.WriteElementString(SegConstants.CmnAddress, iSymbol.Symbol.Address.ToString("x8"));
            aParameters.Writer.WriteElementString(SegConstants.CmnSize, iSymbol.Symbol.Size.ToString("x8"));
            aParameters.Writer.WriteElementString(SegConstants.CmnName, iSymbol.Symbol.Name);
            aParameters.Writer.WriteElementString(SegConstants.Symbols_SymbolSet_Symbol_Object, iSymbol.Symbol.Object);

            // If there is a link to a code code segment, then write that too.
            CICodeSeg correspondingCodeSeg = iSymbol.CodeSegment;

            if (correspondingCodeSeg != null)
            {
                CXmlNode.WriteLink(correspondingCodeSeg.Id, SegConstants.CodeSegs, aParameters.Writer);
            }
        }
Example #7
0
        protected override void XmlSerializeChildren(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            // Stacks
            CXmlNode.WriteLinkListStart(aParameters.Writer, SegConstants.Threads);
            foreach (CIThread thread in iProcess.Threads)
            {
                CXmlNode.WriteLink(thread.Id, SegConstants.Threads, aParameters.Writer);
            }
            CXmlNode.WriteLinkListEnd(aParameters.Writer);

            // Code segments
            CXmlNode.WriteLinkListStart(aParameters.Writer, SegConstants.CodeSegs);
            foreach (CICodeSeg codeSeg in iProcess.CodeSegments)
            {
                CXmlNode.WriteLink(codeSeg.Id, SegConstants.CodeSegs, aParameters.Writer);
            }
            CXmlNode.WriteLinkListEnd(aParameters.Writer);
        }
Example #8
0
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CXmlNode.WriteId(iRegister, aParameters.Writer);

            // Map the ArmRegister name onto the register names we expose via XML. In reality, the only register names
            // that need remapping are R13, R14 and R15.
            string regName = RemapRegisterName();

            aParameters.Writer.WriteElementString(SegConstants.CmnName, regName);
            aParameters.Writer.WriteElementString(SegConstants.CmnValue, iRegister.Value.ToString("x8"));

            if (iRegister.Symbol != null && CXmlSymbol.IsSerializable(iRegister.Symbol))
            {
                CXmlNode.WriteLink(iRegister.Symbol.Id, SegConstants.Symbols, aParameters.Writer);
            }

            // Write any messages
            CXmlSegBase.XmlSerializeMessages(aParameters, iRegister);
        }
Example #9
0
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CXmlNode.WriteId(iStack, aParameters.Writer);

            if (iStack.Registers != null)
            {
                CXmlNode.WriteLink(iStack.Registers.Id, SegConstants.Registers, aParameters.Writer);
            }
            if (iStack.OwningThread != null)
            {
                CXmlNode.WriteLink(iStack.OwningThread.Id, SegConstants.Threads, aParameters.Writer);
            }

            aParameters.Writer.WriteElementString(SegConstants.CmnBase, iStack.Base.ToString("x8"));
            aParameters.Writer.WriteElementString(SegConstants.CmnSize, iStack.Size.ToString("x"));
            aParameters.Writer.WriteElementString(SegConstants.CmnRange, iStack.Range.ToString());

            // Write defect hash
            try
            {
                MobileCrashHashBuilder hashBuilder = MobileCrashHashBuilder.New(MobileCrashHashBuilder.TConfiguration.EDefault, iStack);
                if (hashBuilder != null)
                {
                    aParameters.Writer.WriteElementString(SegConstants.Stacks_Stack_Hash, hashBuilder.GetHash());
                }

                // Write detailed hash
                hashBuilder = MobileCrashHashBuilder.New(MobileCrashHashBuilder.TConfiguration.EDetailed, iStack, MobileCrashHashBuilder.KDetailedNumberOfStackEntriesToCheckForSymbols);

                if (hashBuilder != null)
                {
                    aParameters.Writer.WriteElementString(SegConstants.Stacks_Stack_Detailed_Hash, hashBuilder.GetHash());
                }
            }
            catch (Exception)
            {
                // Could not create MobileCrashHashBuilder, ignore.
            }

            // Write any messages
            CXmlSegBase.XmlSerializeMessages(aParameters, iStack);
        }
Example #10
0
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CXmlNode.WriteId(iValue, aParameters.Writer);

            aParameters.Writer.WriteElementString(SegConstants.ValueInterpretation_Entry_Hex, iValue.Value.ToString("x8"));
            aParameters.Writer.WriteElementString(SegConstants.ValueInterpretation_Entry_Binary, iValue.Binary);
            aParameters.Writer.WriteElementString(SegConstants.CmnSize, iValue.Size.ToString());

            // Endianness
            aParameters.Writer.WriteStartElement(SegConstants.ValueInterpretation_Entry_Endianness);
            aParameters.Writer.WriteAttributeString(SegConstants.CmnType, SegConstants.ValueInterpretation_Entry_Endianness_Little);
            aParameters.Writer.WriteAttributeString(SegConstants.ValueInterpretation_Entry_Endianness_Bit0, SegConstants.ValueInterpretation_Entry_Endianness_Bit0_Right);
            aParameters.Writer.WriteEndElement();

            // Associated register
            CXmlNode.WriteLink(iValue.Register.Id, SegConstants.Registers, aParameters.Writer);

            // Description
            aParameters.Writer.WriteElementString(SegConstants.ValueInterpretation_Entry_Description, iValue.Description);
        }
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CXmlNode.WriteId(iList, aParameters.Writer);

            // Abbreviated type
            string typeAbbreviated = ArmRegisterBankUtils.BankAsString(iList.Bank);

            aParameters.Writer.WriteElementString(SegConstants.CmnType, typeAbbreviated);

            // Long type
            string typeLong = ArmRegisterBankUtils.BankAsStringLong(iList.Bank);

            aParameters.Writer.WriteElementString(SegConstants.CmnName, typeLong);

            // Link to thread
            if (iList.OwningThread != null)
            {
                CXmlNode.WriteLink(iList.OwningThread.Id, SegConstants.Threads, aParameters.Writer);
            }
        }
Example #12
0
        protected override void XmlSerializeContent(CrashXmlPlugin.FileFormat.Document.CXmlDocumentSerializationParameters aParameters)
        {
            CXmlNode.WriteId(iThread, aParameters.Writer);

            aParameters.Writer.WriteElementString(SegConstants.CmnName, iThread.Name);
            aParameters.Writer.WriteElementString(SegConstants.Threads_Thread_FullName, iThread.FullName);

            // Parent process
            if (iThread.OwningProcess != null)
            {
                CXmlNode.WriteLink(iThread.OwningProcess.Id, SegConstants.Processes, aParameters.Writer);
            }

            // Thread priority
            if (iThread.Priority != 0)
            {
                aParameters.Writer.WriteElementString(SegConstants.CmnPriority, iThread.Priority.ToString());
            }

            // Write any messages
            CXmlSegBase.XmlSerializeMessages(aParameters, iThread);
        }