コード例 #1
0
        private void PrepareEntryParser()
        {
            // Junk the old paragraphs
            ParserEngine.Reset();

            // Get a handle to our destination container
            DObjectCon container = CrashDebugger.ContainerByType(DObject.TObjectType.EProcess);

            // Save last thread if it looks valid
            if (iCurrentObject != null && iCurrentObject.KernelAddress != 0)
            {
                bool alreadyExists = container.Contains(iCurrentObject);
                if (!alreadyExists)
                {
                    container.Add(iCurrentObject);
                }
                //
                iCurrentObject = null;
            }

            // Create a new object which will contain the next set of parser data
            iCurrentObject = new DProcess(CrashDebugger);

            // Use the helper to prepare next paragraphs
            iHelper.CreateMonitorProcess(ParserEngine, "ENTRY [" + container.TypeDescription + "]", iCurrentObject, new SymbianParserLib.BaseStructures.ParserElementBase.ElementCompleteHandler(ProcessChunksComplete_ElementHandler));
        }
コード例 #2
0
        private ParserParagraph CreateMonitorProcessMemModelMultiple(string aName, DProcess aProcess, ParserElementBase.ElementCompleteHandler aLastFieldHandler)
        {
            ParserParagraph para = new ParserParagraph(aName);

            para.Tag = aProcess;
            if (aLastFieldHandler != null)
            {
                para.ElementComplete += new ParserElementBase.ElementCompleteHandler(aLastFieldHandler);
            }

            // Misc
            ParserLine l0 = ParserLine.NewSymFormat("OS ASID=%d, LPD=%08x, GPD=%08x\r\n");

            l0.SetTargetProperties(aProcess, "OSASID", "LPD", "GPD");

            // Loop body - construct this first as we use it for the header line
            ParserLine l2 = ParserLine.NewSymFormat("%d: Chunk %08x, access count %d\r\n");

            l2[0].SetTargetObject();
            l2[1].SetTargetMethod(this, "AddChunkToProcess");
            l2[2].SetTargetMethod(this, "SetChunkAccessCount");

            // Loop header
            ParserLine l1 = ParserLine.NewSymFormat("ChunkCount=%d ChunkAlloc=%d\r\n");

            l1[0].SetTargetMethod(l2, "SetRepetitions");

            para.Add(l0, l1, l2);
            return(para);
        }
コード例 #3
0
        private ParserParagraph CreateMonitorProcessCommon(string aName, DProcess aProcess)
        {
            ParserParagraph para = new ParserParagraph(aName);
            //
            ParserLine l1 = ParserLine.NewSymFormat("ExitInfo %d,%d,%lS\r\n");

            l1.SetTargetProperties(aProcess.ExitInfo, "Type", "Reason", "Category");
            //
            ParserLine l2 = ParserLine.NewSymFormat("Flags %08x, Handles %08x, Attributes %08x\r\n");

            l2.SetTargetProperties(aProcess, "Flags", "Handles", "Attributes");
            //
            ParserLine l3 = ParserLine.NewSymFormat("DataBssChunk %08x, CodeSeg %08x\r\n");

            l3.SetTargetProperties(aProcess, "DataBssStackChunkAddress", "CodeSegAddress");
            //
            ParserLine l4 = ParserLine.NewSymFormat("DllLock %08x, Process Lock %08x SID %08x\r\n");

            l4.SetTargetProperties(new object[] { aProcess.LockInfo, aProcess.LockInfo, aProcess }, "DllMutexAddress", "ProcessMutexAddress", "SID");
            //
            ParserLine l5 = ParserLine.NewSymFormat("TempCodeSeg %08x CodeSeg %08x Capability %08x %08x\r\n");

            l5.SetTargetProperties(new object[] { aProcess, aProcess, aProcess.Capabilities, aProcess.Capabilities }, "TempCodeSegAddress", "CodeSegAddress", "HighDWord", "LowDWord");
            //
            ParserLine l6 = ParserLine.NewSymFormat("Id=%d");

            l6.SetTargetProperties(aProcess, "Id");

            para.Add(l1, l2, l3, l4, l5, l6);
            return(para);
        }
コード例 #4
0
 internal RegisterCollection(RegisterCollection aCopy, TType aType, DProcess aProcess)
     : this(aCopy.CrashDebugger, aType, aProcess, null)
 {
     foreach (RegisterEntry entry in aCopy)
     {
         Add(entry.OriginalName, entry.Value);
     }
 }
