Пример #1
0
        public int Bind()
        {
            if (_requestInfo.bpLocation.bpLocationType !=
                (uint)enum_BP_LOCATION_TYPE.BPLT_DATA_STRING)
            {
                SetError(enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _watchpointNotSupported);
                return(VSConstants.S_FALSE);
            }
            string dataExpression =
                _marshal.GetStringFromIntPtr(_requestInfo.bpLocation.unionmember3);
            uint size = (uint)_requestInfo.bpLocation.unionmember4;

            _lldbWatchpoint =
                _target.WatchAddress(Convert.ToInt64(dataExpression, 16), size, false /* read */,
                                     true /* write */, out SbError error);
            if (error.Fail())
            {
                SetError(enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, error.GetCString());
                return(VSConstants.S_FALSE);
            }

            _lldbWatchpoint.SetEnabled(_enabled);
            if ((_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0)
            {
                SetCondition(_requestInfo.bpCondition);
            }
            if ((_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_PASSCOUNT) != 0)
            {
                SetPassCount(_requestInfo.bpPassCount);
            }
            _resolution = _resolutionFactory.Create(dataExpression, _program);
            _breakpointManager.RegisterWatchpoint(Self);
            return(VSConstants.S_OK);
        }
Пример #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebuggeeBreakpointBound(DebugBreakpointManager breakpointManager, DebuggeeBreakpointPending pendingBreakpoint, DebuggeeCodeContext codeContext)
        {
            if (breakpointManager == null)
            {
                throw new ArgumentNullException("breakpointManager");
            }

            if (pendingBreakpoint == null)
            {
                throw new ArgumentNullException("pendingBreakpoint");
            }

            if (codeContext == null)
            {
                throw new ArgumentNullException("codeContext");
            }

            m_breakpointManager = breakpointManager;

            m_pendingBreakpoint = pendingBreakpoint;

            m_codeContext = codeContext;

            m_breakpointResolution = new DebuggeeBreakpointResolution(m_codeContext, "<bound breakpoint>");

            m_breakpointEnabled = true;

            m_breakpointDeleted = false;

            m_hitCount = 0;
        }
        public int GetBreakpointResolution(out IDebugBreakpointResolution2 resolution)
        {
            if (_deleted)
            {
                resolution = null;
                return(AD7Constants.E_BP_DELETED);
            }

            resolution = _resolution;
            return(VSConstants.S_OK);
        }
Пример #4
0
 public void SetUp()
 {
     mockCodeContext = Substitute.For <IDebugCodeContext2>();
     mockProgram     = Substitute.For <IDebugProgram2>();
     expectedResolutionInfo.dwFields = enum_BPRESI_FIELDS.BPRESI_BPRESLOCATION |
                                       enum_BPRESI_FIELDS.BPRESI_PROGRAM;
     expectedResolutionInfo.bpResLocation.bpType       = (uint)enum_BP_TYPE.BPT_CODE;
     expectedResolutionInfo.bpResLocation.unionmember1 =
         Marshal.GetComInterfaceForObject(
             mockCodeContext, typeof(IDebugCodeContext2));
     expectedResolutionInfo.pProgram = mockProgram;
     breakpointResolution            = new DebugBreakpointResolution.Factory().Create(
         mockCodeContext, mockProgram);
 }
Пример #5
0
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 breakpointResolution)
 {
     breakpointResolution = null;
     if (_deleted)
     {
         return(AD7Constants.E_BP_DELETED);
     }
     if (_breakpointResolution == null)
     {
         return(VSConstants.E_FAIL);
     }
     breakpointResolution = _breakpointResolution;
     return(VSConstants.S_OK);
 }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public DebuggeeBreakpointBound(DebugBreakpointManager breakpointManager, DebuggeeBreakpointPending pendingBreakpoint, DebuggeeCodeContext codeContext)
        {
            m_breakpointManager = breakpointManager ?? throw new ArgumentNullException(nameof(breakpointManager));

            m_pendingBreakpoint = pendingBreakpoint ?? throw new ArgumentNullException(nameof(pendingBreakpoint));

            m_codeContext = codeContext ?? throw new ArgumentNullException(nameof(codeContext));

            m_breakpointResolution = new DebuggeeBreakpointResolution(m_codeContext, "<bound breakpoint>");

            m_breakpointEnabled = true;

            m_breakpointDeleted = false;

            m_hitCount = 0;
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public virtual int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
        {
            //
            // Gets the breakpoint resolution that describes this breakpoint.
            //

            LoggingUtils.PrintFunction();

            ppBPResolution = m_breakpointResolution;

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

            return(Constants.S_OK);
        }
        public BreakpointLocationResolution(BP_LOCATION location, bool releaseComObjects)
        {
            Contract.Requires<ArgumentException>((enum_BP_LOCATION_TYPE)location.bpLocationType == enum_BP_LOCATION_TYPE.BPLT_RESOLUTION);

            try
            {
                if (location.unionmember1 != IntPtr.Zero)
                    _resolution = Marshal.GetObjectForIUnknown(location.unionmember1) as IDebugBreakpointResolution2;
            }
            finally
            {
                if (releaseComObjects)
                {
                    if (location.unionmember1 != IntPtr.Zero)
                        Marshal.Release(location.unionmember1);
                }
            }
        }
Пример #9
0
        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 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);
        }
        public BreakpointLocationResolution(BP_LOCATION location, bool releaseComObjects)
        {
            Contract.Requires <ArgumentException>((enum_BP_LOCATION_TYPE)location.bpLocationType == enum_BP_LOCATION_TYPE.BPLT_RESOLUTION);

            try
            {
                if (location.unionmember1 != IntPtr.Zero)
                {
                    _resolution = Marshal.GetObjectForIUnknown(location.unionmember1) as IDebugBreakpointResolution2;
                }
            }
            finally
            {
                if (releaseComObjects)
                {
                    if (location.unionmember1 != IntPtr.Zero)
                    {
                        Marshal.Release(location.unionmember1);
                    }
                }
            }
        }
