Esempio n. 1
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);
        }
Esempio n. 2
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);
 }
Esempio n. 3
0
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            var pendingBreakpoint = new PendingBreakpoint(this, _backend, _callbacks, pBPRequest);

            _pendingBreakpoints.Add(pendingBreakpoint);
            ppPendingBP = pendingBreakpoint;
        }
Esempio n. 4
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);
        }
 public DebugBreakpointError(IDebugPendingBreakpoint2 pendingBreakpoint,
                             enum_BP_ERROR_TYPE errorType, string errorMessage)
 {
     _pendingBreakpoint = pendingBreakpoint;
     _errorType         = errorType;
     _errorMessage      = errorMessage;
 }
Esempio n. 6
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);
        }
        // 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);
        }
        public DebugErrorBreakpoint(IDebugPendingBreakpoint2 pendingBreakpoint, IDebugErrorBreakpointResolution2 resolution)
        {
            Contract.Requires <ArgumentNullException>(pendingBreakpoint != null, "pendingBreakpoint");
            Contract.Requires <ArgumentNullException>(resolution != null, "resolution");

            _pendingBreakpoint = pendingBreakpoint;
            _resolution        = resolution;
        }
Esempio n. 9
0
 public BreakpointBoundEvent(IDebugPendingBreakpoint2 pendingBreakpoint)
     : base((uint)enum_EVENTATTRIBUTES.EVENT_SYNCHRONOUS,
            new Guid("1dddb704-cf99-4b8a-b746-dabb01dd13a0"))
 {
     _pendingBreakpoint          = pendingBreakpoint;
     _newlyBoundBreakpoints      = null;
     _breakpointBoundEnumFactory = null;
 }
        public static bool IsVirtualized(this IDebugPendingBreakpoint2 breakpoint)
        {
            Contract.Requires <ArgumentNullException>(breakpoint != null, "breakpoint");

            PENDING_BP_STATE_INFO[] state = new PENDING_BP_STATE_INFO[1];
            ErrorHandler.ThrowOnFailure(breakpoint.GetState(state));
            return((state[0].Flags & enum_PENDING_BP_STATE_FLAGS.PBPSF_VIRTUALIZED) != 0);
        }
Esempio n. 11
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
        {
            LoggingUtils.PrintFunction();

            ppPendingBreakpoint = m_pendingBreakpoint;

            return(Constants.S_OK);
        }
Esempio n. 12
0
        public DebugErrorBreakpoint(IDebugPendingBreakpoint2 pendingBreakpoint, IDebugErrorBreakpointResolution2 resolution)
        {
            Contract.Requires<ArgumentNullException>(pendingBreakpoint != null, "pendingBreakpoint");
            Contract.Requires<ArgumentNullException>(resolution != null, "resolution");

            _pendingBreakpoint = pendingBreakpoint;
            _resolution = resolution;
        }
        public static enum_PENDING_BP_STATE GetState(this IDebugPendingBreakpoint2 breakpoint)
        {
            Contract.Requires <ArgumentNullException>(breakpoint != null, "breakpoint");

            PENDING_BP_STATE_INFO[] state = new PENDING_BP_STATE_INFO[1];
            ErrorHandler.ThrowOnFailure(breakpoint.GetState(state));
            return(state[0].state);
        }
        public DebugBreakpointBoundEvent(enum_EVENTATTRIBUTES attributes, IDebugPendingBreakpoint2 pendingBreakpoint, IEnumDebugBoundBreakpoints2 boundBreakpoints)
            : base(attributes)
        {
            Contract.Requires<ArgumentNullException>(pendingBreakpoint != null, "pendingBreakpoint");
            Contract.Requires<ArgumentNullException>(boundBreakpoints != null, "boundBreakpoints");

            _pendingBreakpoint = pendingBreakpoint;
            _boundBreakpoints = boundBreakpoints;
        }
