Esempio n. 1
0
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            Debug.WriteLine("AD7Breakpoint: CanBind");
            int result = VSConstants.S_OK;

            ppErrorEnum = null;
            if (_lineNumber == 0)
            {
                result = FindBreakpointLine();
            }
            if (result != VSConstants.S_OK)
            {
                return(result);
            }
            if (DebuggerManager.Instance.Debugger.CanBindBreakpoint(( int )this._lineNumber))
            {
                ppErrorEnum = null;
                return(VSConstants.S_OK);
            }
            else
            {
                // TODO: Can also return deleted breakpoint, see constant E_BP_DELETED
                Ad7EnumDebugErrorBreakpoints enumBp = new Ad7EnumDebugErrorBreakpoints();
                enumBp.Add(new AD7DebugErrorBreakpoint(this));
                ppErrorEnum = enumBp;
                return(VSConstants.E_FAIL);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            //
            // Determines whether this pending breakpoint can bind to a code location.
            //

            LoggingUtils.PrintFunction();

            ppErrorEnum = null;

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

                if (m_errorBreakpoints.Count > 0)
                {
                    LoggingUtils.RequireOk(EnumErrorBreakpoints(enum_BP_ERROR_TYPE.BPET_ALL, out ppErrorEnum));

                    return(Constants.S_FALSE);
                }

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

                return(Constants.E_FAIL);
            }
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
        {
            //
            // Enumerates all error breakpoints that resulted from this pending breakpoint.
            //

            LoggingUtils.PrintFunction();

            try
            {
                ppEnum = new DebuggeeBreakpointError.Enumerator(m_errorBreakpoints.ToArray());

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

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

                ppEnum = null;

                return(Constants.E_FAIL);
            }
        }
Esempio n. 4
0
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(
     enum_BP_ERROR_TYPE bpErrorType,
     out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     ppEnum = null;
     return(VSConstants.S_OK);
 }
Esempio n. 5
0
        public int CanBind(out IEnumDebugErrorBreakpoints2 errorBreakpointsEnum)
        {
            errorBreakpointsEnum = null;
            if (_deleted)
            {
                return(AD7Constants.E_BP_DELETED);
            }

            bool notDataStringLocation = _requestInfo.bpLocation.bpLocationType !=
                                         (uint)enum_BP_LOCATION_TYPE.BPLT_DATA_STRING;

            bool conditionalWhenChangedBp =
                (_requestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_CONDITION) != 0 &&
                _requestInfo.bpCondition.styleCondition == enum_BP_COND_STYLE.BP_COND_WHEN_CHANGED;

            if (notDataStringLocation || conditionalWhenChangedBp)
            {
                IDebugErrorBreakpoint2[] breakpointErrors = new IDebugErrorBreakpoint2[1];
                breakpointErrors[0] = new DebugBreakpointError(
                    Self, enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _watchpointNotSupported);
                errorBreakpointsEnum = _breakpointErrorEnumFactory.Create(breakpointErrors);
                return(VSConstants.S_FALSE);
            }
            return(VSConstants.S_OK);
        }
Esempio n. 6
0
        int IDebugPendingBreakpoint2.Bind()
        {
            Debug.WriteLine("AD7Breakpoint: Bind");
            enumError = null;

            // set breakpoint line
            int result = FindBreakpointLine();

            if (result != VSConstants.S_OK)
            {
                return(result);
            }

            if (((IDebugPendingBreakpoint2)this).CanBind(out enumError) == VSConstants.S_OK)
            {
                // bind breakpoint
                DebuggerManager.Instance.BindBreakpoint(this);
                _callback.Breakpoint(_node, this);
                return(VSConstants.S_OK);
            }
            else
            {
                IDebugErrorBreakpoint2[] err = new IDebugErrorBreakpoint2[1];
                uint cnt = 0;
                enumError.Reset();
                enumError.Next(1, err, ref cnt);
                enumError.Reset();
                _callback.BreakpointError(_node, err[0]);
                return(VSConstants.S_OK);
            }
        }
Esempio n. 7
0
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE breakpointErrorType,
                                 out IEnumDebugErrorBreakpoints2 errorBreakpointsEnum)
 {
     IDebugErrorBreakpoint2[] breakpointErrors = new IDebugErrorBreakpoint2[1];
     breakpointErrors[0]  = _breakpointError;
     errorBreakpointsEnum = _breakpointErrorEnumFactory.Create(breakpointErrors);
     return(VSConstants.S_OK);
 }
