Beispiel #1
0
 /// <summary>
 /// Creates a pending breakpoint in the debug DebugEngine (DE).
 /// </summary>
 /// <param name="pBPRequest">An IDebugBreakpointRequest2 object that describes the pending breakpoint to create.</param>
 /// <param name="ppPendingBP">Returns an IDebugPendingBreakpoint2 object that represents the pending breakpoint.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code. Typically returns E_FAIL if the pBPRequest parameter does not match any language supported by the DE of if the pBPRequest parameter is invalid or incomplete.</returns>
 /// <remarks>
 /// A pending breakpoint is essentially a collection of all the information needed to bind a breakpoint to code. The pending breakpoint returned from this method is not bound to code until the IDebugPendingBreakpoint2::Bind method is called.
 ///
 /// For each pending breakpoint the user sets, the session debug manager (SDM) calls this method in each attached DE. It is up to the DE to verify that the breakpoint is valid for programs running in that DE.
 ///
 /// When the user sets a breakpoint on a line of code, the DE is free to bind the breakpoint to the closest line in the document that corresponds to this code. This makes it possible for the user to set a breakpoint on the first line of a multi-line statement, but bind it on the last line (where all the code is attributed in the debug information).
 /// </remarks>
 public virtual int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest,
                                            out IDebugPendingBreakpoint2 ppPendingBP)
 {
     Logger.Debug(string.Empty);
     ppPendingBP = null;
     return(VSConstants.E_NOTIMPL);
 }
        public void SetUp()
        {
            var taskContext = new JoinableTaskContext();

            mockBreakpointManager = Substitute.For <IBreakpointManager>();
            mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>();
            mockTarget            = Substitute.For <RemoteTarget>();
            mockProgram           = Substitute.For <IDebugProgram2>();
            mockMarshal           = Substitute.For <Marshal>();
            mockLldbBreakpoint    = Substitute.For <RemoteBreakpoint>();
            requestInfo           = new BP_REQUEST_INFO();
            mockBreakpointRequest.GetRequestInfo(Arg.Any <enum_BPREQI_FIELDS>(),
                                                 Arg.Any <BP_REQUEST_INFO[]>()).Returns(x =>
            {
                enum_BPREQI_FIELDS fields = (enum_BPREQI_FIELDS)x[0];
                BP_REQUEST_INFO[] breakpointRequestInfo = (BP_REQUEST_INFO[])x[1];
                if (breakpointRequestInfo == null || breakpointRequestInfo.Length == 0)
                {
                    return(1);
                }
                return(BuildBreakpointRequestInfo(fields, out breakpointRequestInfo[0]));
            });
            mockLldbBreakpoint.GetId().Returns(EXPECTED_ID);
            SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE);

            mockBoundBreakpointFactory = Substitute.For <DebugBoundBreakpoint.Factory>();

            debugPendingBreakpointFactory = new DebugPendingBreakpoint.Factory(taskContext,
                                                                               mockBoundBreakpointFactory, new BreakpointErrorEnumFactory(),
                                                                               new BoundBreakpointEnumFactory());

            pendingBreakpoint = debugPendingBreakpointFactory.Create(
                mockBreakpointManager, mockProgram, mockBreakpointRequest, mockTarget,
                mockMarshal);
        }
Beispiel #3
0
        // A helper method used to construct a new pending breakpoint.
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBpRequest, out IDebugPendingBreakpoint2 ppPendingBp)
        {
            var pendingBreakpoint = new AD7PendingBreakpoint(pBpRequest, _mEngine, this);

            ppPendingBp = pendingBreakpoint;
            _mPendingBreakpoints.Add(pendingBreakpoint);
        }
 internal MonoPendingBreakpoint AddPendingBreakpoint(IDebugBreakpointRequest2 pBPRequest)
 {
     var bp = new MonoPendingBreakpoint(_engine, pBPRequest);
     _pendingBreakpoints.Add(bp);
     TryBindBreakpoints();
     return bp;
 }
Beispiel #5
0
        // A helper method used to construct a new pending breakpoint.
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            var pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, mEngine, this);

            ppPendingBP = pendingBreakpoint;
            mPendingBPs.Add(pendingBreakpoint);
        }