コード例 #5
0
        public void AddChunkToProcess(ParserParagraph aParagraph, ParserFieldName aParameterName, uint aParameterValue)
        {
            System.Diagnostics.Debug.Assert(aParagraph.Tag is DProcess);
            DProcess process = (DProcess)aParagraph.Tag;
            ProcessChunkCollection chunks = process.Chunks;
            //
            ProcessChunk chunk = new ProcessChunk(process.CrashDebugger, aParameterValue, 0);

            chunks.Add(chunk);
        }
コード例 #6
0
        internal RegisterCollection(CrashDebuggerInfo aCrashDebugger, TType aType, DProcess aProcess, RegisterCollection aLinkedWith)
            : base(aCrashDebugger)
        {
            iType    = aType;
            iProcess = aProcess;

            iEntries = new ArmRegisterCollection();
            iEntries.BackingStore = this as IARCBackingStore;

            iLinkedWith = aLinkedWith;
        }
コード例 #7
0
        public void SetChunkAccessCount(ParserParagraph aParagraph, ParserFieldName aParameterName, int aParameterValue)
        {
            System.Diagnostics.Debug.Assert(aParagraph.Tag is DProcess);
            DProcess process = (DProcess)aParagraph.Tag;
            ProcessChunkCollection chunks = process.Chunks;
            //
            int count = chunks.Count;

            if (count > 0)
            {
                ProcessChunk lastEntry = chunks[count - 1];
                lastEntry.AccessCount = aParameterValue;
            }
        }
コード例 #8
0
 public CrashDebuggerInfo(DbgEngine aDebugEngine)
 {
     iDebugEngine     = aDebugEngine;
     iDebugEngineView = aDebugEngine.CreateView("CrashDebugger");
     //
     iTheCurrentProcess = new DProcess(this);
     iTheCurrentThread  = new DThread(this);
     iCodeSegs          = new CodeSegCollection(this);
     iInfoCpu           = new CpuInfo(this);
     iInfoFault         = new FaultInfo(this);
     iInfoScheduler     = new SchedulerInfo(this);
     iInfoDebugMask     = new DebugMaskInfo(this);
     //
     MakeEmptyContainers();
 }
コード例 #9
0
        public void Clear()
        {
            iTheCurrentProcess = new DProcess(this);
            iTheCurrentThread  = new DThread(this);
            iCodeSegs.Clear();
            iInfoCpu.Clear();
            iInfoFault.Clear();
            iInfoScheduler.Clear();
            iInfoDebugMask.Clear();

            iUserContextTableManager = new UserContextTableManager();
            iAsyncOperationManager.Clear();

            MakeEmptyContainers();
        }
コード例 #10
0
        void CodeSegmentLineComplete(ParserElementBase aElement)
        {
            System.Diagnostics.Debug.Assert(iCurrentThread != null);
            ParserLine line = (ParserLine)aElement;
            //
            int    index          = line[0].AsInt;
            int    count          = line[1].AsInt;
            uint   codeSegAddress = line[2].AsUint;
            uint   startAddress   = line[3].AsUint;
            uint   endAddress     = line[4].AsUint;
            string fileName       = line[5].AsString;
            //
            DProcess process = iCurrentThread.OwningProcess;

            if (process != null)
            {
                ProcessCodeSegCollection codeSegs = process.CodeSegments;
                ProcessCodeSeg           codeSeg  = codeSegs[codeSegAddress];
                //
                if (codeSeg == null)
                {
                    // The code seg is not directly part of the process handle list
                    // but it is some how mapped into the process?
                    //
                    // Try looking up the underlying code seg entry details from
                    // the crash debugger data itself. It should be part of the code
                    // seg listing so this should always work.
                    codeSeg = new ProcessCodeSeg(CrashDebugger, codeSegAddress, 0);
                    process.CodeSegments.Add(codeSeg);
                }
                //
                codeSeg.ProcessLocalRunAddress = startAddress;
                codeSeg.Size = (endAddress - startAddress);
            }
            //
            int remaining = count - index;

            if (remaining == 0)
            {
                // Queue up stack data...
                iHelperStack.CreateStackParagraphs(ParserEngine, iCurrentThread);
            }
            else
            {
                // So that we capture the next line
                aElement.SetRepetitions(1);
            }
        }
