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);
        }
Exemplo n.º 2
0
        public int Bind()
        {
            if (_requestInfo.bpLocation.bpLocationType !=
                (uint)enum_BP_LOCATION_TYPE.BPLT_DATA_STRING)
            {
                SetError(enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _watchpointNotSupported);
                return(VSConstants.S_FALSE);
            }
            string dataExpression =
                _marshal.GetStringFromIntPtr(_requestInfo.bpLocation.unionmember3);
            uint size = (uint)_requestInfo.bpLocation.unionmember4;

            _lldbWatchpoint =
                _target.WatchAddress(Convert.ToInt64(dataExpression, 16), size, false /* read */,
                                     true /* write */, out SbError error);
            if (error.Fail())
            {
                SetError(enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, error.GetCString());
                return(VSConstants.S_FALSE);
            }

            _lldbWatchpoint.SetEnabled(_enabled);
            if ((_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0)
            {
                SetCondition(_requestInfo.bpCondition);
            }
            if ((_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0)
            {
                SetPassCount(_requestInfo.bpPassCount);
            }
            _resolution = _resolutionFactory.Create(dataExpression, _program);
            _breakpointManager.RegisterWatchpoint(Self);
            return(VSConstants.S_OK);
        }