Beispiel #6
0
        // A helper method used to construct a new pending breakpoint.
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, m_engine, this);

            ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint;
            m_pendingBreakpoints.Add(pendingBreakpoint);
        }
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest,
                                                  out IDebugPendingBreakpoint2 ppPendingBP)
        {
            Log.Debug("Engine: CreatePendingBreakPoint");

            ppPendingBP = null;

            var info = new BP_REQUEST_INFO[1];

            info[0].bpLocation.bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_FILE_LINE;
            if (pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, info) == VSConstants.S_OK)
            {
                var    position = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(info[0].bpLocation.unionmember2);
                var    start    = new TEXT_POSITION[1];
                var    end      = new TEXT_POSITION[1];
                string fileName;

                position.GetRange(start, end);
                position.GetFileName(out fileName);

                //VS has a 0 based line\column value. PowerShell starts at 1
                var breakpoint = new ScriptBreakpoint(_node, fileName, (int)start[0].dwLine + 1, (int)start[0].dwColumn, _events);
                ppPendingBP = breakpoint;

                bps.Add(breakpoint);
            }

            return(VSConstants.S_OK);
        }
Beispiel #8
0
        DebugPendingBreakpoint(JoinableTaskContext taskContext,
                               DebugBoundBreakpoint.Factory debugBoundBreakpointFactory,
                               BreakpointErrorEnumFactory breakpointErrorEnumFactory,
                               BoundBreakpointEnumFactory breakpointBoundEnumFactory,
                               IBreakpointManager breakpointManager, IDebugProgram2 program,
                               IDebugBreakpointRequest2 request, RemoteTarget target,
                               Marshal marshal)
        {
            taskContext.ThrowIfNotOnMainThread();

            _debugBoundBreakpointFactory = debugBoundBreakpointFactory;
            _breakpointErrorEnumFactory  = breakpointErrorEnumFactory;
            _breakpointBoundEnumFactory  = breakpointBoundEnumFactory;
            _breakpointManager           = breakpointManager;
            _program = program;
            _request = request;
            _target  = target;
            _marshal = marshal;

            _boundBreakpoints = new Dictionary <int, IBoundBreakpoint>();

            BP_REQUEST_INFO[] breakpointRequestInfo = new BP_REQUEST_INFO[1];
            request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION |
                                   enum_BPREQI_FIELDS.BPREQI_CONDITION |
                                   enum_BPREQI_FIELDS.BPREQI_PASSCOUNT |
                                   enum_BPREQI_FIELDS.BPREQI_LANGUAGE,
                                   breakpointRequestInfo);
            _requestInfo = breakpointRequestInfo[0];

            _enabled             = false;
            _deleted             = false;
            _breakpointCondition = new BreakpointCondition(_requestInfo);
        }
        DebugWatchpoint(JoinableTaskContext taskContext,
                        DebugWatchpointResolution.Factory resolutionFactory,
                        BreakpointErrorEnumFactory breakpointErrorEnumFactory,
                        BoundBreakpointEnumFactory boundBreakpointEnumFactory,
                        IBreakpointManager breakpointManager, IDebugBreakpointRequest2 request,
                        RemoteTarget target, IDebugProgram2 program, Marshal marshal)
        {
            taskContext.ThrowIfNotOnMainThread();

            _request                    = request;
            _target                     = target;
            _breakpointManager          = breakpointManager;
            _resolutionFactory          = resolutionFactory;
            _breakpointErrorEnumFactory = breakpointErrorEnumFactory;
            _boundBreakpointEnumFactory = boundBreakpointEnumFactory;
            _disabledByPassCount        = false;

            BP_REQUEST_INFO[] breakpointRequestInfo = new BP_REQUEST_INFO[1];
            request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION |
                                   enum_BPREQI_FIELDS.BPREQI_CONDITION |
                                   enum_BPREQI_FIELDS.BPREQI_PASSCOUNT,
                                   breakpointRequestInfo);
            _requestInfo = breakpointRequestInfo[0];

            _enabled = true;
            _deleted = false;
            _program = program;
            _marshal = marshal;
        }
        private bool Initialize(QmlEngine engine, IDebugBreakpointRequest2 request)
        {
            var locationType = new enum_BP_LOCATION_TYPE[1];

            if (request.GetLocationType(locationType) != VSConstants.S_OK)
            {
                return(false);
            }

            var requestInfo = new BP_REQUEST_INFO[1];

            if (request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo)
                != VSConstants.S_OK)
            {
                return(false);
            }

            if (requestInfo[0].bpLocation.bpLocationType
                != (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                return(false);
            }

            var docPosition = Marshal.GetObjectForIUnknown(requestInfo[0].bpLocation.unionmember2)
                              as IDebugDocumentPosition2;

            if (docPosition == null)
            {
                return(false);
            }

            if (docPosition.GetFileName(out string fileName) != VSConstants.S_OK)
            {
                return(false);
            }

            if (!ValidExtensions.Where(x => string.Equals(x, Path.GetExtension(fileName))).Any())
            {
                return(false);
            }

            TEXT_POSITION[] beginPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition   = new TEXT_POSITION[1];
            if (docPosition.GetRange(beginPosition, endPosition) != VSConstants.S_OK)
            {
                return(false);
            }

            Engine        = engine;
            Request       = request;
            LocationType  = locationType[0];
            RequestInfo   = requestInfo[0];
            FileName      = fileName;
            BeginPosition = beginPosition[0];
            EndPosition   = endPosition[0];

            breakpoints = new HashSet <Breakpoint>();

            return(true);
        }
 public virtual IWatchpoint Create(IBreakpointManager breakpointManager,
                                   IDebugBreakpointRequest2 request, RemoteTarget target,
                                   IDebugProgram2 program)
 {
     _taskContext.ThrowIfNotOnMainThread();
     return(Create(breakpointManager, request, target, program, new Marshal()));
 }
        public AD7PendingBreakPoint(AD7Engine engine, IDebugBreakpointRequest2 pBPRequest)
        {
            var requestInfo = new BP_REQUEST_INFO[1];

            pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo);
            _bpRequestInfo = requestInfo[0];
            _pBPRequest    = pBPRequest;
            _engine        = engine;

            //Enabled = true;

            var docPosition =
                (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(_bpRequestInfo.bpLocation.unionmember2);

            string documentName;

            docPosition.GetFileName(out documentName);
            var startPosition = new TEXT_POSITION[1];
            var endPosition   = new TEXT_POSITION[1];

            docPosition.GetRange(startPosition, endPosition);

            DocumentName = documentName;
            StartLine    = (int)startPosition[0].dwLine;
            StartColumn  = (int)startPosition[0].dwColumn;

            EndLine   = (int)endPosition[0].dwLine;
            EndColumn = (int)endPosition[0].dwColumn;
        }
