Example #1
0
        public int CanBind(out IEnumDebugErrorBreakpoints2 errorBreakpointsEnum)
        {
            errorBreakpointsEnum = null;
            if (_deleted)
            {
                return(AD7Constants.E_BP_DELETED);
            }

            bool notDataStringLocation = _requestInfo.bpLocation.bpLocationType !=
                                         (uint)enum_BP_LOCATION_TYPE.BPLT_DATA_STRING;

            bool conditionalWhenChangedBp =
                (_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0 &&
                _requestInfo.bpCondition.styleCondition == enum_BP_COND_STYLE.BP_COND_WHEN_CHANGED;

            if (notDataStringLocation || conditionalWhenChangedBp)
            {
                IDebugErrorBreakpoint2[] breakpointErrors = new IDebugErrorBreakpoint2[1];
                breakpointErrors[0] = new DebugBreakpointError(
                    Self, enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _watchpointNotSupported);
                errorBreakpointsEnum = _breakpointErrorEnumFactory.Create(breakpointErrors);
                return(VSConstants.S_FALSE);
            }
            return(VSConstants.S_OK);
        }
Example #2
0
        public int CanBind(out IEnumDebugErrorBreakpoints2 errorBreakpointsEnum)
        {
            errorBreakpointsEnum = null;
            if (_deleted)
            {
                return(AD7Constants.E_BP_DELETED);
            }

            // Check the breakpoint type, and make sure it's supported.
            if (IsSupportedType())
            {
                return(VSConstants.S_OK);
            }

            var breakpointErrors = new IDebugErrorBreakpoint2[1];

            breakpointErrors[0] = new DebugBreakpointError(
                Self, enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _breakpointNotSupported);
            errorBreakpointsEnum = _breakpointErrorEnumFactory.Create(breakpointErrors);
            return(VSConstants.S_FALSE);
        }
Example #3
0
 public void ReportBreakpointError(DebugBreakpointError error)
 => debugEngineHandler.OnBreakpointError(error, debugProgram);
Example #4
0
 /// <summary>
 /// Caches the error, and notifies the DebugEngine that an error occurred with the pending
 /// breakpoint.  Calling this multiple times will overwrite the previously cached error.
 /// </summary>
 void SetError(enum_BP_ERROR_TYPE errorType, string errorMessage)
 {
     _breakpointError = new DebugBreakpointError(Self, errorType, errorMessage);
     _breakpointManager.ReportBreakpointError(_breakpointError);
 }
Example #5
0
 public BreakpointErrorEvent(DebugBreakpointError breakpointError)
     : base((uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS,
            new Guid("ABB0CA42-F82B-4622-84E4-6903AE90F210"))
 {
     _breakpointError = breakpointError;
 }
Example #6
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);
            }
        }
 /// <summary>
 /// Send a breakpoint error event to the SDM.
 /// </summary>
 public static void OnBreakpointError(this IDebugEngineHandler handler,
                                      DebugBreakpointError breakpointError,
                                      IGgpDebugProgram program) =>
 handler.SendEvent(new BreakpointErrorEvent(breakpointError), program);