Esempio n. 8
0
 /// <summary>
 /// Determines whether this pending breakpoint can bind to a code location.
 /// </summary>
 public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugPendingBreakpoint.CanBind");
     ppErrorEnum = null;
     if (IsDeleted)
         return HResults.E_BP_DELETED;
     return VSConstants.S_OK;
 }
Esempio n. 9
0
 /// <summary>
 /// Determines whether this pending breakpoint can bind to a code location.
 /// </summary>
 public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugPendingBreakpoint.CanBind");
     ppErrorEnum = null;
     if (IsDeleted)
     {
         return(HResults.E_BP_DELETED);
     }
     return(VSConstants.S_OK);
 }
Esempio n. 10
0
 /// <summary>
 /// Enumerates all error breakpoints that resulted from this pending breakpoint.
 /// </summary>
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugPendingBreakpoint.EnumErrorBreakpoints");
     if (IsDeleted)
     {
         ppEnum = null;
         return(HResults.E_BP_DELETED);
     }
     throw new NotImplementedException();
 }
        public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;
            if (_bpRequestInfo.bpLocation.bpLocationType == (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                return(VSConstants.S_OK);
            }

            return(VSConstants.S_FALSE);
        }
Esempio n. 12
0
        public int CanBind(out IEnumDebugErrorBreakpoints2 error)
        {
            error = null;
            if (isDeleted || requestInfo.bpLocation.bpLocationType != (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                return(VSConstants.S_FALSE);
            }

            return(VSConstants.S_OK);
        }
Esempio n. 13
0
        public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
        {
            if (_deleted)
            {
                ppEnum = null;
                return(AD7Constants.E_BP_DELETED);
            }

            ppEnum = new EnumDebugErrorBreakpoints(_errorBreakpoints);
            return(VSConstants.S_OK);
        }
Esempio n. 14
0
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum) {
            string message = GetBindError();
            if (message == null) {
                ppErrorEnum = null;
                return VSConstants.S_OK;
            }

            var error = new AD7ErrorBreakpoint(this, new AD7ErrorBreakpointResolution(message));
            ppErrorEnum = new AD7ErrorBreakpointEnum(new IDebugErrorBreakpoint2[] { error });
            return VSConstants.S_FALSE;
        }
Esempio n. 15
0
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     if (_errorBreakpoint != null)
     {
         ppEnum = new AD7ErrorBreakpointsEnum(new[] { _errorBreakpoint });
     }
     else
     {
         ppEnum = null;
     }
     return(Constants.S_OK);
 }
Esempio n. 16
0
        // Determines whether this pending breakpoint can bind to a code location.
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;

            if (!CanBind())
            {
                // Called to determine if a pending breakpoint can be bound.
                // The breakpoint may not be bound for many reasons such as an invalid location, an invalid expression, etc...
                // The debugger will display information about why the breakpoint did not bind to the user.
                ppErrorEnum = new AD7ErrorBreakpointsEnum(new[] { this._BPError });
                return(Constants.S_FALSE);
            }

            return(Constants.S_OK);
        }
Esempio n. 17
0
        // Determines whether this pending breakpoint can bind to a code location.
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;

            if (!CanBind())
            {
                // Called to determine if a pending breakpoint can be bound.
                // The breakpoint may not be bound for many reasons such as an invalid location, an invalid expression, etc...
                // The sample engine does not support this, but a real world engine will want to return a valid enumeration of IDebugErrorBreakpoint2.
                // The debugger will then display information about why the breakpoint did not bind to the user.
                return(VSConstants.S_FALSE);
            }

            return(VSConstants.S_OK);
        }
Esempio n. 18
0
 // Token: 0x060000D7 RID: 215 RVA: 0x00004566 File Offset: 0x00002766
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     if (this.error_breakpoint != null)
     {
         ppEnum = new AD7ErrorBreakpointsEnum(new IDebugErrorBreakpoint2[]
         {
             this.error_breakpoint
         });
     }
     else
     {
         ppEnum = new AD7ErrorBreakpointsEnum(new IDebugErrorBreakpoint2[0]);
     }
     return(0);
 }
Esempio n. 19
0
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            string message = GetBindError();

            if (message == null)
            {
                ppErrorEnum = null;
                return(VSConstants.S_OK);
            }

            var error = new AD7ErrorBreakpoint(this, new AD7ErrorBreakpointResolution(message));

            ppErrorEnum = new AD7ErrorBreakpointEnum(new IDebugErrorBreakpoint2[] { error });
            return(VSConstants.S_FALSE);
        }