Beispiel #13
0
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            var pendingBreakpoint = new PendingBreakpoint(this, _backend, _callbacks, pBPRequest);

            _pendingBreakpoints.Add(pendingBreakpoint);
            ppPendingBP = pendingBreakpoint;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="pBPRequest"> The breakpoint request used to create this pending breakpoint. </param>
        /// <param name="engine"> The AD7Engine object that represents the DE. </param>
        /// <param name="bpManager"> The breakpoint manager. </param>
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo);
            m_bpRequestInfo = requestInfo[0];
            m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_CONDITION, requestInfo);
            if (requestInfo[0].dwFields != 0)
            {
                m_bpRequestInfo.bpCondition = requestInfo[0].bpCondition;
                m_bpRequestInfo.dwFields |= requestInfo[0].dwFields;
            }
            m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_PASSCOUNT, requestInfo);
            if (requestInfo[0].dwFields != 0)
            {
                m_bpRequestInfo.bpPassCount = requestInfo[0].bpPassCount;
                m_bpRequestInfo.dwFields |= requestInfo[0].dwFields;
            }

            m_engine = engine;
            m_bpManager = bpManager;
            m_boundBreakpoints = new System.Collections.Generic.List<AD7BoundBreakpoint>();

            m_enabled = true;
            m_deleted = false;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int GetBreakpointRequest(out IDebugBreakpointRequest2 ppBPRequest)
        {
            //
            // Gets the breakpoint request that was used to create this pending breakpoint.
            //

            LoggingUtils.PrintFunction();

            try
            {
                ppBPRequest = m_breakpointRequest;

                if (m_breakpointDeleted)
                {
                    return(Constants.E_BP_DELETED);
                }

                if (ppBPRequest == null)
                {
                    throw new InvalidOperationException();
                }

                return(Constants.S_OK);
            }
            catch (Exception e)
            {
                LoggingUtils.HandleException(e);

                ppBPRequest = null;

                return(Constants.E_FAIL);
            }
        }
 internal AD7Breakpoint(AD7ProgramNode node, AD7Events callback)
 {
   Debug.WriteLine("AD7Breakpoint: ctor");
   _node = node;
   _callback = callback;
   _breakpointRequest = null;
 }
Beispiel #17
0
 internal AD7Breakpoint(AD7ProgramNode node, AD7Events callback)
 {
     Debug.WriteLine("AD7Breakpoint: ctor");
     _node              = node;
     _callback          = callback;
     _breakpointRequest = null;
 }
