public void GetThreadInfo(CIThread aThread) { if (IsValid) { aThread.Name = Thread; } }
public CIThread CreateThread() { CIThread ret = new CIThread(this); base.AddChild(ret); return(ret); }
private CIThread CreateThread(CIProcess aProcess) { // Make a new thread CIThread thread = aProcess.CreateThread(); // Extract items ExtractThread(thread); ExtractThreadExitReason(thread); ExtractThreadRegisters(thread); ExtractThreadStack(thread); iContainer.AddChild(thread); return(thread); }
private void ExtractThreadExitReason(CIThread aThread) { aThread.ExitInfo.Type = CrashItemLib.Crash.ExitInfo.CIExitInfo.TExitType.EExitTypeException; // Extract process info from thread full name. DExcExtractorList threadInfo = iData[DExcExtractorListType.EListThread]; foreach (string line in threadInfo) { Match m = EM.ThreadPanicDetails.Match(line); if (m.Success) { aThread.ExitInfo.Type = CrashItemLib.Crash.ExitInfo.CIExitInfo.TExitType.EExitTypePanic; aThread.ExitInfo.Category = m.Groups[1].Value; aThread.ExitInfo.Reason = int.Parse(m.Groups[2].Value); } } }
private void ExtractThreadStack(CIThread aThread) { DExcExtractorListStackData stackDataList = (DExcExtractorListStackData)iData[DExcExtractorListType.EListStackData]; DataBuffer stackData = stackDataList.StackData; // Get stack range details DExcExtractorListThreadInfo threadInfo = (DExcExtractorListThreadInfo)iData[DExcExtractorListType.EListThread]; AddressRange stackRange = threadInfo.StackRange; // If we didn't get the stack range, we cannot create a stack entry if (!stackRange.IsValid || stackRange.Max == 0 || stackRange.Min == 0) { CIMessageWarning warning = new CIMessageWarning(aThread.Container, "Stack Address Range Unavailable"); warning.AddLine("The stack address range details are invalid."); aThread.AddChild(warning); } else if (stackData.Count == 0) { // No stack data CIMessageWarning warning = new CIMessageWarning(aThread.Container, "Stack Data Unavailable"); warning.AddLine("The crash details contain no stack data."); aThread.AddChild(warning); } else { // Set base address of data buffer if not already set if (stackData.AddressOffset == 0) { stackData.AddressOffset = stackRange.Min; } // In theory, D_EXC only ever captures user-side crashes (panics/exceptions) therefore // we should always be able to assume that the stack data goes with a user-side thread. CIRegisterList userRegs = aThread.Registers[TArmRegisterBank.ETypeUser]; if (userRegs != null) { CIStack stack = aThread.CreateStack(userRegs, stackData, stackData.AddressOffset, stackRange); // Register it as a specific crash instance iContainer.AddChild(stack); } } }
public CISummarisableEntity this[CIThread aEntry] { get { CISummarisableEntity ret = null; // foreach (CISummarisableEntity entry in this) { if (entry.IsAvailable(CISummarisableEntity.TElement.EElementThread)) { if (entry.Thread.Id == aEntry.Id) { ret = entry; break; } } } // return(ret); } }
private void ExtractThread(CIThread aThread) { // Extract process info from thread full name. DExcExtractorList threadInfo = iData[DExcExtractorListType.EListThread]; foreach (string line in threadInfo) { Match m = EM.ThreadName.Match(line); if (m.Success) { CIFullNameUtils parser = new CIFullNameUtils(m.Groups[1].Value); parser.GetThreadInfo(aThread); } else { m = EM.ThreadId.Match(line); if (m.Success) { aThread.Id = int.Parse(m.Groups[1].Value); } } } }
internal static CIStack NewThreadStack(CIThread aThread, CIRegisterList aRegisters, byte[] aData, uint aAddressOfFirstByte, AddressRange aRange) { CIStack ret = new CIStack(aRegisters, aData, aAddressOfFirstByte, aRange); return(ret); }
private void ExtractThreadRegisters(CIThread aThread) { CIThreadRegisterListCollection threadRegs = aThread.Registers; CIRegisterList regListUser = threadRegs[TArmRegisterBank.ETypeUser]; CIRegisterList regListEXC = threadRegs[TArmRegisterBank.ETypeException]; CIRegisterList regListCOP = threadRegs[TArmRegisterBank.ETypeCoProcessor]; CIRegisterList regListSVC = threadRegs[TArmRegisterBank.ETypeSupervisor]; #region User registers foreach (string line in iData[DExcExtractorListType.EListRegistersUser]) { Match m = EM.RegistersUserSet.Match(line); if (m.Success) { GroupCollection groups = m.Groups; int firstReg = int.Parse(groups[1].Value); for (int i = firstReg; i < firstReg + 4; i++) { Group gp = groups[2 + (i - firstReg)]; uint value = uint.Parse(gp.Value, System.Globalization.NumberStyles.HexNumber); TArmRegisterType regType = (TArmRegisterType)i; regListUser[regType].Value = value; } } else { m = EM.RegistersUserCPSR.Match(line); if (m.Success) { // Get CPSR value and set it uint cpsrValue = uint.Parse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber); threadRegs.CPSR = cpsrValue; } } } #endregion #region Exception registers foreach (string line in iData[DExcExtractorListType.EListRegistersException]) { Match m = EM.RegistersExceptionSet1.Match(line); if (m.Success) { GroupCollection groups = m.Groups; // regListEXC[TArmRegisterType.EArmReg_EXCCODE].Value = uint.Parse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber); regListEXC[TArmRegisterType.EArmReg_EXCPC].Value = uint.Parse(m.Groups[2].Value, System.Globalization.NumberStyles.HexNumber); // regListCOP[TArmRegisterType.EArmReg_FAR].Value = uint.Parse(m.Groups[3].Value, System.Globalization.NumberStyles.HexNumber); regListCOP[TArmRegisterType.EArmReg_FSR].Value = uint.Parse(m.Groups[4].Value, System.Globalization.NumberStyles.HexNumber); if (regListEXC.Contains(TArmRegisterType.EArmReg_EXCCODE)) { CIRegister reg = regListEXC[TArmRegisterType.EArmReg_EXCCODE]; System.Diagnostics.Debug.Assert(reg is CIRegisterExcCode); CIRegisterExcCode excReg = (CIRegisterExcCode)reg; // excReg.ExpandToFullExceptionRange(); } // It also means it was an exception aThread.ExitInfo.Type = CrashItemLib.Crash.ExitInfo.CIExitInfo.TExitType.EExitTypeException; } else { m = EM.RegistersExceptionSet2.Match(line); if (m.Success) { GroupCollection groups = m.Groups; // regListSVC[TArmRegisterType.EArmReg_SP].Value = uint.Parse(m.Groups[1].Value, System.Globalization.NumberStyles.HexNumber); regListSVC[TArmRegisterType.EArmReg_LR].Value = uint.Parse(m.Groups[2].Value, System.Globalization.NumberStyles.HexNumber); regListSVC[TArmRegisterType.EArmReg_SPSR].Value = uint.Parse(m.Groups[3].Value, System.Globalization.NumberStyles.HexNumber); } } } #endregion }
/// <summary> /// Fall back constructor which is called when the thread in question has no associated /// stack. This means that stack data is unavailable and therefore stack reconstruction is /// obviously impossible. However, the thread (and by implication the process) may well still /// contain useful information. /// </summary> /// <param name="aThread"></param> internal CISummarisableEntity(CIThread aThread) : base(aThread.Container) { AddChild(aThread); }
public CXmlThread(CIThread aThread) : base(SegConstants.Threads_Thread) { iThread = aThread; }