Esempio n. 20
0
        // Determines whether this pending breakpoint can bind to a code location.
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;

            if (!CanBind())
            {
                // Called to determine if a pending breakpoint can be bound.
                // The breakpoint may not be bound for many reasons such as an invalid location, an invalid expression, etc...
                // TODO: return a valid enumeration of IDebugErrorBreakpoint2. The debugger will then display information about why
                // the breakpoint did not bind to the user.
                ppErrorEnum = null;
                return(VSConstants.S_FALSE);
            }

            return(VSConstants.S_OK);
        }
Esempio n. 21
0
        /// <summary>
        /// Determines whether this pending breakpoint can bind to a code location. (http://msdn.microsoft.com/en-ca/library/bb146753.aspx)
        /// </summary>
        /// <param name="ppErrorEnum"> Returns an IEnumDebugErrorBreakpoints2 object that contains a list of IDebugErrorBreakpoint2
        /// objects if there could be errors. </param>
        /// <returns> If successful, returns S_OK; otherwise, returns S_FALSE </returns>
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;

            if (!CanBind())
            {
                // The breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid
                // expression, etc... The VSNDK debug engine does not support this, but a real world engine will want to send an
                // instance of IDebugBreakpointErrorEvent2 to the UI and return a valid instance of IDebugErrorBreakpoint2 from
                // IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then display information about why the
                // breakpoint did not bind to the user.
                ppErrorEnum = null;
                return(VSConstants.S_FALSE);
            }

            return(VSConstants.S_OK);
        }
        protected Ad7EnumDebugErrorBreakpoints(Ad7EnumDebugErrorBreakpoints enumerator)
        {
            Debug.WriteLine("Ad7EnumDebugErrorBreakpoints: ctor clone");
            IEnumDebugErrorBreakpoints2 e = (IEnumDebugErrorBreakpoints2)enumerator;

            e.Reset();
            _errors = new List <IDebugErrorBreakpoint2>();
            uint cnt;

            e.GetCount(out cnt);
            for (int i = 0; i < cnt; i++)
            {
                IDebugErrorBreakpoint2[] err = new IDebugErrorBreakpoint2[1];
                uint fetched = 1;
                e.Next(1, err, ref fetched);
                _errors.Add(err[0]);
            }
        }
Esempio n. 23
0
        public int CanBind(out IEnumDebugErrorBreakpoints2 errorBreakpointsEnum)
        {
            errorBreakpointsEnum = null;
            if (_deleted)
            {
                return(AD7Constants.E_BP_DELETED);
            }

            // Check the breakpoint type, and make sure it's supported.
            if (IsSupportedType())
            {
                return(VSConstants.S_OK);
            }

            var breakpointErrors = new IDebugErrorBreakpoint2[1];

            breakpointErrors[0] = new DebugBreakpointError(
                Self, enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, _breakpointNotSupported);
            errorBreakpointsEnum = _breakpointErrorEnumFactory.Create(breakpointErrors);
            return(VSConstants.S_FALSE);
        }
Esempio n. 24
0
 // Token: 0x060000D2 RID: 210 RVA: 0x000043A4 File Offset: 0x000025A4
 public int CanBind(out IEnumDebugErrorBreakpoints2 error_breakpoints)
 {
     if (this.error_breakpoint != null)
     {
         error_breakpoints = new AD7ErrorBreakpointsEnum(new IDebugErrorBreakpoint2[]
         {
             this.error_breakpoint
         });
         return(1);
     }
     if (this.Request.LocationType == enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
     {
         if ((this.Request.RequestInfo.dwFields & enum_BPREQI_FIELDS.BPREQI_BPLOCATION) == 0)
         {
             this.error_breakpoint = new ErrorBreakpoint(this, this.process, "Breakpoints of this type are not supported.");
             error_breakpoints     = new AD7ErrorBreakpointsEnum(new IDebugErrorBreakpoint2[]
             {
                 this.error_breakpoint
             });
             return(1);
         }
         error_breakpoints = null;
         return(0);
     }
     else
     {
         if (this.Request.LocationType == enum_BP_LOCATION_TYPE.BPLT_CODE_FUNC_OFFSET)
         {
             this.error_breakpoint = new ErrorBreakpoint(this, this.process, "Function breakpoints are not supported yet, see bug #673920.");
             error_breakpoints     = new AD7ErrorBreakpointsEnum(new IDebugErrorBreakpoint2[]
             {
                 this.error_breakpoint
             });
             return(1);
         }
         error_breakpoints = null;
         return(0);
     }
 }
Esempio n. 25
0
        public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE breakpointErrorType,
                                        out IEnumDebugErrorBreakpoints2 errorBreakpointsEnum)
        {
            errorBreakpointsEnum = null;
            if (_deleted)
            {
                return(AD7Constants.E_BP_DELETED);
            }

            IDebugErrorBreakpoint2[] breakpointErrors;
            if (_breakpointError == null)
            {
                breakpointErrors = new IDebugErrorBreakpoint2[0];
            }
            else
            {
                breakpointErrors    = new IDebugErrorBreakpoint2[1];
                breakpointErrors[0] = _breakpointError;
            }

            errorBreakpointsEnum = _breakpointErrorEnumFactory.Create(breakpointErrors);
            return(VSConstants.S_OK);
        }