Esempio n. 15
0
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            DebugHelper.TraceEnteringMethod();

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

            return VSConstants.S_OK;
        }
 public virtual IBoundBreakpoint Create(
     IDebugPendingBreakpoint2 pendingBreakpoint, SbBreakpointLocation breakpointLocation,
     IDebugProgram2 program,
     Guid languageGuid) => new DebugBoundBreakpoint(_documentContextFactory,
                                                    _codeContextFactory,
                                                    _breakpointResolutionFactory,
                                                    pendingBreakpoint,
                                                    breakpointLocation, program,
                                                    languageGuid);
        public DebugBreakpointBoundEvent(enum_EVENTATTRIBUTES attributes, IDebugPendingBreakpoint2 pendingBreakpoint, IEnumDebugBoundBreakpoints2 boundBreakpoints)
            : base(attributes)
        {
            Contract.Requires <ArgumentNullException>(pendingBreakpoint != null, "pendingBreakpoint");
            Contract.Requires <ArgumentNullException>(boundBreakpoints != null, "boundBreakpoints");

            _pendingBreakpoint = pendingBreakpoint;
            _boundBreakpoints  = boundBreakpoints;
        }
Esempio n. 18
0
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
        {
            DebugHelper.TraceEnteringMethod();

            MonoPendingBreakpoint breakpoint = DebuggedProcess.AddPendingBreakpoint(pBPRequest);

            ppPendingBP = breakpoint;

            return(VSConstants.S_OK);
        }
        public int GetPendingBreakpoint(out IDebugPendingBreakpoint2 pendingBreakpoint)
        {
            if (_deleted)
            {
                pendingBreakpoint = null;
                return(AD7Constants.E_BP_DELETED);
            }

            pendingBreakpoint = _pendingBreakpoint;
            return(VSConstants.S_OK);
        }
        public JavaDebugBoundBreakpoint(IDebugPendingBreakpoint2 pendingBreakpoint, JavaDebugProgram program, IBreakpointRequest eventRequest, DebugBreakpointResolution resolution)
        {
            Contract.Requires <ArgumentNullException>(pendingBreakpoint != null, "pendingBreakpoint");
            Contract.Requires <ArgumentNullException>(program != null, "program");
            Contract.Requires <ArgumentNullException>(eventRequest != null, "eventRequest");
            Contract.Requires <ArgumentNullException>(resolution != null, "resolution");

            _pendingBreakpoint = pendingBreakpoint;
            _program           = program;
            _eventRequest      = eventRequest;
            _resolution        = resolution;
            _disabled          = true;
        }
        bool IsBreakpointBoundEvent(IDebugPendingBreakpoint2 expected, DebugEvent actual)
        {
            var be = actual as BreakpointBoundEvent;

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

            IDebugPendingBreakpoint2 pendingBreakpoint;

            be.GetPendingBreakpoint(out pendingBreakpoint);
            return(pendingBreakpoint == expected);
        }
Esempio n. 22
0
        /// <summary>
        ///     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.
        /// </summary>
        /// <param name="request"></param>
        /// <param name="pendingBreakpoint"></param>
        /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 request,
                                           out IDebugPendingBreakpoint2 pendingBreakpoint)
        {
            try
            {
                pendingBreakpoint = Program.CreatePendingBreakpoint(request);

                return(S_OK);
            }
            catch
            {
                pendingBreakpoint = null;
                return(E_FAIL);
            }
        }
Esempio n. 23
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.
        public int 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);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public virtual int GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
        {
            //
            // Gets the pending breakpoint from which the specified bound breakpoint was created.
            //

            LoggingUtils.PrintFunction();

            ppPendingBreakpoint = m_pendingBreakpoint;

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

            return(Constants.S_OK);
        }
