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;
        }
        // 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 TextPositionInfo(BP_REQUEST_INFO reqInfo)
        {
            IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)Marshal.GetObjectForIUnknown(reqInfo.bpLocation.unionmember2);

            Create(docPosition);
            Marshal.ReleaseComObject(docPosition);
        }
        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 #5
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;
        }
        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);
        }
        /// <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;
        }
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;
        }
        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);
            }
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public int GetRequestInfo (enum_BPREQI_FIELDS dwFields, BP_REQUEST_INFO [] pBPRequestInfo)
    {
      LoggingUtils.PrintFunction ();

      pBPRequestInfo [0] = m_requestInfo;

      return Constants.S_OK;
    }
        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 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;
 }
Beispiel #14
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;
    }
 // 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];
 }
Beispiel #16
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];
        }
        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 #18
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];
        }
Beispiel #19
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));
            m_bpRequestInfo = requestInfo[0];

            m_engine           = engine;
            m_bpManager        = bpManager;
            m_boundBreakpoints = new System.Collections.Generic.List <AD7BoundBreakpoint>();
        }
Beispiel #20
0
        public PendingBreakpoint(BreakpointManager manager, BasmBreakpointBackend backend, EngineCallbacks callbacks, IDebugBreakpointRequest2 pBPRequest)
        {
            _manager   = manager;
            _backend   = backend;
            _callbacks = callbacks;
            _bpRequest = pBPRequest;

            BP_REQUEST_INFO[] requestInfo = new BP_REQUEST_INFO[1];
            EngineUtils.RequireOk(_bpRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION, requestInfo));
            _requestInfo = requestInfo[0];
        }
Beispiel #21
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 #22
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;
        }
 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 #25
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;
        }
Beispiel #26
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;
        }
Beispiel #27
0
        public AD7PendingBreakpoint(IDebugBreakpointRequest2 pBpRequest, AD7Engine engine, BreakpointManager bpManager)
        {
            this._bpRequest = pBpRequest;
            var requestInfo = new BP_REQUEST_INFO[1];

            EngineUtils.CheckOk(this._bpRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_BPLOCATION | enum_BPREQI_FIELDS.BPREQI_CONDITION | enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));
            this._bpRequestInfo = requestInfo[0];

            this._engine    = engine;
            this._bpManager = bpManager;

            this._enabled = true;
            this._deleted = false;
        }
Beispiel #28
0
            public BreakpointCondition(BP_REQUEST_INFO requestInfo)
            {
                bool variableConditionIsSet =
                    (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0;

                VariableCondition = variableConditionIsSet
                    ? requestInfo.bpCondition
                    : (BP_CONDITION?)null;
                bool passCountIsSet =
                    (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0;

                PassCount = passCountIsSet
                    ? requestInfo.bpPassCount
                    : (BP_PASSCOUNT?)null;
            }
Beispiel #29
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 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;
        }
        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 #32
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);
            }
        }
        public void SetUp()
        {
            var taskContext = new JoinableTaskContext();

            mockBreakpointManager = Substitute.For <IBreakpointManager>();
            mockBreakpointRequest = Substitute.For <IDebugBreakpointRequest2>();
            mockProgram           = Substitute.For <IDebugProgram2>();
            mockResolution        = Substitute.For <IDebugBreakpointResolution2>();
            mockResolutionFactory = Substitute.For <DebugWatchpointResolution.Factory>();
            mockResolutionFactory.Create(TEST_ADDRESS_STR, mockProgram).Returns(mockResolution);
            mockTarget = Substitute.For <RemoteTarget>();
            SbError error;

            mockError = Substitute.For <SbError>();
            mockTarget.WatchAddress(TEST_ADDRESS, WATCH_SIZE, false, true, out error).Returns(x =>
            {
                x[4] = mockError;
                return(mockLldbWatchpoint);
            });
            mockMarshal = Substitute.For <Marshal>();
            mockMarshal.GetStringFromIntPtr(Arg.Any <IntPtr>()).Returns(TEST_ADDRESS_STR);
            mockLldbWatchpoint = Substitute.For <SbWatchpoint>();
            requestInfo        = new BP_REQUEST_INFO();
            requestInfo.bpLocation.unionmember4 = (IntPtr)4;
            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]));
            });
            mockLldbWatchpoint.GetId().Returns(EXPECTED_ID);
            SetBreakpointType(enum_BP_LOCATION_TYPE.BPLT_DATA_STRING);

            watchpointFactory = new DebugWatchpoint.Factory(taskContext, mockResolutionFactory,
                                                            new BreakpointErrorEnumFactory(), new BoundBreakpointEnumFactory());
            watchpoint = watchpointFactory.Create(mockBreakpointManager, mockBreakpointRequest,
                                                  mockTarget, mockProgram, mockMarshal);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebuggeeBreakpointPending(DebugBreakpointManager breakpointManager, IDebugBreakpointRequest2 breakpointRequest)
        {
            m_breakpointManager = breakpointManager;

            m_breakpointRequest = breakpointRequest;

            BP_REQUEST_INFO [] requestInfo = new BP_REQUEST_INFO [1];

            LoggingUtils.RequireOk(m_breakpointRequest.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo));

            m_breakpointRequestInfo = requestInfo [0];

            m_boundBreakpoints = new List <IDebugBoundBreakpoint2> ();

            m_errorBreakpoints = new List <IDebugErrorBreakpoint2> ();

            m_breakpointEnabled = true;

            m_breakpointDeleted = false;
        }