Esempio n. 26
0
        // Determines whether this pending breakpoint can bind to a code location.
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum) {
            ppErrorEnum = null;

            if (!CanBind()) {
                // Called to determine if a pending breakpoint can be bound. 
                // The breakpoint may not be bound for many reasons such as an invalid location, an invalid expression, etc...
                // TODO: return a valid enumeration of IDebugErrorBreakpoint2. The debugger will then display information about why
                // the breakpoint did not bind to the user.
                ppErrorEnum = null;
                return VSConstants.S_FALSE;
            }

            return VSConstants.S_OK;
        }
Esempio n. 27
0
        /// <summary>
        /// Determines whether this pending breakpoint can bind to a code location. (http://msdn.microsoft.com/en-ca/library/bb146753.aspx)
        /// </summary>
        /// <param name="ppErrorEnum"> Returns an IEnumDebugErrorBreakpoints2 object that contains a list of IDebugErrorBreakpoint2 
        /// objects if there could be errors. </param>
        /// <returns> If successful, returns S_OK; otherwise, returns S_FALSE </returns>
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;

            if (!CanBind())
            {
                // The breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid
                // expression, etc... The VSNDK debug engine does not support this, but a real world engine will want to send an
                // instance of IDebugBreakpointErrorEvent2 to the UI and return a valid instance of IDebugErrorBreakpoint2 from
                // IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then display information about why the
                // breakpoint did not bind to the user.
                ppErrorEnum = null;
                return VSConstants.S_FALSE;
            }

            return VSConstants.S_OK;
        }
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
   Debug.WriteLine("AD7Breakpoint: EnumErrorBreakpoints");
   if ( ((bpErrorType & enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING) != 0) ||
     (( bpErrorType & enum_BP_ERROR_TYPE.BPET_TYPE_ERROR ) != 0 ))
   {
     ppEnum = enumError;
   }
   else
   {
     ppEnum = null;
   }
   return VSConstants.S_OK;
 }
    int IDebugPendingBreakpoint2.Bind()
    {
      Debug.WriteLine("AD7Breakpoint: Bind");
      enumError = null;
      
      // set breakpoint line
      int result = FindBreakpointLine();
      if (result != VSConstants.S_OK)
        return result;

      if (((IDebugPendingBreakpoint2)this).CanBind(out enumError) == VSConstants.S_OK)
      {
        // bind breakpoint
        DebuggerManager.Instance.BindBreakpoint(this);
        _callback.Breakpoint(_node, this);
        return VSConstants.S_OK;
      }
      else
      {
        IDebugErrorBreakpoint2[] err = new IDebugErrorBreakpoint2[ 1 ];
        uint cnt = 0;
        enumError.Reset();
        enumError.Next(1, err, ref cnt);
        enumError.Reset();
        _callback.BreakpointError(_node, err[0]);
        return VSConstants.S_OK;
      }
    }
 public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     throw new NotImplementedException();
 }
