Ejemplo n.º 1
0
        internal void AddCrashHash(CIContainer aContainer)
        {
            //hash is only calculated for normal crashes - registrations and reports are omitted
            if (iFileType == XmlConsts.MobileCrashFileType.ETypeBasicCrash)
            {
                CISummarisableEntity primarySummary = aContainer.PrimarySummary;
                if (primarySummary != null)
                {
                    MobileCrashHashBuilder.TConfiguration config = MobileCrashHashBuilder.TConfiguration.EDefault;
                    try //CCrashInfoHashBuilder.New throws an exception if there's not enough data for hash creation
                    {
                        MobileCrashHashBuilder builder = MobileCrashHashBuilder.New(config, primarySummary);

                        if (builder != null)
                        {
                            iHash = builder.GetHash();
                        }

                        // Detailed hash
                        config  = MobileCrashHashBuilder.TConfiguration.EDetailed;
                        builder = MobileCrashHashBuilder.New(config, primarySummary, MobileCrashHashBuilder.KDetailedNumberOfStackEntriesToCheckForSymbols);

                        if (builder != null)
                        {
                            iDetailedHash = builder.GetHash();
                        }
                    }
                    catch (Exception /* e */)
                    {
                        //Not enough data -> no hash and no grouping
                    }
                }
            }
        }
Ejemplo n.º 2
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);
        }