コード例 #1
0
        /**
         * Writes one datablock as plain text.
         */
        private static void WriteDataBlock(StreamWriter writer, CXmlDataBlock datablock)
        {
            writer.Write(PrettyTitle(KTitleCrashFile));

            // Device
            if (datablock.Platform().Equals(XmlConsts.Kxml_sos))
            {
                writer.Write(PrettyString(XmlConsts.Kxml_platform, XmlConsts.Kxml_s60));
            }
            else
            {
                writer.Write(PrettyString(XmlConsts.Kxml_platform, datablock.Platform()));
            }

            writer.Write(PrettyString(XmlConsts.Kxml_code, datablock.ProductType()));
            writer.Write(PrettyString(XmlConsts.Kxml_version, datablock.SWVersion()));

            if (datablock.RomId() != null)
            {
                writer.Write(PrettyString(XmlConsts.Kxml_romid, "0x" + datablock.RomId().Value.ToString("X8")));
            }

            // variant is not written.

            if (datablock.Imei() != string.Empty)
            {
                writer.Write(PrettyString(XmlConsts.Kxml_imei, datablock.Imei()));
            }

            writer.Write(PrettyString(XmlConsts.Kxml_timestamp, datablock.TimeStampText()));

            string crashtypestr = "Not found";

            if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeBasicCrash)
            {
                crashtypestr = XmlConsts.Kxml_type_crash;
            }
            else if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeAliveMessage)
            {
                crashtypestr = XmlConsts.Kxml_type_alivemsg;
            }
            else if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeCrashAPIReport)
            {
                crashtypestr = XmlConsts.Kxml_type_report;
            }
            else if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeRegistrationMessage)
            {
                crashtypestr = XmlConsts.Kxml_type_regmsg;
            }

            writer.Write(PrettyString(XmlConsts.Kxml_type, crashtypestr));

            writer.Write(PrettyString(XmlConsts.Kxml_file_name, datablock.BinFilename()));

            if (crashtypestr.Equals(XmlConsts.Kxml_type_report))
            {
                writer.Write(PrettyString(XmlConsts.Kxml_report_category, datablock.ReportCategory()));
            }

            if (crashtypestr.Equals(XmlConsts.Kxml_type_report))
            {
                writer.Write(PrettyString(XmlConsts.Kxml_report_type, datablock.ReportType()));
            }

            if (datablock.CrashedModuleName() != string.Empty)
            {
                writer.Write(PrettyString(XmlConsts.Kxml_crashed_module, datablock.CrashedModuleName()));
            }

            if (datablock.Hash() != string.Empty)
            {
                writer.Write(PrettyString(XmlConsts.Kxml_defect_hash, datablock.Hash()));
            }

            if (datablock.DetailedHash() != string.Empty)
            {
                writer.Write(PrettyString(XmlConsts.Kxml_detailed_defect_hash, datablock.DetailedHash()));
            }

            if (datablock.TestSet() != string.Empty)
            {
                writer.Write(PrettyString(XmlConsts.Kxml_testset, datablock.TestSet()));
            }

            WriteDictionaryValues(writer, datablock);

            // Codesegments
            if (datablock.CodeSegs().Count > 0)
            {
                writer.Write(PrettyTitle(KTitleCodesegments));
            }

            foreach (CXmlCodeSegItem codeseg in datablock.CodeSegs())
            {
                string range = "0x" + codeseg.Start.ToString("X8") + " - " + "0x" + codeseg.End.ToString("x8");
                writer.WriteLine(range + FillSpaces(range) + codeseg.Name);
            }

            // Registers
            if (datablock.RegStorage().BasicRegs().ToPrettyString().Length > 0 ||
                datablock.RegStorage().OtherRegLists().Count > 0)
            {
                writer.Write(PrettyTitle(KTitleRegisters));
            }
            writer.WriteLine(datablock.RegStorage().BasicRegs().ToPrettyString());

            // Extra registers
            foreach (CXmlRegisterStorage.CCrashInfoRegisterList registerList in datablock.RegStorage().OtherRegLists())
            {
                writer.WriteLine(registerList.ToPrettyString());
            }

            // Call stacks
            if (datablock.CallStacks().Count > 0)
            {
                writer.Write(PrettyTitle(KTitleCallStacks));
            }

            foreach (XmlFilePlugin.FileFormat.CXmlCallStack stack in datablock.CallStacks())
            {
                writer.WriteLine(stack.ToString());
            }

            // OST traces
            if (datablock.OstTraces().Count > 0)
            {
                writer.Write(PrettyTitle(KTitleOstTraces));
            }

            foreach (string line in datablock.OstTraces())
            {
                writer.WriteLine(line);
            }

            // Event log
            if (datablock.Eventlog().Count > 0)
            {
                writer.Write(PrettyTitle(KTitleEventLog));
            }

            foreach (string line in datablock.Eventlog())
            {
                writer.WriteLine(line);
            }
        }