Beispiel #35
0
        public int GetRequestInfo(enum_BPREQI_FIELDS fields, BP_REQUEST_INFO[] requestInfo)
        {
            if (requestInfo.Length != 1)
            {
                throw new ArgumentException($"Expected {nameof(requestInfo)} to have " +
                                            $"length = 1; was {requestInfo.Length}.");
            }

            var info = new BP_REQUEST_INFO()
            {
                bpLocation = new BP_LOCATION()
                {
                    bpLocationType = (int)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE,
                    unionmember2   = docPosition
                },
                bpPassCount = new BP_PASSCOUNT()
                {
                    dwPassCount = 1
                }
            };

            requestInfo[0] = info;
            return(VSConstants.S_OK);
        }
 private int BuildBreakpointRequestInfo(enum_BPREQI_FIELDS fields,
                                        out BP_REQUEST_INFO breakpointRequestInfo)
 {
     breakpointRequestInfo = new BP_REQUEST_INFO();
     if ((fields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0 &&
         (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) != 0)
     {
         breakpointRequestInfo.dwFields  |= enum_BPREQI_FIELDS.BPREQI_BPLOCATION;
         breakpointRequestInfo.bpLocation = requestInfo.bpLocation;
     }
     if ((fields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0 &&
         (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0)
     {
         breakpointRequestInfo.dwFields   |= enum_BPREQI_FIELDS.BPREQI_CONDITION;
         breakpointRequestInfo.bpCondition = requestInfo.bpCondition;
     }
     if ((fields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0 &&
         (requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0)
     {
         breakpointRequestInfo.dwFields   |= enum_BPREQI_FIELDS.BPREQI_PASSCOUNT;
         breakpointRequestInfo.bpPassCount = requestInfo.bpPassCount;
     }
     return(0);
 }
        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);
                }
            }
        }
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    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;
      }
    }
Beispiel #39
0
        /// <summary>
        /// AD7BoundBreakpoint constructor for file/line breaks.
        /// </summary>
        /// <param name="engine"> AD7 Engine. </param>
        /// <param name="bpReqInfo"> Contains the information required to implement a breakpoint. </param>
        /// <param name="pendingBreakpoint"> Associated pending breakpoint. </param>
        public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7PendingBreakpoint pendingBreakpoint)
        {
            if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                string documentName;

                // Get Decument Position and File Name
                IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2));
                docPosition.GetFileName(out documentName);

                // Need to shorten the path we send to GDB.
                StringBuilder shortPath = new StringBuilder(1024);
                GetShortPathName(documentName, shortPath, shortPath.Capacity);

                // Get the location in the document that the breakpoint is in.
                TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
                TEXT_POSITION[] endPosition   = new TEXT_POSITION[1];
                docPosition.GetRange(startPosition, endPosition);

                m_engine         = engine;
                m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE;
                m_filename       = shortPath.ToString();
                m_line           = startPosition[0].dwLine + 1;

                m_pendingBreakpoint = pendingBreakpoint;
                m_enabled           = true;
                m_deleted           = false;
                m_hitCount          = 0;
                m_remoteID          = m_engine.BPMgr.RemoteAdd(this);
            }
            else if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET)
            {
                string func;

                IDebugFunctionPosition2 funcPosition = (IDebugFunctionPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2));
                funcPosition.GetFunctionName(out func);

                m_engine            = engine;
                m_func              = func;
                m_enabled           = true;
                m_deleted           = false;
                m_hitCount          = 0;
                m_bpLocationType    = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET;
                m_pendingBreakpoint = pendingBreakpoint;
                m_remoteID          = m_engine.BPMgr.RemoteAdd(this);
            }

