Ejemplo n.º 1
0
        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);
        }
 // 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];
 }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    #region IDebugBreakpointRequest2 Members

    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int GetLocationType (enum_BP_LOCATION_TYPE [] pBPLocationType)
    {
      LoggingUtils.PrintFunction ();

      if ((m_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0)
      {
        pBPLocationType [0] = (enum_BP_LOCATION_TYPE) m_requestInfo.bpLocation.bpLocationType;

        return Constants.S_OK;
      }

      return Constants.E_FAIL;
    }
Ejemplo n.º 4
0
        private int SetBreakpoint()
        {
            if (IsDeleted)
            {
                return(HResults.E_BP_DELETED);
            }

            // Get breakpoint type
            var typeArr = new enum_BP_LOCATION_TYPE[1];

            if (ErrorHandler.Failed(request.GetLocationType(typeArr)))
            {
                return(VSConstants.E_INVALIDARG);
            }
            var type = typeArr[0];

            // Get info
            var infoArr = new BP_REQUEST_INFO[1];

            if (ErrorHandler.Failed(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, infoArr)))
            {
                return(VSConstants.E_INVALIDARG);
            }
            var info = infoArr[0];

            // See http://msdn.microsoft.com/en-us/library/bb162191.aspx

            if (type == enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                // Document position
                var    documentPosition = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(info.bpLocation.unionmember2);
                string fileName;
                if (ErrorHandler.Failed(documentPosition.GetFileName(out fileName)))
                {
                    return(VSConstants.E_INVALIDARG);
                }
                var beginPosition = new TEXT_POSITION[1];
                var endPosition   = new TEXT_POSITION[1];
                if (ErrorHandler.Failed(documentPosition.GetRange(beginPosition, endPosition)))
                {
                    return(VSConstants.E_INVALIDARG);
                }

                // Set breakpoint
                var program = engine.Program;
                if (program == null)
                {
                    return(VSConstants.E_INVALIDARG);
                }

                // Convert positions
                var startLine = beginPosition[0].dwLine + 1;
                var startCol  = beginPosition[0].dwColumn + 1;
                var endLine   = endPosition[0].dwLine + 1;
                var endCol    = endPosition[0].dwColumn + 1;

                program.BreakpointManager.SetAtLocation(fileName, (int)startLine, (int)startCol, (int)endLine, (int)endCol, this);
            }

            return(VSConstants.S_OK);
        }
Ejemplo n.º 5
0
        private int SetBreakpoint()
        {
            if (IsDeleted)
                return HResults.E_BP_DELETED;

            // Get breakpoint type
            var typeArr = new enum_BP_LOCATION_TYPE[1];
            if (ErrorHandler.Failed(request.GetLocationType(typeArr)))
                return VSConstants.E_INVALIDARG;
            var type = typeArr[0];

            // Get info
            var infoArr = new BP_REQUEST_INFO[1];
            if (ErrorHandler.Failed(request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, infoArr)))
                return VSConstants.E_INVALIDARG;
            var info = infoArr[0];

            // Set breakpoint
            var program = engine.Program;
            if (program == null)
                return VSConstants.E_INVALIDARG;

            // See http://msdn.microsoft.com/en-us/library/bb162191.aspx

            if (type == enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                // Document position
                var documentPosition = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(info.bpLocation.unionmember2);
                string fileName;
                if (ErrorHandler.Failed(documentPosition.GetFileName(out fileName)))
                    return VSConstants.E_INVALIDARG;
                var beginPosition = new TEXT_POSITION[1];
                var endPosition = new TEXT_POSITION[1];
                if (ErrorHandler.Failed(documentPosition.GetRange(beginPosition, endPosition)))
                    return VSConstants.E_INVALIDARG;

                // Convert positions
                var startLine = beginPosition[0].dwLine + 1;
                var startCol = beginPosition[0].dwColumn + 1;
                var endLine = endPosition[0].dwLine + 1;
                var endCol = endPosition[0].dwColumn + 1;

                program.BreakpointManager.SetAtLocation(fileName, (int)startLine, (int)startCol, (int)endLine, (int)endCol, this);
                return VSConstants.S_OK;
            }

            if (type == enum_BP_LOCATION_TYPE.BPLT_CODE_CONTEXT)
            {
                var codeContext = Marshal.GetObjectForIUnknown(info.bpLocation.unionmember1) as DebugCodeContext;
                if (codeContext != null)
                {
                    var boundBreakpoint = new DebugBoundBreakpoint<DebugLocationBreakpoint>(this,
                                                    program.BreakpointManager, enum_BP_TYPE.BPT_CODE,
                                                    x =>
                                                    {
                                                        var docLocation = codeContext.DocumentContext != null
                                                                            ? codeContext.DocumentContext.DocumentLocation
                                                                            : null;
                                                        return new DebugLocationBreakpoint(codeContext.Location, x,
                                                                                           docLocation);
                                                    });
                    program.BreakpointManager.SetBreakpoint(boundBreakpoint.Breakpoint);
                    return VSConstants.S_OK;
                }
            }

            return VSConstants.E_NOTIMPL;
        }
Ejemplo n.º 6
0
 // Update the mock breakpoint request to return a specific breakpoint type.  This must be
 // called before constructing the pending breakpoint.
 private void SetBreakpointType(enum_BP_LOCATION_TYPE type)
 {
     requestInfo.dwFields |= enum_BPREQI_FIELDS.BPREQI_BPLOCATION;
     requestInfo.bpLocation.bpLocationType = (uint)type;
 }