Esempio n. 25
0
 // Token: 0x0600004F RID: 79 RVA: 0x000031D8 File Offset: 0x000013D8
 public int CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP)
 {
     ppPendingBP = null;
     foreach (Process process in this.processes)
     {
         PendingBreakpoint pendingBreakpoint = process.Breakpoints.CreatePendingBreakpoint(pBPRequest);
         if (pendingBreakpoint != null)
         {
             ppPendingBP = pendingBreakpoint;
         }
     }
     if (ppPendingBP == null)
     {
         return(1);
     }
     return(0);
 }
Esempio n. 26
0
        int IDebugEngine2.CreatePendingBreakpoint(
            IDebugBreakpointRequest2 pBPRequest,
            out IDebugPendingBreakpoint2 ppPendingBP)
        {
            ppPendingBP = null;

            var pendingBreakpoint = PendingBreakpoint.Create(this, pBPRequest);

            if (pendingBreakpoint == null)
            {
                return(VSConstants.E_FAIL);
            }

            ppPendingBP = pendingBreakpoint;
            pendingBreakpoints.Add(pendingBreakpoint);

            return(VSConstants.S_OK);
        }
Esempio n. 27
0
        public int CreatePendingBreakpoint(IDebugBreakpointRequest2 request, out IDebugPendingBreakpoint2 breakpoint)
        {
            var requestInfo = new BP_REQUEST_INFO[1];

            ErrorHandler.ThrowOnFailure(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            var bpLocation = requestInfo[0].bpLocation;

            if (bpLocation.bpLocationType != (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                breakpoint = null;
                return(VSConstants.E_FAIL);
            }

            var documentInfo = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(bpLocation.unionmember2);

            breakpoint = new Breakpoint(this, request, documentInfo);
            return(VSConstants.S_OK);
        }
        public static IEnumerable <IDebugBoundBreakpoint2> EnumBoundBreakpoints(this IDebugPendingBreakpoint2 breakpoint)
        {
            Contract.Requires <ArgumentNullException>(breakpoint != null, "breakpoint");

            IEnumDebugBoundBreakpoints2 boundBreakpoints;

            ErrorHandler.ThrowOnFailure(breakpoint.EnumBoundBreakpoints(out boundBreakpoints));

            uint count;

            ErrorHandler.ThrowOnFailure(boundBreakpoints.GetCount(out count));

            IDebugBoundBreakpoint2[] breakpoints = new IDebugBoundBreakpoint2[count];
            uint fetched = 0;

            ErrorHandler.ThrowOnFailure(boundBreakpoints.Next(count, breakpoints, ref fetched));

            return(breakpoints.Take((int)fetched));
        }
Esempio n. 29
0
        public void CreatePendingBreakpoint(IDebugBreakpointRequest2 breakpointRequest,
                                            RemoteTarget target, out IDebugPendingBreakpoint2 pendingBreakpoint)
        {
            taskContext.ThrowIfNotOnMainThread();

            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            breakpointRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo);
            if (requestInfo[0].bpLocation.bpLocationType ==
                (uint)enum_BP_LOCATION_TYPE.BPLT_DATA_STRING)
            {
                pendingBreakpoint = watchpointFactory.Create(Self,
                                                             breakpointRequest, target, debugProgram);
            }
            else
            {
                pendingBreakpoint = pendingBreakpointFactory.Create(
                    Self, debugProgram, breakpointRequest, target);
            }
        }
Esempio n. 30
0
 void Bind(Breakpoint breakpoint)
 {
     using (var breakpointRequest = breakpoint.CreateRequest())
     {
         IDebugPendingBreakpoint2 pendingBreakpoint = null;
         _taskContext.RunOnMainThread(() => HResultChecker.Check(
                                          _debugSessionContext.DebugEngine.CreatePendingBreakpoint(
                                              breakpointRequest, out pendingBreakpoint)));
         breakpoint.PendingBreakpoint            = pendingBreakpoint;
         _pendingToBreakpoint[pendingBreakpoint] = breakpoint;
         HResultChecker.Check(pendingBreakpoint.Enable(1));
         if (pendingBreakpoint.Virtualize(1) != VSConstants.E_NOTIMPL)
         {
             throw new InvalidOperationException("VSFake should be updated to handle " +
                                                 $"{nameof(pendingBreakpoint.Virtualize)}.");
         }
         pendingBreakpoint.Bind();
     }
 }
        public void SetUp()
        {
            string name = "";

            mockBreakpoint         = Substitute.For <RemoteBreakpoint>();
            lineEntry              = new LineEntryInfo();
            mockPendingBreakpoint  = Substitute.For <IDebugPendingBreakpoint2>();
            mockBreakpointLocation = Substitute.For <SbBreakpointLocation>();
            mockAddress            = Substitute.For <SbAddress>();
            mockAddress.GetLineEntry().Returns(lineEntry);
            mockBreakpointLocation.GetHitCount().Returns(HIT_COUNT);
            mockBreakpointLocation.GetLoadAddress().Returns(ADDRESS);
            mockBreakpointLocation.GetBreakpoint().Returns(mockBreakpoint);
            mockBreakpointLocation.GetId().Returns(ID);
            mockBreakpointLocation.GetAddress().Returns(mockAddress);
            mockprogram         = Substitute.For <IDebugProgram2>();
            mockDocumentContext = Substitute.For <IDebugDocumentContext2>();
            mockDocumentContext.GetName(enum_GETNAME_TYPE.GN_NAME, out name).Returns(
                x =>
            {
                x[1] = NAME;
                return(VSConstants.S_OK);
            });
            mockBreakpointResolution   = Substitute.For <IDebugBreakpointResolution2>();
            mockDocumentContextFactory = Substitute.For <DebugDocumentContext.Factory>();
            mockDocumentContextFactory.Create(lineEntry).Returns(mockDocumentContext);
            mockCodeContext        = Substitute.For <IDebugCodeContext2>();
            mockCodeContextFactory = Substitute.For <DebugCodeContext.Factory>();
            mockCodeContextFactory.Create(ADDRESS, NAME,
                                          mockDocumentContext, Guid.Empty).Returns(mockCodeContext);
            mockBreakpointResolutionFactory =
                Substitute.For <DebugBreakpointResolution.Factory>();
            mockBreakpointResolutionFactory.Create(mockCodeContext, mockprogram).Returns(
                mockBreakpointResolution);
            boundBreakpointFactory = new DebugBoundBreakpoint.Factory(mockDocumentContextFactory,
                                                                      mockCodeContextFactory, mockBreakpointResolutionFactory);
            boundBreakpoint = boundBreakpointFactory.Create(
                mockPendingBreakpoint, mockBreakpointLocation, mockprogram, Guid.Empty);
        }
        // Constructor with factories for tests.
        DebugBoundBreakpoint(DebugDocumentContext.Factory documentContextFactory,
                             DebugCodeContext.Factory codeContextFactory,
                             DebugBreakpointResolution.Factory breakpointResolutionFactory,
                             IDebugPendingBreakpoint2 pendingBreakpoint,
                             SbBreakpointLocation breakpointLocation, IDebugProgram2 program,
                             Guid languageGuid)
        {
            _pendingBreakpoint  = pendingBreakpoint;
            _breakpointLocation = breakpointLocation;

            _enabled             = true;
            _deleted             = false;
            _disabledByPassCount = false;

            SbAddress address = breakpointLocation.GetAddress();

            if (address != null)
            {
                LineEntryInfo          lineEntry       = address.GetLineEntry();
                IDebugDocumentContext2 documentContext = null;
                string name = "";

                // |lineEntry| is null if the breakpoint is set on an external function.
                if (lineEntry != null)
                {
                    documentContext = documentContextFactory.Create(lineEntry);
                    documentContext.GetName(enum_GETNAME_TYPE.GN_NAME, out name);
                }
                IDebugCodeContext2 codeContext = codeContextFactory.Create(
                    breakpointLocation.GetLoadAddress(), name, documentContext, languageGuid);
                _breakpointResolution = breakpointResolutionFactory.Create(codeContext, program);
            }
            else
            {
                Trace.WriteLine("Warning: Unable to obtain address from breakpoint location." +
                                " No breakpoint resolution created.");
            }
        }
Esempio n. 33
0
 int IDebugBreakpointBoundEvent2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBP)
 {
     ppPendingBP = m_pendingBreakpoint;
     return VSConstants.S_OK;
 }