コード例 #2
0
        private static void WriteReportDetails(XmlWriter aOutput, CXmlDataBlock datablock)
        {
            // Device report details
            aOutput.WriteStartElement(XmlConsts.Kxml_report_details);
            aOutput.WriteAttributeString(XmlConsts.Kxml_timestamp, datablock.TimeStampText());

            string crashtypestr = "Not found";

            if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeBasicCrash)
            {
                crashtypestr = XmlConsts.Kxml_type_crash;
            }
            else if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeAliveMessage)
            {
                crashtypestr = XmlConsts.Kxml_type_alivemsg;
            }
            else if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeCrashAPIReport)
            {
                crashtypestr = XmlConsts.Kxml_type_report;
            }
            else if (datablock.FileType() == XmlConsts.MobileCrashFileType.ETypeRegistrationMessage)
            {
                crashtypestr = XmlConsts.Kxml_type_regmsg;
            }

            aOutput.WriteAttributeString(XmlConsts.Kxml_type, crashtypestr);

            aOutput.WriteAttributeString(XmlConsts.Kxml_file_name, datablock.BinFilename());

            if (crashtypestr.Equals(XmlConsts.Kxml_type_report))
            {
                aOutput.WriteAttributeString(XmlConsts.Kxml_report_category, datablock.ReportCategory());
            }

            if (crashtypestr.Equals(XmlConsts.Kxml_type_report))
            {
                aOutput.WriteAttributeString(XmlConsts.Kxml_report_type, datablock.ReportType());
            }

            if (datablock.CrashedModuleName() != string.Empty)
            {
                aOutput.WriteAttributeString(XmlConsts.Kxml_crashed_module, datablock.CrashedModuleName());
            }

            if (datablock.Hash() != string.Empty)
            {
                aOutput.WriteAttributeString(XmlConsts.Kxml_defect_hash, datablock.Hash());
            }

            if (datablock.DetailedHash() != string.Empty)
            {
                aOutput.WriteAttributeString(XmlConsts.Kxml_detailed_defect_hash, datablock.DetailedHash());
            }

            if (datablock.TestSet() != string.Empty)
            {
                aOutput.WriteAttributeString(XmlConsts.Kxml_testset, datablock.TestSet());
            }

            // Child elements for report details
            if (datablock.CodeSegs().Count > 0)
            {
                aOutput.WriteStartElement(XmlConsts.Kxml_loaded_dlls);
            }
            foreach (CXmlCodeSegItem codeseg in datablock.CodeSegs())
            {
                aOutput.WriteStartElement(XmlConsts.Kxml_loaded_dll);
                aOutput.WriteAttributeString(XmlConsts.Kxml_name, codeseg.Name);
                aOutput.WriteAttributeString(XmlConsts.Kxml_start_address, codeseg.Start.ToString());
                aOutput.WriteAttributeString(XmlConsts.Kxml_end_address, codeseg.End.ToString());
                aOutput.WriteEndElement(); // loaded dll
            }

            if (datablock.CodeSegs().Count > 0)
            {
                aOutput.WriteEndElement(); // loaded dlls
            }

            // Traces
            if (datablock.RegStorage().BasicRegs().Registers.Count > 0 ||
                datablock.CallStacks().Count > 0 ||
                datablock.OstTraces().Count > 0 ||
                datablock.Eventlog().Count > 0 ||
                datablock.RegStorage().OtherRegLists().Count > 0 ||
                datablock.PanicDescription() != String.Empty)
            {
                aOutput.WriteStartElement(XmlConsts.Kxml_traces);
            }

            WriteDetail(aOutput, XmlConsts.Kxml_register, datablock.RegStorage().BasicRegs().ToPrettyString());

            // Extra registers
            System.Text.StringBuilder extraRegisters = new System.Text.StringBuilder();
            foreach (CXmlRegisterStorage.CCrashInfoRegisterList registerList in datablock.RegStorage().OtherRegLists())
            {
                extraRegisters.AppendLine(registerList.ToPrettyString());
            }
            WriteDetail(aOutput, XmlConsts.Kxml_register_extra, extraRegisters.ToString());

            // Call stack
            foreach (XmlFilePlugin.FileFormat.CXmlCallStack stack in datablock.CallStacks())
            {
                WriteDetail(aOutput, XmlConsts.Kxml_call_stack_text, stack.ToString());
            }

            // OST traces
            System.Text.StringBuilder ostTraces = new System.Text.StringBuilder();
            foreach (string line in datablock.OstTraces())
            {
                ostTraces.AppendLine(line);
            }
            WriteDetail(aOutput, XmlConsts.Kxml_trace_data, ostTraces.ToString());

            // Event log
            System.Text.StringBuilder eventLog = new System.Text.StringBuilder();
            foreach (string line in datablock.Eventlog())
            {
                eventLog.AppendLine(line);
            }
            WriteDetail(aOutput, XmlConsts.Kxml_eventlog, eventLog.ToString());

            // Panic description
            WriteDetail(aOutput, XmlConsts.Kxml_panic_description, datablock.PanicDescription());

            if (datablock.RegStorage().BasicRegs().Registers.Count > 0 ||
                datablock.CallStacks().Count > 0 ||
                datablock.OstTraces().Count > 0 ||
                datablock.Eventlog().Count > 0 ||
                datablock.RegStorage().OtherRegLists().Count > 0 ||
                datablock.PanicDescription() != String.Empty)
            {
                aOutput.WriteEndElement(); // traces
            }
            WriteDictionaryValues(aOutput, datablock);
            WriteUniqueValues(aOutput, datablock);

            aOutput.WriteEndElement(); // report details
        }