Esempio n. 31
0
 /// <summary>
 /// Gets a list of all error breakpoints that resulted from this pending breakpoint.
 /// </summary>
 /// <param name="bpErrorType">A combination of values from the BP_ERROR_TYPE enumeration that selects the type of errors to enumerate.</param>
 /// <param name="ppEnum">Returns an IEnumDebugErrorBreakpoints2 object that contains a list of IDebugErrorBreakpoint2 objects.</param>
 /// <returns>If successful, returns S_OK; otherwise, returns an error code. Returns E_BP_DELETED if the breakpoint has been deleted.</returns>
 public virtual int EnumErrorBreakpoints( enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum )
 {
     Logger.Debug( string.Empty );
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
Esempio n. 32
0
 /// <summary>
 /// Enumerates all error breakpoints that resulted from this pending breakpoint.
 /// </summary>
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     DLog.Debug(DContext.VSDebuggerComCall, "DebugPendingBreakpoint.EnumErrorBreakpoints");
     if (IsDeleted)
     {
         ppEnum = null;
         return HResults.E_BP_DELETED;
     }
     throw new NotImplementedException();
 }
        /// <summary>
        /// Determines whether this pending breakpoint can bind to a code location.
        /// </summary>
        /// <param name="ppErrorEnum">
        /// [out] Returns an IEnumDebugErrorBreakpoints2 object that contains a list of IDebugErrorBreakpoint2
        /// objects if there could be errors.
        /// </param>
        /// <returns>
        /// If successful, returns S_OK. Returns S_FALSE if the breakpoint cannot bind, in which case the errors
        /// are returned by the ppErrorEnum parameter. Otherwise, returns an error code. Returns E_BP_DELETED if
        /// the breakpoint has been deleted.
        /// </returns>
        /// <remarks>
        /// This method is called to determine what would happen if this pending breakpoint was bound. Call the
        /// IDebugPendingBreakpoint2::Bind method to actually bind the pending breakpoint.
        /// </remarks>
        public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            if (_deleted)
            {
                ppErrorEnum = null;
                return AD7Constants.E_BP_DELETED;
            }

            string fileName = RequestLocation.DocumentPosition.GetFileName();
            int lineNumber = RequestLocation.DocumentPosition.GetRange().iStartLine + 1;
            bool errorNotFirstOnLine = false;

            IEnumerable<JavaDebugProgram> programs = DebugEngine.Programs.ToArray();
            foreach (var program in programs)
            {
                if (!program.IsLoaded)
                    continue;

                IVirtualMachine virtualMachine = program.VirtualMachine;
                ReadOnlyCollection<IReferenceType> classes = virtualMachine.GetAllClasses();
                foreach (var @class in classes)
                {
                    if ([email protected]())
                        continue;

                    ReadOnlyCollection<ILocation> locations = @class.GetLocationsOfLine(@class.GetDefaultStratum(), Path.GetFileName(fileName), lineNumber);
                    ILocation bindLocation = locations.OrderBy(i => i.GetCodeIndex()).FirstOrDefault();
                    if (bindLocation != null)
                    {
                        if (IsFirstOnLine())
                        {
                            ppErrorEnum = null;
                            return VSConstants.S_OK;
                        }
                        else
                        {
                            errorNotFirstOnLine = true;
                            break;
                        }
                    }
                }

                if (errorNotFirstOnLine)
                    break;
            }

            foreach (var program in programs)
            {
                JavaDebugThread thread = null;
                IDebugCodeContext2 codeContext = new DebugDocumentCodeContext(RequestLocation.DocumentPosition);
                BreakpointResolutionLocation location = new BreakpointResolutionLocationCode(codeContext);
                string message = "The class is not yet loaded, or the location is not present in the debug symbols for this document.";
                if (errorNotFirstOnLine)
                    message = "Only breakpoints on the first statement on a line can be bound at this time.";

                DebugErrorBreakpointResolution resolution = new DebugErrorBreakpointResolution(program, thread, enum_BP_TYPE.BPT_CODE, location, enum_BP_ERROR_TYPE.BPET_GENERAL_WARNING, message);
                DebugErrorBreakpoint errorBreakpoint = new DebugErrorBreakpoint(this, resolution);
                _errorBreakpoints.Add(errorBreakpoint);

                DebugEvent debugEvent = new DebugBreakpointErrorEvent(enum_EVENTATTRIBUTES.EVENT_ASYNCHRONOUS, errorBreakpoint);
                program.Callback.Event(DebugEngine, program.Process, program, null, debugEvent);
            }

            if (_errorBreakpoints.Count == 0)
            {
                JavaDebugProgram program = null;
                JavaDebugThread thread = null;
                IDebugCodeContext2 codeContext = new DebugDocumentCodeContext(RequestLocation.DocumentPosition);
                BreakpointResolutionLocation location = new BreakpointResolutionLocationCode(codeContext);
                string message = "The binding process is not yet implemented.";

                DebugErrorBreakpointResolution resolution = new DebugErrorBreakpointResolution(program, thread, enum_BP_TYPE.BPT_CODE, location, enum_BP_ERROR_TYPE.BPET_GENERAL_ERROR, message);
                DebugErrorBreakpoint errorBreakpoint = new DebugErrorBreakpoint(this, resolution);
                _errorBreakpoints.Add(errorBreakpoint);
            }

            ppErrorEnum = new EnumDebugErrorBreakpoints(_errorBreakpoints);
            return VSConstants.S_FALSE;
        }
        // Determines whether this pending breakpoint can bind to a code location.
        int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
        {
            ppErrorEnum = null;

            if (!CanBind())
            {
                // Called to determine if a pending breakpoint can be bound.
                // The breakpoint may not be bound for many reasons such as an invalid location, an invalid expression, etc...
                // The sample engine does not support this, but a real world engine will want to return a valid enumeration of IDebugErrorBreakpoint2.
                // The debugger will then display information about why the breakpoint did not bind to the user.
                return VSConstants.S_FALSE;
            }

            return VSConstants.S_OK;
        }