Esempio n. 34
0
 int IDebugEngine2.CreatePendingBreakpoint(IDebugBreakpointRequest2 pBPRequest, out IDebugPendingBreakpoint2 ppPendingBP) {
     ppPendingBP = new AD7PendingBreakpoint(this, pBPRequest);
     return VSConstants.S_OK;
 }
Esempio n. 35
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;
        }
Esempio n. 36
0
 public int GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
 {
     Log.Debug("ScriptBreakpoint: GetPendingBreakpoint");
     ppPendingBreakpoint = this;
     return VSConstants.S_OK;
 }
Esempio n. 37
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    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;
      }
    }
Esempio n. 38
0
 public int GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
 {
     ppPendingBreakpoint = _pending;
     return Constants.S_OK;
 }
 int IDebugBoundBreakpoint2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
 {
   Debug.WriteLine("AD7Breakpoint: GetPendingBreakpoint");
   ppPendingBreakpoint = this;
   return VSConstants.S_OK;
 }
Esempio n. 40
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;
 }
Esempio n. 41
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);

            _breakpointManager.CreatePendingBreakpoint(pBpRequest, out ppPendingBp);

            return VSConstants.S_OK;
        }
Esempio n. 42
0
 /// <summary>
 /// Gets the pending breakpoint from which the specified bound breakpoint was created.
 /// </summary>
 /// <param name="ppPendingBreakpoint">Returns the IDebugPendingBreakpoint2 object that represents the pending breakpoint that was used to create this bound breakpoint.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 /// <remarks>A pending breakpoint can be thought of as a collection of all the necessary information needed to bind a breakpoint to code that can be applied to one or many programs.</remarks>
 public virtual int GetPendingBreakpoint( out IDebugPendingBreakpoint2 ppPendingBreakpoint )
 {
     Logger.Debug( string.Empty );
     ppPendingBreakpoint = null;
     return VSConstants.E_NOTIMPL;
 }