Пример #12
0
        // 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.");
            }
        }
Пример #13
0
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     ppBPResolution = null;
     return(VSConstants.E_NOTIMPL);
 }
Пример #14
0
 /// <summary>
 /// Gets the pending breakpoint from which the specified bound breakpoint was created.
 /// </summary>
 /// <param name="ppBPResolution">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 GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     Logger.Debug(string.Empty);
     ppBPResolution = null;
     return(VSConstants.E_NOTIMPL);
 }
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     throw new NotImplementedException();
 }
Пример #16
0
 /// <summary>
 /// Gets the pending breakpoint from which the specified bound breakpoint was created.
 /// </summary>
 /// <param name="ppBPResolution">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 GetBreakpointResolution( out IDebugBreakpointResolution2 ppBPResolution )
 {
     Logger.Debug( string.Empty );
     ppBPResolution = null;
     return VSConstants.E_NOTIMPL;
 }
Пример #17
0
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 breakpointResolution)
 {
     breakpointResolution = this.breakpointResolution;
     return(VSConstants.S_OK);
 }
Пример #18
0
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugBoundBreakpoint.GetBreakpointResolution");
     ppBPResolution = resolution;
     return(IsDeleted ? HResults.E_BP_DELETED : VSConstants.S_OK);
 }
Пример #19
0
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     Log.Debug("ScriptBreakpoint: GetBreakpointResolution");
     ppBPResolution = this;
     return VSConstants.S_OK;
 }
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
   Debug.WriteLine("AD7Breakpoint: GetBreakpointResolution");
   ppBPResolution = this;
   return VSConstants.S_OK;
 }
Пример #21
0
 // Return the breakpoint resolution which describes how the breakpoint bound in the debuggee.
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     ppBPResolution = _breakpointResolution;
     return Constants.S_OK;
 }
Пример #22
0
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution) {
     ppBPResolution = null;
     return VSConstants.E_NOTIMPL;
 }
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     Log.Debug("ScriptBreakpoint: GetBreakpointResolution");
     ppBPResolution = this;
     return(VSConstants.S_OK);
 }
Пример #24
0
 // Token: 0x06000035 RID: 53 RVA: 0x00002E1C File Offset: 0x0000101C
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     ppBPResolution = this.Resolution;
     return(0);
 }
Пример #25
0
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     ppBPResolution = this;
     return(VSConstants.S_OK);
 }
Пример #26
0
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     ppBPResolution = this;
     return VSConstants.S_OK;
 }
Пример #27
0
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     Debug.WriteLine("AD7Breakpoint: GetBreakpointResolution");
     ppBPResolution = this;
     return(VSConstants.S_OK);
 }
 /// <summary>
 ///     Gets the breakpoint resolution that describes this breakpoint.
 /// </summary>
 /// <param name="breakpointResolution">The breakpoint resolution.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code.</returns>
 public int GetBreakpointResolution(out IDebugBreakpointResolution2 breakpointResolution)
 {
     breakpointResolution = _breakpointResolution;
     return(S_OK);
 }
Пример #29
0
        public int GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
        {
            ppBPResolution = _resolution;

            return(S_OK);
        }
Пример #30
0
 // Return the breakpoint resolution which describes how the breakpoint bound in the debuggee.
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBPResolution)
 {
     ppBPResolution = _breakpointResolution;
     return(Constants.S_OK);
 }
Пример #31
0
 // Return the breakpoint resolution which describes how the breakpoint bound in the debuggee.
 int IDebugBoundBreakpoint2.GetBreakpointResolution(out IDebugBreakpointResolution2 ppBpResolution)
 {
     ppBpResolution = this._breakpointResolution;
     return(VSConstants.S_OK);
 }