Beispiel #18
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="pBPRequest"> The breakpoint request used to create this pending breakpoint. </param>
        /// <param name="engine"> The AD7Engine object that represents the DE. </param>
        /// <param name="bpManager"> The breakpoint manager. </param>
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo);
            m_bpRequestInfo = requestInfo[0];
            m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_CONDITION, requestInfo);
            if (requestInfo[0].dwFields != 0)
            {
                m_bpRequestInfo.bpCondition = requestInfo[0].bpCondition;
                m_bpRequestInfo.dwFields   |= requestInfo[0].dwFields;
            }
            m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_PASSCOUNT, requestInfo);
            if (requestInfo[0].dwFields != 0)
            {
                m_bpRequestInfo.bpPassCount = requestInfo[0].bpPassCount;
                m_bpRequestInfo.dwFields   |= requestInfo[0].dwFields;
            }

            m_engine           = engine;
            m_bpManager        = bpManager;
            m_boundBreakpoints = new System.Collections.Generic.List <AD7BoundBreakpoint>();

            m_enabled = true;
            m_deleted = false;
        }
        public BreakpointRequestInfo(IDebugBreakpointRequest2 request)
        {
            Contract.Requires<ArgumentNullException>(request != null, "request");

            _request = request;

            IDebugBreakpointRequest3 request3 = request as IDebugBreakpointRequest3;
            BP_REQUEST_INFO2[] requestInfo2 = new BP_REQUEST_INFO2[1];
            if (request3 != null && ErrorHandler.Succeeded(request3.GetRequestInfo2(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo2)))
            {
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_PROGRAM) != 0)
                    _program = requestInfo2[0].pProgram;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_THREAD) != 0)
                    _thread = requestInfo2[0].pThread;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_LANGUAGE) != 0)
                    _languageGuid = requestInfo2[0].guidLanguage;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_VENDOR) != 0)
                    _vendorGuid = requestInfo2[0].guidVendor;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_CONSTRAINT) != 0)
                    _constraint = requestInfo2[0].bstrConstraint;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_PROGRAMNAME) != 0)
                    _programName = requestInfo2[0].bstrProgramName;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_THREADNAME) != 0)
                    _threadName = requestInfo2[0].bstrThreadName;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_TRACEPOINT) != 0)
                    _tracepoint = requestInfo2[0].bstrTracepoint;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_FLAGS) != 0)
                    _flags = requestInfo2[0].dwFlags;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0)
                    _passCount = requestInfo2[0].bpPassCount;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0)
                    _condition = requestInfo2[0].bpCondition;
                if ((requestInfo2[0].dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0)
                    _location = BreakpointLocation.FromNativeForm(requestInfo2[0].bpLocation, true);
            }
            else
            {
                BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
                ErrorHandler.ThrowOnFailure(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_PROGRAM) != 0)
                    _program = requestInfo[0].pProgram;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_THREAD) != 0)
                    _thread = requestInfo[0].pThread;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_LANGUAGE) != 0)
                    _languageGuid = requestInfo[0].guidLanguage;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_PROGRAMNAME) != 0)
                    _programName = requestInfo[0].bstrProgramName;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_THREADNAME) != 0)
                    _threadName = requestInfo[0].bstrThreadName;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_FLAGS) != 0)
                    _flags = requestInfo[0].dwFlags;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0)
                    _passCount = requestInfo[0].bpPassCount;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0)
                    _condition = requestInfo[0].bpCondition;
                if ((requestInfo[0].dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0)
                    _location = BreakpointLocation.FromNativeForm(requestInfo[0].bpLocation, true);
            }
        }
Beispiel #20
0
        public Breakpoint(Program program, IDebugBreakpointRequest2 request, IDebugDocumentPosition2 documentInfo)
        {
            _program      = program;
            _request      = request;
            _documentInfo = documentInfo;

            ErrorHandler.ThrowOnFailure(_documentInfo.GetFileName(out _sourcePath));
        }
Beispiel #21
0
        internal MonoPendingBreakpoint AddPendingBreakpoint(IDebugBreakpointRequest2 pBPRequest)
        {
            var bp = new MonoPendingBreakpoint(_engine, pBPRequest);

            _pendingBreakpoints.Add(bp);
            TryBindBreakpoints();
            return(bp);
        }