Esempio n. 43
0
 int IDebugErrorBreakpoint2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint) {
     ppPendingBreakpoint = m_pendingBreakpoint;
     return VSConstants.S_OK;
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int CreatePendingBreakpoint (IDebugBreakpointRequest2 breakpointRequest, out IDebugPendingBreakpoint2 pendingBreakpoint)
    {
      // 
      // Construct and register new pending breakpoint.
      // 

      LoggingUtils.PrintFunction ();

      try
      {
        DebuggeeBreakpointPending breakpoint = null;

        BP_REQUEST_INFO [] requestInfo = new BP_REQUEST_INFO [1];

        LoggingUtils.RequireOk (breakpointRequest.GetRequestInfo (enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));

        long locationType = requestInfo [0].bpLocation.bpLocationType & (long) enum_BP_LOCATION_TYPE.BPLT_LOCATION_TYPE_MASK;

        if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_FILE_LINE) != 0)
        {
          // 
          // Query the associated document extension, and create a respective pending breakpoint type.
          // 

          string fileName;

          IDebugDocumentPosition2 documentPostion = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown (requestInfo [0].bpLocation.unionmember2);

          LoggingUtils.RequireOk (documentPostion.GetFileName (out fileName));

          string fileExtension = Path.GetExtension (fileName).ToLower ();

          switch (fileExtension)
          {
            case ".c":
            case ".cpp":
            case ".h":
            case ".hpp":
            case ".asm":
            case ".inl":
            {
              breakpoint = new CLangDebuggeeBreakpointPending (Engine.NativeDebugger, this, breakpointRequest);

              break;
            }

            case ".java":
            {
              throw new NotImplementedException ();
            }

            default:
            {
              breakpoint = new DebuggeeBreakpointPending (this, breakpointRequest);

              break;
            }
          }
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_FUNC_OFFSET) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_CONTEXT) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_STRING) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_ADDRESS) != 0)
        {
          throw new NotImplementedException ();
        }
        else if ((locationType & (long) enum_BP_LOCATION_TYPE.BPLT_RESOLUTION) != 0)
        {
          throw new NotImplementedException ();
        }
        else
        {
          throw new NotImplementedException ();
        }

        lock (m_pendingBreakpoints)
        {
          m_pendingBreakpoints.Add (breakpoint);
        }

        pendingBreakpoint = (IDebugPendingBreakpoint2)breakpoint;

        SetDirty (true);

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

        pendingBreakpoint = null;

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

        pendingBreakpoint = null;

        return Constants.E_FAIL;
      }
    }
 int IDebugErrorBreakpoint2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
 {
   Debug.WriteLine("AD7DebugErrorBreakpoint: GetPendingBreakpoint");
   ppPendingBreakpoint = ( IDebugPendingBreakpoint2 )bp;
   return VSConstants.S_OK;
 }
 /// <summary>
 /// Gets the pending breakpoint that is being bound.
 /// </summary>
 /// <param name="ppPendingBP">Returns the IDebugPendingBreakpoint2 object that represents the pending breakpoint being bound.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 public int GetPendingBreakpoint( out IDebugPendingBreakpoint2 ppPendingBP )
 {
     ppPendingBP = PendingBreakpoint;
     return VSConstants.S_OK;
 }