//            if ((m_remoteID == 0) && (VSNDK.AddIn.VSNDKAddIn.isDebugEngineRunning == false))
            if (m_remoteID == 0)
            {
                return;
            }

            // Set the hit count and condition
            if (bpReqInfo.bpPassCount.stylePassCount != enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_NONE)
            {
                SetPassCount(bpReqInfo.bpPassCount);
            }
            if (bpReqInfo.bpCondition.styleCondition != enum_BP_COND_STYLE.BP_COND_NONE)
            {
                SetCondition(bpReqInfo.bpCondition);
            }

            // Get the Line Position sent back from GDB
            TEXT_POSITION tpos = new TEXT_POSITION();

            tpos.dwLine = m_GDB_linePos - 1;

            uint xAddress = UInt32.Parse(m_GDB_Address.Substring(2), System.Globalization.NumberStyles.HexNumber);

            AD7MemoryAddress   codeContext     = new AD7MemoryAddress(m_engine, xAddress);
            AD7DocumentContext documentContext = new AD7DocumentContext(m_GDB_filename, tpos, tpos, codeContext);

            m_breakpointResolution = new AD7BreakpointResolution(m_engine, xAddress, documentContext);

            m_engine.Callback.OnBreakpointBound(this, 0);
        }
        /// <summary> 
        /// AD7BoundBreakpoint constructor for file/line breaks. 
        /// </summary>
        /// <param name="engine"> AD7 Engine. </param>
        /// <param name="bpReqInfo"> Contains the information required to implement a breakpoint. </param>
        /// <param name="pendingBreakpoint"> Associated pending breakpoint. </param>
        public AD7BoundBreakpoint(AD7Engine engine, BP_REQUEST_INFO bpReqInfo, AD7PendingBreakpoint pendingBreakpoint)
        {
            if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                string documentName;

                // Get Decument Position and File Name
                IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2));
                docPosition.GetFileName(out documentName);

                // Need to shorten the path we send to GDB.
                StringBuilder shortPath = new StringBuilder(1024);
                GetShortPathName(documentName, shortPath, shortPath.Capacity);

                // Get the location in the document that the breakpoint is in.
                TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
                TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
                docPosition.GetRange(startPosition, endPosition);

                m_engine = engine;
                m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE;
                m_filename = shortPath.ToString();
                m_line = startPosition[0].dwLine + 1;

                m_pendingBreakpoint = pendingBreakpoint;
                m_enabled = true;
                m_deleted = false;
                m_hitCount = 0;
                m_remoteID = m_engine.BPMgr.RemoteAdd(this);
            }
            else if (bpReqInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET)
            {
                string func;

                IDebugFunctionPosition2 funcPosition = (IDebugFunctionPosition2)(Marshal.GetObjectForIUnknown(bpReqInfo.bpLocation.unionmember2));
                funcPosition.GetFunctionName(out func);

                m_engine = engine;
                m_func = func;
                m_enabled = true;
                m_deleted = false;
                m_hitCount = 0;
                m_bpLocationType = (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET;
                m_pendingBreakpoint = pendingBreakpoint;
                m_remoteID = m_engine.BPMgr.RemoteAdd(this);
            }

            //            if ((m_remoteID == 0) && (VSNDK.AddIn.VSNDKAddIn.isDebugEngineRunning == false))
            if (m_remoteID == 0)
            {
                return;
            }

            // Set the hit count and condition
            if (bpReqInfo.bpPassCount.stylePassCount != enum_BP_PASSCOUNT_STYLE.BP_PASSCOUNT_NONE)
                SetPassCount(bpReqInfo.bpPassCount);
            if (bpReqInfo.bpCondition.styleCondition != enum_BP_COND_STYLE.BP_COND_NONE)
                SetCondition(bpReqInfo.bpCondition);

            // Get the Line Position sent back from GDB
            TEXT_POSITION tpos = new TEXT_POSITION();
            tpos.dwLine = m_GDB_linePos - 1;

            uint xAddress = UInt32.Parse(m_GDB_Address.Substring(2), System.Globalization.NumberStyles.HexNumber);

            AD7MemoryAddress codeContext = new AD7MemoryAddress(m_engine, xAddress);
            AD7DocumentContext documentContext = new AD7DocumentContext(m_GDB_filename, tpos, tpos, codeContext);

            m_breakpointResolution = new AD7BreakpointResolution(m_engine, xAddress, documentContext);

            m_engine.Callback.OnBreakpointBound(this, 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;
        }
Beispiel #42
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        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.
                    //

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

                    LoggingUtils.RequireOk(documentPostion.GetFileName(out string 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);
            }
        }
        // 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 #44
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;
        }
Beispiel #45
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);
        }