internal (DbgRuntimeImpl?runtime, bool hasMoreRuntimes) Remove_DbgThread(DbgEngine engine) { DbgRuntimeImpl?runtime = null; bool hasMoreRuntimes; lock (lockObj) { for (int i = 0; i < engineInfos.Count; i++) { var info = engineInfos[i]; if (info.Engine == engine) { UpdateRuntime_DbgThread(null); runtime = info.Runtime; engineInfos.RemoveAt(i); break; } } hasMoreRuntimes = engineInfos.Count > 0; } return(runtime, hasMoreRuntimes); }
public CIStackBuilder(CIStack aStack, DbgEngine aDebugEngine) { iStack = aStack; iStackEngine = new StackEngine(aDebugEngine); iStackEngine.AddressInfo.Pointer = aStack.PointerValue; iStackEngine.AddressInfo.Range = aStack.Range; iStackEngine.Registers = aStack.Registers; iStackEngine.DataSource = aStack.RawSourceData; // Get the code segments for the process bool isThreadStack = aStack.IsThreadAvailable; if (isThreadStack) { CIProcess process = OwningProcess; System.Diagnostics.Debug.Assert(process != null); // Seed stack engine with relevant code segments iStackEngine.CodeSegments = process.CodeSegments; } }
internal void Add_DbgThread(DbgEngine engine, DbgRuntimeImpl runtime, DbgProcessState newState) { bool raiseStateChanged, raiseDebuggingChanged, raiseIsRunningChanged; DbgThread[] addedThreads; lock (lockObj) { engineInfos.Add(new EngineInfo(engine, runtime)); var newDebugging = CalculateDebugging_NoLock(); raiseStateChanged = state != newState; raiseDebuggingChanged = !StringArrayEquals(debugging, newDebugging); state = newState; if (raiseDebuggingChanged) { debugging = newDebugging; } var newIsRunning = CalculateIsRunning_NoLock(); raiseIsRunningChanged = cachedIsRunning != newIsRunning; cachedIsRunning = newIsRunning; addedThreads = runtime.Threads; runtime.ThreadsChanged += DbgRuntime_ThreadsChanged; } RuntimesChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgRuntime>(runtime, added: true)); if (addedThreads.Length != 0) { ThreadsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgThread>(addedThreads, added: true)); } if (raiseStateChanged) { OnPropertyChanged(nameof(State)); } if (raiseIsRunningChanged) { IsRunningChanged?.Invoke(this, EventArgs.Empty); } if (raiseDebuggingChanged) { OnPropertyChanged(nameof(Debugging)); } }
public DbgRuntimeImpl(DbgManagerImpl owner, DbgProcess process, DbgEngine engine) { lockObj = new object(); this.owner = owner ?? throw new ArgumentNullException(nameof(owner)); Process = process ?? throw new ArgumentNullException(nameof(process)); Engine = engine ?? throw new ArgumentNullException(nameof(engine)); var info = engine.RuntimeInfo; Id = info.Id; Guid = info.Guid; RuntimeKindGuid = info.RuntimeKindGuid; Name = info.Name; Tags = info.Tags; appDomains = new List <DbgAppDomain>(); modules = new List <DbgModule>(); threads = new List <DbgThreadImpl>(); closeOnContinueList = new List <DbgObject>(); closeOnExitList = new List <DbgObject>(); disposeOnExitList = new List <IDisposable>(); breakInfos = emptyBreakInfos; InternalRuntime = engine.CreateInternalRuntime(this) ?? throw new InvalidOperationException(); }
public RHeapExtractor(DataSource aDataSource, Options aOptions, DbgEngine aDebugEngine, RelationshipInspector aRelationshipInspector, HeapStatistics aStatistics, HeapCellArray aData) { iData = aData; iOptions = aOptions; iStatistics = aStatistics; iDataSource = aDataSource; iDebugEngine = aDebugEngine; iState = new ExtractionState(aDataSource); iRelationshipInspector = aRelationshipInspector; // HeapCell.AllocatedCellHeaderSize = AllocatedCellHeaderSize; // Must prime these iState.NextFreeCellAddress = aDataSource.MetaData.Heap.InfoFree.FreeCellAddress; iState.NextFreeCellLength = aDataSource.MetaData.Heap.InfoFree.FreeCellLength; // if (iState.NextFreeCellAddress == 0) { throw new ArgumentException("Next free cell information invalid"); } //iState.DebugEnabled = true; }
public static DbgEngineCode New(DbgEngine aEngine) { PluginManager <DbgEngineCode> loader = new PluginManager <DbgEngineCode>(1); loader.Load(new object[] { aEngine }); // DbgEngineCode ret = null; foreach (DbgEngineCode engine in loader) { if (engine is DbgEngineCodeStub && loader.Count > 1) { continue; } else { ret = engine; break; } } // return(ret); }
private void CacheFileNames(DbgEngine aDebugEngine) { if (iFileNames == null) { iFileNames = new List <string>(); CISourceElement source = Source; foreach (FileInfo file in source.AllFiles) { iFileNames.Add(file.FullName); } // Meta-data files SymbianUtils.FileSystem.FSEntity[] entities = aDebugEngine.FileSystemEntities; foreach (SymbianUtils.FileSystem.FSEntity e in entities) { if (e.IsFile) { FileInfo file = ((SymbianUtils.FileSystem.FSEntityFile)e).File; iFileNames.Add(file.FullName); } } } }
public void OnBreak_DbgThread(DbgEngine engine) { bool done, canNotify = false; lock (owner.lockObj) { foreach (var info in infos) { if (info.EngineInfo.Engine == engine) { info.Done = true; break; } } done = IsDone_NoLock(); if (done) { DoneStep1_NoLock(out canNotify); } } if (done && canNotify) { DoneStep2_DbgThread(success: true); } }
protected DbgEngineSymbol(DbgEngine aEngine) : base(aEngine) { }
bool IsOurEngine(DbgEngine engine) => owner.IsOurEngine(engine);
protected DbgEngineMetaDataConfig(DbgEngine aEngine) : base(aEngine) { }
public CodePlugin(DbgEngine aEngine) : base(aEngine) { iSourceManager = new CodeSourceManager(this); iProvisioningManager = new CodeSourceProviderManager(this, aEngine.IdAllocator); }
private void TryToPrimeDbgEngine() { DbgEngine debugEngine = iDebugEngine; // Exception primerException = null; CACmdLineFSEntityList <CACmdLineFSEntity> metaDataFiles = iInputs.MetaDataFiles; // try { debugEngine.Clear(); foreach (CACmdLineFileSource file in iInputs.SourceFiles) { // Tell all used RomIds to debugEngine. if (file.RomId != null) { debugEngine.AddActiveRomId(file.RomId.Value); } // Tell all RomIds which needs symbols to debugEngine so that // we load only symbols for those. if (file.ContentType == TMobileCrashContentType.EContentTypePanic || file.ContentType == TMobileCrashContentType.EContentTypeException) { debugEngine.AddSymbolRomId(file.RomId.Value); } } foreach (CACmdLineFSEntity entry in metaDataFiles) { Trace("[CA Cmd] Seeding debug meta engine with entry: " + entry.Name); DbgEntity entity = debugEngine.Add(entry.Name); if (entity != null) { Trace("[CA Cmd] Entry type detected as: [" + entity.CategoryName + "]"); entity.Tag = entry; } else { Trace("[CA Cmd] Entry not handled: " + entry.Name); entry.AddError("Meta-Data File Not Supported", "The file \'" + entry.Name + "\' is of unknown origin."); } } // Listen to prime events try { Trace("[CA Cmd] Starting prime operation... "); debugEngine.EntityPrimingStarted += new DbgEngine.EventHandler(DbgEngine_EntityPrimingStarted); debugEngine.EntityPrimingProgress += new DbgEngine.EventHandler(DbgEngine_EntityPrimingProgress); debugEngine.EntityPrimingComplete += new DbgEngine.EventHandler(DbgEngine_EntityPrimingComplete); debugEngine.Prime(TSynchronicity.ESynchronous); Trace("[CA Cmd] Debug meta data priming completed successfully."); } finally { debugEngine.EntityPrimingStarted -= new DbgEngine.EventHandler(DbgEngine_EntityPrimingStarted); debugEngine.EntityPrimingProgress -= new DbgEngine.EventHandler(DbgEngine_EntityPrimingProgress); debugEngine.EntityPrimingComplete -= new DbgEngine.EventHandler(DbgEngine_EntityPrimingComplete); } } catch (Exception exception) { Trace("[CA Cmd] Debug meta data priming exception: " + exception.Message + ", " + exception.StackTrace); primerException = exception; } // Go through each debug entity and check it for errors. Add diagnostics // and error messages where appropriate. foreach (DbgEntity entity in debugEngine) { string name = entity.FullName; // CACmdLineFSEntity file = metaDataFiles[name]; file.Clear(); // if (entity.PrimerResult.PrimedOkay) { if (!entity.Exists) { file.AddError("Meta-Data File Missing", string.Format("The file \'{0}\' could not be found.", file.Name)); } else if (entity.IsUnsupported) { file.AddError("Meta-Data File Not Supported", string.Format("The file \'{0}\' is of unknown origin.", file.Name)); } } else { // Add error file.AddError("Meta-Data Read Error", entity.PrimerResult.PrimeErrorMessage); // And diagnostic information Exception exception = entity.PrimerResult.PrimeException != null ? entity.PrimerResult.PrimeException : primerException; if (exception != null) { file.AddDiagnostic("Meta-Data Exception Message", entity.PrimerResult.PrimeException.Message); file.AddDiagnostic("Meta-Data Exception Stack", entity.PrimerResult.PrimeException.StackTrace); } else { file.AddDiagnostic("Meta-Data Unknown Failure", "No exception occurred at the primer or entity level?"); } } } }
protected DbgEngineCode(DbgEngine aEngine) : base(aEngine) { }
private void DebugEngine_EntityPrimingStarted(DbgEngine aEngine, DbgEntity aEntity, object aContext) { iTimePrimingStarted = DateTime.Now; Trace("[Priming] Started : {0}, file: {1}", iTimePrimingStarted.ToString(), aEntity.FullName); }
private void DbgEngine_EntityPrimingComplete(DbgEngine aEngine, DbgEntity aEntity, object aContext) { Trace("[HA Cmd] Primed debug meta-data: " + aEntity.FullName); }
public DbgEngineTraceStub(DbgEngine aEngine) : base(aEngine) { }
protected DbgEngineTrace(DbgEngine aEngine) : base(aEngine) { }
public DbgEngineMetaDataConfigStub(DbgEngine aEngine) : base(aEngine) { }
public CACmdLineEngine(DbgEngine aDebugEngine) { iDebugEngine = aDebugEngine; iInputs = new CACmdLineInputParameters(aDebugEngine); iCrashItemEngine = new CIEngine(aDebugEngine, this as ICIEngineUI); }
internal DbgEntityListCategorised(DbgEngine aEngine, DbgEntityDescriptor aDescriptor) : base(aEngine) { iDescriptor = aDescriptor; }
public DbgDirectoryScanner(DbgEngine aEngine) { iEngine = aEngine; }
private void DbgEngine_EntityPrimingStarted(DbgEngine aEngine, DbgEntity aEntity, object aContext) { UITrace("[CA Cmd] Priming debug meta-data: " + aEntity.FullName); iProgressReporter.StepBegin("Priming debug meta-data: " + aEntity.FullName, aEntity.FullName, 100); }
private void RunWorker(object aNotUsed) { iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - START - index groupings: {0}", iIndex.Count); EventHandler(TEvent.EEventStarting); DbgEngine debugEngine = iEngine.DebugEngine; bool needToPrimeDebugEngine = debugEngine.MetaDataConfig.IsConfigurationDataAvailable; iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - needToPrimeDebugEngine: {0}", needToPrimeDebugEngine); // Process the index "buckets" until all are exhausted. for (CIContainerCollection collection = iIndex.DequeueNextContainer(); collection != null; collection = iIndex.DequeueNextContainer()) { try { if (collection.Count > 0) { // Get the rom serial number - all containers in the collection share a common serial uint serialNumber = CIContainerIndex.GetRomChecksum(collection[0]); iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - {0} containers for rom checksum: 0x{1:x8}", collection.Count, serialNumber); // Prepare debug engine meta-data as needed. if (needToPrimeDebugEngine) { DbgEntityConfigIdentifier identifier = new DbgEntityConfigIdentifier(serialNumber); iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - synchronously switching debug meta-data config..."); debugEngine.ConfigManager.SwitchConfigurationSynchronously(identifier); iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - switch complete."); } // Process the list of crash item containers in separate threads until all are handled. // This is quite a heavyweight operation since it also potentially primes the debug engine with // the needed symbols and then finalizes every associated crash container. // However, we run this in a separate thread so it will not block the UI. iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - running finalizer for {0} items with rom checksum: 0x{1:x8}", collection.Count, serialNumber); // We wait until the finalizer is finished, but we're running in a worker thread so this is OK. CIContainerFinalizer finalizer = new CIContainerFinalizer(collection, iEngine); finalizer.Start(SymbianUtils.TSynchronicity.ESynchronous); iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - finalization complete for {0} items with rom checksum: 0x{1:x8}", collection.Count, serialNumber); } } catch (Exception e) { iEngine.Trace("Error: RunWorker() hit an unexpected exception!"); foreach (CIContainer container in collection) { CIMessageError error = new CIMessageError(container, "RunWorker failed"); error.AddLine("Unexpected exception encountered during container processing - analysis has failed!"); container.Messages.Add(error); } } } iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - Notifying about completion..."); EventHandler(TEvent.EEventCompleted); iEngine.Trace("[CIContainerIndexProcessor] RunWorker() - END"); }
internal DbgEntityManager(DbgEngine aEngine) { iEngine = aEngine; }
public DbgEngineCodeStub(DbgEngine aEngine) : base(aEngine) { }
public DbgEngineSymbolStub(DbgEngine aEngine) : base(aEngine) { }
private void DbgEngine_EntityPrimingComplete(DbgEngine aEngine, DbgEntity aEntity, object aContext) { iProgressReporter.StepEnd(string.Empty, aEntity.FullName); UITrace("[CA Cmd] Primed debug meta-data: " + aEntity.FullName); }
internal DbgEntityList(DbgEngine aEngine) { iEngine = aEngine; }
protected DbgEngineKeyBindings(DbgEngine aEngine) : base(aEngine) { }