Beispiel #22
0
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            AD7PendingBreakPoint breakpoint = new AD7PendingBreakPoint(this, pBPRequest);

            ppPendingBP = breakpoint;

            return(Constants.S_OK);
        }
 /// <summary>
 /// Create a breakpoint. This notifies LLDB of the breakpoint location.
 /// </summary>
 public IDebugPendingBreakpoint2 CreatePendingBreakpoint(
     IDebugBreakpointRequest2 breakpointRequest)
 {
     _breakpointManager.CreatePendingBreakpoint(breakpointRequest,_target,
                                                out IDebugPendingBreakpoint2
                                                pendingBreakpoint);
     return(pendingBreakpoint);
 }
        public AD7PendingBreakpoint(AD7Engine engine, IDebugBreakpointRequest2 request) {
            Engine = engine;
            _request = request;

            var requestInfo = new BP_REQUEST_INFO[1];
            Marshal.ThrowExceptionForHR(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
            _requestInfo = requestInfo[0];
        }
 public virtual IWatchpoint Create(IBreakpointManager breakpointManager,
                                   IDebugBreakpointRequest2 request, RemoteTarget target,
                                   IDebugProgram2 program, Marshal marshal)
 {
     _taskContext.ThrowIfNotOnMainThread();
     return(new DebugWatchpoint(_taskContext, _resolutionFactory,
                                _breakpointErrorEnumFactory, _boundBreakpointEnumFactory,
                                breakpointManager, request, target, program, marshal));
 }
Beispiel #26
0
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            Debug.WriteLine("Creating pending break point");
            Debug.Assert(_breakpointManager != null);
            ppPendingBP = null;

            _breakpointManager.CreatePendingBreakpoint(pBPRequest, out ppPendingBP);
            return(VSConstants.S_OK);
        }
Beispiel #27
0
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            Debug.WriteLine("AD7Engine CreatePendingBreakpoint");
            _breakpoint = new AD7Breakpoint(_node, _events, pBPRequest);
            ppPendingBP = _breakpoint;
            //_events.Breakpoint(_node, _breakpoint);

            return(VSConstants.S_OK);
        }
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            DebugHelper.TraceEnteringMethod();

            AD7PendingBreakpoint breakpoint = DebuggedProcess.AddPendingBreakpoint(pBPRequest);
            ppPendingBP = breakpoint;

            return VSConstants.S_OK;
        }
        public MonoPendingBreakpoint(MonoEngine engine, IDebugBreakpointRequest2 req)
        {
            _engine = engine;

            _request = req;

            BP_REQUEST_INFO[] inf = new BP_REQUEST_INFO[1];
            req.GetRequestInfo((uint)enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, inf);
            _requestInfo = inf[0];
        }
Beispiel #30
0
        public MonoPendingBreakpoint(MonoBreakpointManager breakpointManager, IDebugBreakpointRequest2 request)
        {
            this.breakpointManager = breakpointManager;
            this.request           = request;

            var requestInfo = new BP_REQUEST_INFO[1];

            EngineUtils.CheckOk(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            this.requestInfo = requestInfo[0];
        }
Beispiel #31
0
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            DebugHelper.TraceEnteringMethod();

            MonoPendingBreakpoint breakpoint = DebuggedProcess.AddPendingBreakpoint(pBPRequest);

            ppPendingBP = breakpoint;

            return(VSConstants.S_OK);
        }
Beispiel #32
0
        internal AD7PendingBreakpoint AddPendingBreakpoint(IDebugBreakpointRequest2 pBPRequest)
        {
            var bp = new AD7PendingBreakpoint(_engine, pBPRequest);

            lock (_pendingBreakpoints)
                _pendingBreakpoints.Add(bp);

            TryBindBreakpoints();
            return(bp);
        }
Beispiel #33
0
    public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager) {
      m_pBPRequest = pBPRequest;
      BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
      EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
      mBpRequestInfo = requestInfo[0];
      EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_THREAD, requestInfo));

      mEngine = engine;
      mBPMgr = bpManager;
    }
