Пример #1
0
        void Reset_DbgThread(DbgCodeBreakpoint[] breakpoints)
        {
            dbgDispatcherProvider.VerifyAccess();
            List <DbgCodeBreakpointAndHitCount>?updated = null;
            bool raisePendingEvent;

            lock (lockObj) {
                raisePendingEvent = pendingHitCountChanged.Count != 0;
                var defaultHitCount = dbgManager?.IsDebugging == true ? 0 : (int?)null;
                foreach (var bp in breakpoints)
                {
                    if (bpToHitCount.Remove(bp))
                    {
                        if (updated is null)
                        {
                            updated = new List <DbgCodeBreakpointAndHitCount>();
                        }
                        updated.Add(new DbgCodeBreakpointAndHitCount(bp, defaultHitCount));
                    }
                }
            }
            if (raisePendingEvent)
            {
                FlushPendingHitCountChanged_DbgThread();
            }
            if (!(updated is null))
            {
                HitCountChanged?.Invoke(this, new DbgHitCountChangedEventArgs(new ReadOnlyCollection <DbgCodeBreakpointAndHitCount>(updated)));
            }
        }
Пример #2
0
 void FlushPendingHitCountChanged_DbgThread()
 {
     dbgDispatcherProvider.VerifyAccess();
     DbgCodeBreakpointAndHitCount[] breakpoints;
     lock (lockObj) {
         StopPendingHitCountChangedTimer_NoLock();
         breakpoints = pendingHitCountChanged.Where(a => !a.IsClosed).Select(a => new DbgCodeBreakpointAndHitCount(a, GetHitCount_NoLock_DbgThread(a))).ToArray();
         pendingHitCountChanged.Clear();
     }
     if (breakpoints.Length > 0)
     {
         HitCountChanged?.Invoke(this, new DbgHitCountChangedEventArgs(new ReadOnlyCollection <DbgCodeBreakpointAndHitCount>(breakpoints)));
     }
 }
Пример #3
0
        void DbgManager_IsDebuggingChanged(object sender, EventArgs e)
        {
            StopAndClearPendingHitCountChangedTimer();
            var dbgManager = (DbgManager)sender;

            DbgCodeBreakpointAndHitCount[] infos;
            if (dbgManager.IsDebugging)
            {
                dbgCodeBreakpointsService.Value.BreakpointsChanged += DbgCodeBreakpointsService_BreakpointsChanged;
                infos = dbgCodeBreakpointsService.Value.Breakpoints.Select(a => new DbgCodeBreakpointAndHitCount(a, 0)).ToArray();
            }
            else
            {
                dbgCodeBreakpointsService.Value.BreakpointsChanged -= DbgCodeBreakpointsService_BreakpointsChanged;
                infos = dbgCodeBreakpointsService.Value.Breakpoints.Select(a => new DbgCodeBreakpointAndHitCount(a, null)).ToArray();
            }
            lock (lockObj)
                bpToHitCount = new Dictionary <DbgCodeBreakpoint, int>();
            if (infos.Length > 0)
            {
                HitCountChanged?.Invoke(this, new DbgHitCountChangedEventArgs(new ReadOnlyCollection <DbgCodeBreakpointAndHitCount>(infos)));
            }
        }