コード例 #11
0
        public void CreateMonitorProcess(ParserEngine aEngine, string aName, DProcess aProcess, ParserElementBase.ElementCompleteHandler aLastFieldHandler)
        {
            ParserParagraph para0 = base.CreateMonitorObjectParagraph(aName, aProcess);

            aEngine.Add(para0);
            ParserParagraph para1 = CreateMonitorProcessCommon(aName, aProcess);

            aEngine.Add(para1);
            ParserParagraph para2 = CreateMonitorProcessCodeSegs(aName + "_CodeSegs", aProcess);

            aEngine.Add(para2);
            ParserParagraph para3 = CreateMonitorProcessMemModelMultiple(aName + "_MemModel_Multiple", aProcess, aLastFieldHandler);

            aEngine.Add(para3);

            // TODO: add support for older memory models?
        }
コード例 #12
0
        private void PrimeStackEngine()
        {
            // Create new engine (resets old data)
            iStackEngine = new StackEngine(iInfo.CrashDebugger.DebugEngine);

            // Not yet ready
            iIsReady = false;

            // Get the data source
            DThread thread     = iInfo.Info.Thread;
            string  threadName = thread.Name.ToLower();
            //
            DataBuffer dataSource = iInfo.Data;

            if (dataSource.Count > 0)
            {
                // Prime stack engine with data & current stack pointer
                iStackEngine.Primer.Prime(dataSource);
                iStackEngine.AddressInfo.Pointer = iInfo.Info.StackPointer;

                // Set us up so we know when the process finishes
                iStackEngine.EventHandler += new StackEngine.StackEngineEventHandler(StackEngine_EventHandler);

                // Set up registers. First update them taking into account the
                // curent CPU regs.
                RegisterCollection.TType requiredType = RegisterCollection.TType.ETypeUser;
                if (iInfo.Info.Type == ThreadStackInfo.TType.ETypeSupervisor)
                {
                    requiredType = RegisterCollection.TType.ETypeSupervisor;
                }

                RegisterCollection registers = thread.NThread.GetRegisters(requiredType);
                iStackEngine.Registers = registers;

                // Get code segs
                DProcess process = thread.OwningProcess;
                if (process != null)
                {
                    iStackEngine.CodeSegments = process.GetCodeSegDefinitions();
                }
            }
            else
            {
            }
        }
コード例 #13
0
        private ParserParagraph CreateMonitorProcessCodeSegs(string aName, DProcess aProcess)
        {
            ParserParagraph para = new ParserParagraph(aName);

            para.Tag = aProcess;

            // Loop body - construct this first as we use it for the header line
            ParserLine l2 = ParserLine.NewSymFormat("%2d: seg=%08x lib=%08x\r\n");

            l2[0].SetTargetObject();
            l2.SetTargetMethod(this, "AddCodeSegToProcess");

            // Loop header
            ParserLine l1 = ParserLine.NewSymFormat("CodeSegs: Count=%d\r\n");

            l1.SetTargetMethod(l2, "SetRepetitions");

            para.Add(l1, l2);
            return(para);
        }
コード例 #14
0
        public void AddCodeSegToProcess(ParserParagraph aParagraph, ParserFieldName aParameterName, uint aParameterValue)
        {
            System.Diagnostics.Debug.Assert(aParagraph.Tag is DProcess);
            DProcess process = (DProcess)aParagraph.Tag;
            ProcessCodeSegCollection codeSegs = process.CodeSegments;

            //
            if (aParameterName == "lib")
            {
                int count = codeSegs.Count;
                if (count > 0)
                {
                    ProcessCodeSeg lastEntry = codeSegs[count - 1];
                    lastEntry.LibraryAddress = aParameterValue;
                }
            }
            else if (aParameterName == "seg")
            {
                ProcessCodeSeg entry = new ProcessCodeSeg(process.CrashDebugger);
                entry.CodeSegAddress = aParameterValue;
                codeSegs.Add(entry);
            }
        }
コード例 #15
0
 internal RegisterCollection(CrashDebuggerInfo aCrashDebugger, TType aType, DProcess aProcess)
     : this(aCrashDebugger, aType, aProcess, null)
 {
 }
コード例 #16
0
 public void CreateMonitorProcess(ParserEngine aEngine, string aName, DProcess aProcess)
 {
     CreateMonitorProcess(aEngine, aName, aProcess, null);
 }
コード例 #17
0
 internal bool IsCurrentProcess(DProcess aProcess)
 {
     return(aProcess.KernelAddress == TheCurrentProcess.KernelAddress && TheCurrentProcess.KernelAddress != 0);
 }