Esempio n. 47
0
 // Return the pending breakpoint for this bound breakpoint.
 int IDebugBoundBreakpoint2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBreakpoint)
 {
     ppPendingBreakpoint = _pendingBreakpoint;
     return Constants.S_OK;
 }
Esempio n. 48
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;
        }
Esempio n. 49
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;
        }
      public BreakpointBound (IDebugPendingBreakpoint2 pendingBreakpoint, IDebugBoundBreakpoint2 boundBreakpoint)
      {
        m_pendingBreakpoint = pendingBreakpoint;

        m_boundBreakpoint = boundBreakpoint;
      }
Esempio n. 51
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();
        }
      int IDebugBreakpointBoundEvent2.GetPendingBreakpoint (out IDebugPendingBreakpoint2 ppPendingBP)
      {
        LoggingUtils.PrintFunction ();

        ppPendingBP = m_pendingBreakpoint;

        return Constants.S_OK;
      }
Esempio n. 53
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;
        }
Esempio n. 54
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;
 }
Esempio n. 55
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)
        {
            ppPendingBP = null;

            try {
                var pendingBreakpoint = new AD7PendingBreakpoint(pBPRequest, this);
                m_pendingBreakpoints.Add(pendingBreakpoint);
                ppPendingBP = pendingBreakpoint;
            } catch (Exception e) {
                return EngineUtils.UnexpectedException(e);
            }

            return Constants.S_OK;
        }
Esempio n. 56
0
 int IDebugBreakpointBoundEvent2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBP)
 {
     return ((IDebugBoundBreakpoint2)m_boundBreakpoint).GetPendingBreakpoint(out ppPendingBP);
 }
Esempio n. 57
0
 int IDebugBreakpointBoundEvent2.GetPendingBreakpoint(out IDebugPendingBreakpoint2 ppPendingBP)
 {
     ppPendingBP = _breakpoint;
     return(VSConstants.S_OK);
 }
Esempio n. 58
0
 // 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);
     }
 }
Esempio n. 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) {
            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;
        }
Esempio n. 60
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 = (IDebugPendingBreakpoint2)pendingBreakpoint;
     mPendingBPs.Add(pendingBreakpoint);
 }