Beispiel #34
0
        public AD7PendingBreakpoint(AD7Engine engine, IDebugBreakpointRequest2 request)
        {
            Engine   = engine;
            _request = request;

            var requestInfo = new BP_REQUEST_INFO[1];

            Marshal.ThrowExceptionForHR(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
            _requestInfo = requestInfo[0];
        }
 public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine)
 {
     m_pBPRequest = pBPRequest;
     var requestInfo = new BP_REQUEST_INFO[1];
     EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
     m_bpRequestInfo = requestInfo[0];
     m_engine = engine;
     m_enabled = true;
     m_deleted = false;
 }
 // Token: 0x060000BC RID: 188 RVA: 0x00003FE4 File Offset: 0x000021E4
 public PendingBreakpointRequest(IDebugBreakpointRequest2 request)
 {
     this.Request = request;
     BP_REQUEST_INFO[] array = new BP_REQUEST_INFO[1];
     Utils.RequireOk(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_PASSCOUNT | enum_BPREQI_FIELDS.BPREQI_BPLOCATION, array));
     this.RequestInfo = array[0];
     enum_BP_LOCATION_TYPE[] array2 = new enum_BP_LOCATION_TYPE[1];
     Utils.RequireOk(request.GetLocationType(array2));
     this.LocationType = array2[0];
 }
 public AD7Breakpoint(AD7ProgramNode node, AD7Events callback, IDebugBreakpointRequest2 breakpointRequest)
 {
   Debug.WriteLine("AD7Breakpoint: ctor");
   _node = node;
   _callback = callback;
   _breakpointRequest = breakpointRequest;
   
   BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
   _breakpointRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION, requestInfo);
   _bpRequestInfo = requestInfo[0];
 }
Beispiel #38
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            m_pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            mBpRequestInfo = requestInfo[0];
            EngineUtils.CheckOk(m_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_THREAD, requestInfo));

            mEngine = engine;
            mBPMgr  = bpManager;
        }
Beispiel #39
0
        public AD7Breakpoint(AD7ProgramNode node, AD7Events callback, IDebugBreakpointRequest2 breakpointRequest)
        {
            Debug.WriteLine("AD7Breakpoint: ctor");
            _node              = node;
            _callback          = callback;
            _breakpointRequest = breakpointRequest;

            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            _breakpointRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION, requestInfo);
            _bpRequestInfo = requestInfo[0];
        }
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBpRequest, AD7Engine engine, BreakpointManager bpManager) {
            _bpRequest = pBpRequest;
            var requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(_bpRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
            _bpRequestInfo = requestInfo[0];

            _engine = engine;
            _bpManager = bpManager;

            _enabled = true;
            _deleted = false;
        }
Beispiel #41
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager) {
            _bpRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(_bpRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
            _bpRequestInfo = requestInfo[0];            
            
            _engine = engine;
            _bpManager = bpManager;
            _boundBreakpoints = new System.Collections.Generic.List<AD7BoundBreakpoint>();

            _enabled = true;
            _deleted = false;
        }
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            _pBPRequest = pBPRequest;
            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(_pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_PASSCOUNT, requestInfo));
            _bpRequestInfo = requestInfo[0];

            _engine = engine;
            _bpManager = bpManager;
            _boundBreakpoints = new List<AD7BoundBreakpoint>();

            _enabled = true;
            _deleted = false;
            _pendingDelete = false;

            _bp = null;    // no underlying breakpoint created yet
            _BPError = null;
        }
Beispiel #43
0
 /// <summary>
 /// Creates a pending breakpoint in the debug engine (DE).
 /// </summary>
 public int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "IDebugEngine2.CreatePendingBreakpoint");
     ppPendingBP = new DebugPendingBreakpoint(pBPRequest, this);
     return VSConstants.S_OK;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 internal DebugPendingBreakpoint(IDebugBreakpointRequest2 request, DebugEngine engine)
 {
     this.request = request;
     this.engine = engine;
 }
Beispiel #45
0
        /// <summary>
        /// Creates a pending breakpoint in the debug engine (DE).
        /// </summary>
        /// <param name="breakpointRequest">An IDebugBreakpointRequest2 object that describes the pending breakpoint to create.</param>
        /// <param name="pendingBreakpoint">Returns an IDebugPendingBreakpoint2 object that represents the pending breakpoint.</param>
        /// <returns>
        /// If successful, returns S_OK; otherwise, returns an error code. Typically returns E_FAIL if the pBPRequest parameter
        /// does not match any language supported by the DE of if the pBPRequest parameter is invalid or incomplete.
        /// </returns>
        /// <remarks>
        /// A pending breakpoint is essentially a collection of all the information needed to bind a breakpoint to code. The
        /// pending breakpoint returned from this method is not bound to code until the IDebugPendingBreakpoint2.Bind method
        /// is called.
        /// 
        /// For each pending breakpoint the user sets, the session debug manager (SDM) calls this method in each attached DE.
        /// It is up to the DE to verify that the breakpoint is valid for programs running in that DE.
        /// 
        /// When the user sets a breakpoint on a line of code, the DE is free to bind the breakpoint to the closest line in
        /// the document that corresponds to this code. This makes it possible for the user to set a breakpoint on the first
        /// line of a multi-line statement, but bind it on the last line (where all the code is attributed in the debug
        /// information).
        /// </remarks>
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 breakpointRequest, out IDebugPendingBreakpoint2 pendingBreakpoint)
        {
            pendingBreakpoint = null;

            BreakpointRequestInfo requestInfo = new BreakpointRequestInfo(breakpointRequest);
            if (requestInfo.LanguageGuid != Constants.JavaLanguageGuid && requestInfo.LanguageGuid != Guid.Empty)
                return VSConstants.E_FAIL;

            if (requestInfo.Location.LocationType == enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                pendingBreakpoint = new JavaDebugLocationPendingBreakpoint(this, requestInfo);
                _pendingBreakpoints.Add(pendingBreakpoint);
                return VSConstants.S_OK;
            }

            throw new NotImplementedException();
        }
