public void SetConditionWhenTrue()
        {
            BP_CONDITION condition;

            condition.styleCondition = enum_BP_COND_STYLE.BP_COND_WHEN_TRUE;
            condition.bstrCondition  = "true";
            condition.bstrContext    = null;
            condition.pThread        = null;
            condition.nRadix         = 10;
            Assert.AreEqual(VSConstants.S_OK, boundBreakpoint.SetCondition(condition));
            mockBreakpointLocation.Received(1).SetCondition("true");
        }
 public void SetCondition()
 {
     Assert.AreEqual(AD7Constants.E_BP_DELETED,
                     boundBreakpoint.SetCondition(new BP_CONDITION()));
 }
Esempio n. 3
0
        public void UpdateLocations()
        {
            var  remoteLocations           = new Dictionary <int, SbBreakpointLocation>();
            uint lldbBreakpointLocationNum = _lldbBreakpoint.GetNumLocations();

            for (uint i = 0; i < lldbBreakpointLocationNum; i++)
            {
                SbBreakpointLocation breakpointLocation = _lldbBreakpoint.GetLocationAtIndex(i);
                if (breakpointLocation == null)
                {
                    Trace.WriteLine("Failed to get breakpoint location.");
                    continue;
                }

                remoteLocations.Add(breakpointLocation.GetId(), breakpointLocation);
            }

            foreach (int boundBreakpointId in _boundBreakpoints.Keys.ToList())
            {
                if (!remoteLocations.ContainsKey(boundBreakpointId))
                {
                    _boundBreakpoints[boundBreakpointId].Delete();
                    _boundBreakpoints.Remove(boundBreakpointId);
                }
            }

            List <IDebugBoundBreakpoint2> newLocations = new List <IDebugBoundBreakpoint2>();

            foreach (SbBreakpointLocation remoteLocation in remoteLocations.Values)
            {
                if (!_boundBreakpoints.ContainsKey(remoteLocation.GetId()))
                {
                    // Make sure the newly created bound breakpoints have the same
                    // enabled state as the pending breakpoint.
                    IBoundBreakpoint boundBreakpoint =
                        _debugBoundBreakpointFactory.Create(Self, remoteLocation, _program,
                                                            _requestInfo.guidLanguage);
                    boundBreakpoint.Enable(Convert.ToInt32(_enabled));
                    if (_breakpointCondition.VariableCondition.HasValue)
                    {
                        boundBreakpoint.SetCondition(_breakpointCondition.VariableCondition.Value);
                    }

                    if (_breakpointCondition.PassCount.HasValue)
                    {
                        boundBreakpoint.SetPassCount(_breakpointCondition.PassCount.Value);
                    }

                    _boundBreakpoints.Add(remoteLocation.GetId(), boundBreakpoint);
                    newLocations.Add(boundBreakpoint);
                }
            }

            if (_boundBreakpoints.Count == 0)
            {
                SetError(enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _breakpointLocationNotSet);
            }
            else
            {
                _breakpointError = null;
            }

            if (newLocations.Any())
            {
                _breakpointManager.EmitBreakpointBoundEvent(
                    Self, newLocations, _breakpointBoundEnumFactory);
            }
        }