Exemple #1
0
 // DbgManager thread
 void UpdateRuntime_DbgThread(DbgRuntimeImpl runtime)
 {
     owner.Dispatcher.VerifyAccess();
     lock (lockObj) {
         var newCurrent = GetRuntime_NoLock(currentRuntime.Current, runtime);
         var newBreak   = GetRuntime_NoLock(currentRuntime.Break, runtime);
         currentRuntime = new CurrentObject <DbgRuntimeImpl>(newCurrent, newBreak);
     }
 }
Exemple #2
0
 protected override void CloseCore(DbgDispatcher dispatcher)
 {
     DbgThread[]    removedThreads;
     DbgModule[]    removedModules;
     DbgAppDomain[] removedAppDomains;
     DbgObject[]    objsToClose;
     lock (lockObj) {
         removedThreads    = threads.ToArray();
         removedModules    = modules.ToArray();
         removedAppDomains = appDomains.ToArray();
         objsToClose       = closeOnContinueList.ToArray();
         threads.Clear();
         modules.Clear();
         appDomains.Clear();
         closeOnContinueList.Clear();
     }
     currentThread = default;
     if (removedThreads.Length != 0)
     {
         ThreadsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgThread>(removedThreads, added: false));
     }
     if (removedModules.Length != 0)
     {
         ModulesChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgModule>(removedModules, added: false));
     }
     if (removedAppDomains.Length != 0)
     {
         AppDomainsChanged?.Invoke(this, new DbgCollectionChangedEventArgs <DbgAppDomain>(removedAppDomains, added: false));
     }
     foreach (var obj in objsToClose)
     {
         obj.Close(dispatcher);
     }
     foreach (var thread in removedThreads)
     {
         thread.Close(dispatcher);
     }
     foreach (var module in removedModules)
     {
         module.Close(dispatcher);
     }
     foreach (var appDomain in removedAppDomains)
     {
         appDomain.Close(dispatcher);
     }
     InternalRuntime.Close(dispatcher);
 }
Exemple #3
0
        internal DbgThread?SetBreakThread(DbgThreadImpl?thread, bool tryOldCurrentThread = false)
        {
            Dispatcher.VerifyAccess();
            DbgThreadImpl?newCurrent, newBreak;

            lock (lockObj) {
                newBreak = GetThread_NoLock(thread);
                if (tryOldCurrentThread && currentThread.Current?.IsClosed == false)
                {
                    newCurrent = currentThread.Current;
                }
                else
                {
                    newCurrent = newBreak;
                }
            }
            Debug2.Assert((newBreak is not null) == (newCurrent is not null));
            currentThread = new CurrentObject <DbgThreadImpl>(newCurrent, newBreak);
            return(newCurrent);
        }
        void RecheckAndUpdateCurrentProcess_DbgThread()
        {
            Dispatcher.VerifyAccess();
            DbgCurrentObjectChangedEventArgs <DbgProcess> processEventArgs;
            DbgCurrentObjectChangedEventArgs <DbgRuntime> runtimeEventArgs;
            DbgCurrentObjectChangedEventArgs <DbgThread>  threadEventArgs;

            lock (lockObj) {
                var pausedProcess     = processes.FirstOrDefault(a => a.State == DbgProcessState.Paused);
                var currentProcess    = GetProcess_NoLock(dbgCurrentProcess.currentProcess.Current, pausedProcess) ?? pausedProcess;
                var breakProcess      = GetProcess_NoLock(dbgCurrentProcess.currentProcess.Break, pausedProcess) ?? pausedProcess;
                var newCurrentProcess = new CurrentObject <DbgProcessImpl>(currentProcess, breakProcess);
                var newCurrentRuntime = currentProcess?.CurrentRuntime ?? default;
                var newCurrentThread  = newCurrentRuntime.Current?.CurrentThread ?? default;
                processEventArgs = new DbgCurrentObjectChangedEventArgs <DbgProcess>(currentChanged: dbgCurrentProcess.currentProcess.Current != newCurrentProcess.Current, breakChanged: dbgCurrentProcess.currentProcess.Break != newCurrentProcess.Break);
                runtimeEventArgs = new DbgCurrentObjectChangedEventArgs <DbgRuntime>(currentChanged: dbgCurrentRuntime.currentRuntime.Current != newCurrentRuntime.Current, breakChanged: dbgCurrentRuntime.currentRuntime.Break != newCurrentRuntime.Break);
                threadEventArgs  = new DbgCurrentObjectChangedEventArgs <DbgThread>(currentChanged: dbgCurrentThread.currentThread.Current != newCurrentThread.Current, breakChanged: dbgCurrentThread.currentThread.Break != newCurrentThread.Break);
                dbgCurrentProcess.currentProcess = newCurrentProcess;
                dbgCurrentRuntime.currentRuntime = newCurrentRuntime;
                dbgCurrentThread.currentThread   = newCurrentThread;
            }
            RaiseCurrentObjectEvents_DbgThread(processEventArgs, runtimeEventArgs, threadEventArgs);
        }
Exemple #5
0
 // DbgManager thread
 internal void SetCurrentRuntime_DbgThread(DbgRuntimeImpl runtime)
 {
     owner.Dispatcher.VerifyAccess();
     currentRuntime = new CurrentObject <DbgRuntimeImpl>(runtime, currentRuntime.Break);
 }
Exemple #6
0
 internal void ClearBreakThread()
 {
     Dispatcher.VerifyAccess();
     currentThread = default;
 }
Exemple #7
0
 internal void SetCurrentThread_DbgThread(DbgThreadImpl thread)
 {
     owner.Dispatcher.VerifyAccess();
     currentThread = new CurrentObject <DbgThreadImpl>(thread, currentThread.Break);
 }
Exemple #8
0
 public bool Equals(CurrentObject <T> other) => Current == other.Current && Break == other.Break;