Beispiel #46
0
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to 
        // a location in the debuggee.
        // Called when new bp set by user
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            breakpointManager.CreatePendingBreakpoint(pBPRequest, out ppPendingBP);

            return VSConstants.S_OK;
        }
 int IDebugPendingBreakpoint2.GetBreakpointRequest(out IDebugBreakpointRequest2 ppBPRequest)
 {
   Debug.WriteLine("AD7Breakpoint: GetBreakpointRequest");
   ppBPRequest = null;
   return VSConstants.S_OK;
 }
        internal AD7PendingBreakpoint AddPendingBreakpoint(IDebugBreakpointRequest2 pBPRequest)
        {
            var bp = new AD7PendingBreakpoint(_engine, pBPRequest);
            lock (_pendingBreakpoints)
                _pendingBreakpoints.Add(bp);

            TryBindBreakpoints();
            return bp;
        }
 /// <summary>
 /// Creates a pending breakpoint in the debug DebugEngine (DE).
 /// </summary>
 /// <param name="pBPRequest">An IDebugBreakpointRequest2 object that describes the pending breakpoint to create.</param>
 /// <param name="ppPendingBP">Returns an IDebugPendingBreakpoint2 object that represents the pending breakpoint.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code. Typically returns E_FAIL if the pBPRequest parameter does not match any language supported by the DE of if the pBPRequest parameter is invalid or incomplete.</returns>
 /// <remarks>
 /// A pending breakpoint is essentially a collection of all the information needed to bind a breakpoint to code. The pending breakpoint returned from this method is not bound to code until the IDebugPendingBreakpoint2::Bind method is called.
 /// 
 /// For each pending breakpoint the user sets, the session debug manager (SDM) calls this method in each attached DE. It is up to the DE to verify that the breakpoint is valid for programs running in that DE.
 /// 
 /// When the user sets a breakpoint on a line of code, the DE is free to bind the breakpoint to the closest line in the document that corresponds to this code. This makes it possible for the user to set a breakpoint on the first line of a multi-line statement, but bind it on the last line (where all the code is attributed in the debug information).
 /// </remarks>
 public virtual int CreatePendingBreakpoint( IDebugBreakpointRequest2 pBPRequest,
     out IDebugPendingBreakpoint2 ppPendingBP)
 {
     Logger.Debug( string.Empty );
     ppPendingBP = null;
     return VSConstants.E_NOTIMPL;
 }
        public int GetBreakpointRequest(out IDebugBreakpointRequest2 ppBPRequest)
        {
            if (_deleted)
            {
                ppBPRequest = null;
                return AD7Constants.E_BP_DELETED;
            }

            ppBPRequest = _requestInfo.Request;
            return VSConstants.S_OK;
        }