Esempio n. 35
0
 // Enumerates all error breakpoints that resulted from this pending breakpoint.
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     // Called when a pending breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
     // TODO: send an instance of IDebugBreakpointErrorEvent2 to the UI and return a valid enumeration of IDebugErrorBreakpoint2
     // from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then display information about why the breakpoint
     // did not bind to the user.
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
 int IEnumDebugErrorBreakpoints2.Clone(out IEnumDebugErrorBreakpoints2 ppEnum)
 {
   Debug.WriteLine("Ad7EnumDebugErrorBreakpoints: Clone");
   ppEnum = new Ad7EnumDebugErrorBreakpoints( this );
   return VSConstants.S_OK;
 }
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     throw new NotImplementedException();
 }
Esempio n. 38
0
 /// <summary>
 /// Determines whether this pending breakpoint can bind to a code location.
 /// </summary>
 /// <param name="ppErrorEnum">Returns an IEnumDebugErrorBreakpoints2 object that contains a list of IDebugErrorBreakpoint2 objects if there could be errors.</param>
 /// <returns>If successful, returns S_OK. Returns S_FALSE if the breakpoint cannot bind, in which case the errors are returned by the ppErrorEnum parameter. Otherwise, returns an error code. Returns E_BP_DELETED if the breakpoint has been deleted.</returns>
 /// <remarks>This method is called to determine what would happen if this pending breakpoint was bound. Call the IDebugPendingBreakpoint2::Bind method to actually bind the pending breakpoint.</remarks>
 public virtual int CanBind( out IEnumDebugErrorBreakpoints2 ppErrorEnum )
 {
     Logger.Debug( string.Empty );
     ppErrorEnum = null;
     return VSConstants.S_FALSE;
 }
Esempio n. 39
0
 int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     ppErrorEnum = null;
     return(VSConstants.S_OK);
 }
Esempio n. 40
0
        // Enumerates all error breakpoints that resulted from this pending breakpoint.
        int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
        {
            // Called when a pending breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
            // Return a valid enumeration of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints, allowing the debugger to
            // display information about why the breakpoint did not bind to the user.
            lock (this._breakpointErrors)
            {
                var breakpointErrors = this._breakpointErrors.Cast <IDebugErrorBreakpoint2>().ToArray();
                ppEnum = new AD7ErrorBreakpointsEnum(breakpointErrors);
            }

            return(VSConstants.S_OK);
        }
Esempio n. 41
0
 // Enumerates all error breakpoints that resulted from this pending breakpoint.
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     // Called when a pending breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
     // The sample engine does not support this, but a real world engine will want to send an instance of IDebugBreakpointErrorEvent2 to the
     // UI and return a valid enumeration of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then
     // display information about why the breakpoint did not bind to the user.
     if ((_BPError != null) && ((bpErrorType & enum_BP_ERROR_TYPE.BPET_TYPE_ERROR) != 0))
     {
         IDebugErrorBreakpoint2[] errlist = new IDebugErrorBreakpoint2[1];
         errlist[0] = _BPError;
         ppEnum     = new AD7ErrorBreakpointsEnum(errlist);
         return(Constants.S_OK);
     }
     else
     {
         ppEnum = null;
         return(Constants.S_FALSE);
     }
 }
