Example #1
0
        int IDebugPendingBreakpoint2.Bind()
        {
            if (!CanBind())
            {
                // The breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
                // We may want to send an instance of IDebugBreakpointErrorEvent2 to the UI and return a valid instance of
                // IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then
                // display information about why the breakpoint did not bind to the user.
                return(VSConstants.S_FALSE);
            }
            if (_boundBreakpoint != null)
            {
                throw new NotImplementedException(); // multiple bound breakpoints are not supported
            }
            IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)
                                                  Marshal.GetObjectForIUnknown(_requestInfo.bpLocation.unionmember2);

            string documentName;

            TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition   = new TEXT_POSITION[1];

            EngineUtils.RequireOk(docPosition.GetFileName(out documentName));
            EngineUtils.RequireOk(docPosition.GetRange(startPosition, endPosition));

            var resolution = _manager.ResolveBreakpoint(startPosition[0]);

            _boundBreakpoint = new BoundBreakpoint(_backend, this, resolution);
            _boundBreakpoint.CompleteBind();

            _callbacks.OnBreakpointBound(_boundBreakpoint);

            return(VSConstants.S_OK);
        }
Example #2
0
        public void OnBreakpointBound(BoundBreakpoint boundBreakpoint)
        {
            IDebugPendingBreakpoint2 pendingBreakpoint;

            ((IDebugBoundBreakpoint2)boundBreakpoint).GetPendingBreakpoint(out pendingBreakpoint);

            var eventObject = new AD7BreakpointBoundEvent((PendingBreakpoint)pendingBreakpoint, boundBreakpoint);

            Send(eventObject, AD7BreakpointBoundEvent.IID);
        }
Example #3
0
 public void OnBoundBreakpointDeleted(BoundBreakpoint boundBreakpoint)
 {
     Debug.Assert(boundBreakpoint == _boundBreakpoint);
     _boundBreakpoint = null;
 }
Example #4
0
 public void ClearBoundBreakpoints()
 {
     _boundBreakpoint = null;
 }
Example #5
0
 public AD7BreakpointBoundEvent(PendingBreakpoint pendingBreakpoint, BoundBreakpoint boundBreakpoint)
 {
     _pendingBreakpoint = pendingBreakpoint;
     _boundBreakpoint   = boundBreakpoint;
 }