Beispiel #51
0
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            if (_mixedMode) {
                ppPendingBP = null;
                return VSConstants.E_NOTIMPL;
            }

            Debug.WriteLine("Creating pending break point");
            Debug.Assert(_breakpointManager != null);
            ppPendingBP = null;

            _breakpointManager.CreatePendingBreakpoint(pBPRequest, out ppPendingBP);
            return VSConstants.S_OK;
        }
 // A helper method used to construct a new pending breakpoint.
 public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
 {
     AD7PendingBreakpoint pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, _engine, this);
     ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint;
     lock (_pendingBreakpoints)
     {
         _pendingBreakpoints.Add(pendingBreakpoint);
     }
 }
 // Gets the breakpoint request that was used to create this pending breakpoint
 int IDebugPendingBreakpoint2.GetBreakpointRequest(out IDebugBreakpointRequest2 ppBpRequest)
 {
     ppBpRequest = _bpRequest;
     return VSConstants.S_OK;
 }
 // A helper method used to construct a new pending breakpoint.
 public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP) {
     var pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, mEngine, this);
     ppPendingBP = (IDebugPendingBreakpoint2)pendingBreakpoint;
     mPendingBPs.Add(pendingBreakpoint);
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int CreatePendingBreakpoint (IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
    {
      // 
      // Creates a pending breakpoint for this DebugEngine. 
      // A 'PendingBreakpoint' contains all required data to bind a breakpoint to a location in the debuggee.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        LoggingUtils.RequireOk (BreakpointManager.CreatePendingBreakpoint (pBPRequest, out ppPendingBP));

        return Constants.S_OK;
      }
      catch (Exception e)
      {
        LoggingUtils.HandleException (e);

        ppPendingBP = null;

        return Constants.E_FAIL;
      }
    }
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to 
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBpRequest, out IDebugPendingBreakpoint2 ppPendingBp) {
            DebugWriteCommand("CreatePendingBreakpoint");
            Debug.Assert(_breakpointManager != null);
            ppPendingBp = null;

            // Check whether breakpoint request for our language
            var requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.CheckOk(pBpRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_LANGUAGE | enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            if (requestInfo[0].guidLanguage != Guids.NodejsDebugLanguage &&
                requestInfo[0].guidLanguage != Guids.ScriptDebugLanguage &&
                requestInfo[0].guidLanguage != Guids.TypeScriptDebugLanguage) {
                // Check whether breakpoint request for our "downloaded" script
                // "Downloaded" script will have our IDebugDocument2
                IDebugDocument2 debugDocument;
                var debugDocumentPosition = Marshal.GetObjectForIUnknown(requestInfo[0].bpLocation.unionmember2) as IDebugDocumentPosition2;
                if (debugDocumentPosition == null || VSConstants.S_OK != debugDocumentPosition.GetDocument(out debugDocument) || null == debugDocument as AD7Document) {
                    // Not ours
                    return VSConstants.E_FAIL;
                }
            }

            _breakpointManager.CreatePendingBreakpoint(pBpRequest, out ppPendingBp);
            return VSConstants.S_OK;
        }
Beispiel #57
0
 /// <summary>
 /// Gets the breakpoint request that was used to create this pending breakpoint.
 /// </summary>
 /// <param name="ppBPRequest">Returns an IDebugBreakpointRequest2 object representing the breakpoint request that was used to create this pending breakpoint.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code. Returns E_BP_DELETED if the breakpoint has been deleted.</returns>
 public virtual int GetBreakpointRequest( out IDebugBreakpointRequest2 ppBPRequest )
 {
     Logger.Debug( string.Empty );
     ppBPRequest = null;
     return VSConstants.E_NOTIMPL;
 }
 // Gets the breakpoint request that was used to create this pending breakpoint
 int IDebugPendingBreakpoint2.GetBreakpointRequest(out IDebugBreakpointRequest2 ppBPRequest)
 {
     ppBPRequest = this.m_pBPRequest;
     return Constants.S_OK;
 }
Beispiel #59
0
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            Debug.Assert(_breakpointManager != null);
            ppPendingBP = null;

            try
            {
                _breakpointManager.CreatePendingBreakpoint(pBPRequest, out ppPendingBP);
            }
            catch (Exception e)
            {
                return EngineUtils.UnexpectedException(e);
            }

            return Constants.S_OK;
        }
Beispiel #60
0
        // Creates a pending breakpoint in the engine. A pending breakpoint is contains all the information needed to bind a breakpoint to 
        // a location in the debuggee.
        int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest,
                                                  out IDebugPendingBreakpoint2 ppPendingBP)
        {
            Log.Debug("Engine: CreatePendingBreakPoint");

            ppPendingBP = null;

            var info = new BP_REQUEST_INFO[1];
            info[0].bpLocation.bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_FILE_LINE;
            if (pBPRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, info) == VSConstants.S_OK)
            {
                var position = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(info[0].bpLocation.unionmember2);
                var start = new TEXT_POSITION[1]; 
                var end = new TEXT_POSITION[1];
                string fileName;

                position.GetRange(start, end);
                position.GetFileName(out fileName);

                //VS has a 0 based line\column value. PowerShell starts at 1
                var breakpoint = new ScriptBreakpoint(_node, fileName, (int)start[0].dwLine + 1, (int)start[0].dwColumn, _events);
                ppPendingBP = breakpoint;

                bps.Add(breakpoint);
            }

            return VSConstants.S_OK;
        }