public void RegisterAndRetrieveWatchpoint()
        {
            IWatchpoint watchpoint;
            bool        result = breakpointManager.GetWatchpointById(ID, out watchpoint);

            Assert.IsFalse(result);
            breakpointManager.RegisterWatchpoint(mockWatchpoint);
            result = breakpointManager.GetWatchpointById(ID, out watchpoint);
            Assert.IsTrue(result);
            Assert.AreEqual(ID, watchpoint.GetId());

            int watchpointCount = breakpointManager.GetWatchpointRefCount(mockWatchpoint);

            Assert.AreEqual(1, watchpointCount);
        }
Пример #2
0
        // When changing existing watchpoint, VS creates a new watchpoint and deletes the
        // previous one. But LLDB doesn't create a new watchpoint if it points to the same
        // address. This may result in several DebugWatchpoint objects holding the same
        // watchpoint, and if one of the instances deletes it all the related DebugWatchpoint
        // become invalid. So we need to keep tracking of who actually using the watchpoint
        // by calling RegisterWatchpoint / UnregisterWatchpoint methods.
        public int Delete()
        {
            if (_deleted)
            {
                return(VSConstants.S_OK);
            }

            _deleted = true;
            _breakpointManager.UnregisterWatchpoint(Self);

            if (_lldbWatchpoint != null && _breakpointManager.GetWatchpointRefCount(Self) == 0)
            {
                _target.DeleteWatchpoint(_lldbWatchpoint.GetId());
            }
            return(VSConstants.S_OK);
        }