Esempio n. 42
0
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     Log.Debug("ScriptBreakpoint: EnumErrorBreakpoints");
     ppEnum = null;
     return VSConstants.S_OK;
 }
 int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
   Debug.WriteLine("AD7Breakpoint: CanBind");
   int result = VSConstants.S_OK;
   ppErrorEnum = null;
   if (_lineNumber == 0)
     result = FindBreakpointLine();
   if (result != VSConstants.S_OK)
     return result;
   if (DebuggerManager.Instance.Debugger.CanBindBreakpoint( ( int )this._lineNumber))
   {
     ppErrorEnum = null;
     return VSConstants.S_OK;
   }
   else
   {
     // TODO: Can also return deleted breakpoint, see constant E_BP_DELETED
     Ad7EnumDebugErrorBreakpoints enumBp = new Ad7EnumDebugErrorBreakpoints();
     enumBp.Add(new AD7DebugErrorBreakpoint(this));
     ppErrorEnum = enumBp;
     return VSConstants.E_FAIL;
   }
 }
Esempio n. 44
0
 public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     Log.Debug("ScriptBreakpoint: CanBind");
     ppErrorEnum = null;
     return VSConstants.S_OK;
 }
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum) {
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     ppEnum = null;
     return(VSConstants.E_NOTIMPL);
 }
Esempio n. 47
0
 // Enumerates all error breakpoints that resulted from this pending breakpoint.
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     // Called when a pending breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
     // The sample engine does not support this, but a real world engine will want to send an instance of IDebugBreakpointErrorEvent2 to the
     // UI and return a valid enumeration of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then
     // display information about why the breakpoint did not bind to the user.
     if ((_BPError != null) && ((bpErrorType & enum_BP_ERROR_TYPE.BPET_TYPE_ERROR) != 0))
     {
         IDebugErrorBreakpoint2[] errlist = new IDebugErrorBreakpoint2[1];
         errlist[0] = _BPError;
         ppEnum = new AD7ErrorBreakpointsEnum(errlist);
         return Constants.S_OK;
     }
     else
     {
         ppEnum = null;
         return Constants.S_FALSE;
     }
 }
 int IDebugPendingBreakpoint2.CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum) {
     ppErrorEnum = null;
     return CanBind() ? VSConstants.S_OK : VSConstants.S_FALSE;
 }
 // Enumerates all error breakpoints that resulted from this pending breakpoint.
 int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     // Called when a pending breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
     // The sample engine does not support this, but a real world engine will want to send an instance of IDebugBreakpointErrorEvent2 to the
     // UI and return a valid enumeration of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints. The debugger will then
     // display information about why the breakpoint did not bind to the user.
     ppEnum = null;
     return VSConstants.E_NOTIMPL;
 }
 public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
 {
     throw new NotImplementedException();
 }
        public int EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum)
        {
            if (_deleted)
            {
                ppEnum = null;
                return AD7Constants.E_BP_DELETED;
            }

            ppEnum = new EnumDebugErrorBreakpoints(_errorBreakpoints);
            return VSConstants.S_OK;
        }
Esempio n. 52
0
        // Enumerates all error breakpoints that resulted from this pending breakpoint.
        int IDebugPendingBreakpoint2.EnumErrorBreakpoints(enum_BP_ERROR_TYPE bpErrorType, out IEnumDebugErrorBreakpoints2 ppEnum) {
            // Called when a pending breakpoint could not be bound. This may occur for many reasons such as an invalid location, an invalid expression, etc...
            // Return a valid enumeration of IDebugErrorBreakpoint2 from IDebugPendingBreakpoint2::EnumErrorBreakpoints, allowing the debugger to
            // display information about why the breakpoint did not bind to the user.
            lock (_breakpointErrors) {
                IDebugErrorBreakpoint2[] breakpointErrors = _breakpointErrors.Cast<IDebugErrorBreakpoint2>().ToArray();
                ppEnum = new AD7ErrorBreakpointsEnum(breakpointErrors);
            }

            return VSConstants.S_OK;
        }
Esempio n. 53
0
 public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     throw new NotImplementedException();
 }
Esempio n. 54
0
 public int CanBind(out IEnumDebugErrorBreakpoints2 ppErrorEnum)
 {
     ppErrorEnum = null;
     return VSConstants.S_OK;
 }