/// <summary>
        /// Create a new location breakpoint.
        /// </summary>
        protected override DalvikLocationBreakpoint CreateLocationBreakpoint(SourceCodePosition sourceCode, TypeEntry typeEntry, MethodEntry methodEntry, object data)
        {
            // Create breakpoint objects
            var pendingBreakpoint = (DebugPendingBreakpoint)data;
            var boundBreakpoint   = new DebugBoundBreakpoint <DebugLocationBreakpoint>(pendingBreakpoint, this, enum_BP_TYPE.BPT_CODE, x => new DebugLocationBreakpoint(Jdwp.EventKind.BreakPoint, sourceCode, typeEntry, methodEntry, x));

            // Return breakpoint
            return(boundBreakpoint.Breakpoint);
        }
 public DebugLocationBreakpoint(Location location, DebugBoundBreakpoint <DebugLocationBreakpoint> boundBreakpoint, DocumentLocation documentLocation = null)
     : base(location, documentLocation)
 {
     this.boundBreakpoint = boundBreakpoint;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DebugLocationBreakpoint(Jdwp.EventKind eventKind, DocumentPosition documentPosition, TypeEntry typeEntry, MethodEntry methodEntry, DebugBoundBreakpoint <DebugLocationBreakpoint> boundBreakpoint)
     : base(eventKind, documentPosition, typeEntry, methodEntry)
 {
     this.boundBreakpoint = boundBreakpoint;
 }
 /// <summary>
 /// Default ctor
 /// </summary>
 public DebugLocationBreakpoint(Jdwp.EventKind eventKind, SourceCodePosition sourcePosition, TypeEntry typeEntry, MethodEntry methodEntry, DebugBoundBreakpoint <DebugLocationBreakpoint> boundBreakpoint)
     : base(eventKind, sourcePosition, typeEntry, methodEntry)
 {
     this.boundBreakpoint = boundBreakpoint;
 }
Exemplo n.º 5
0
        private int SetBreakpoint()
        {
            if (IsDeleted)
            {
                return(HResults.E_BP_DELETED);
            }

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

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

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

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

            // Set breakpoint
            var program = engine.Program;

            if (program == null)
            {
                return(VSConstants.E_INVALIDARG);
            }

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

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


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

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

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

            return(VSConstants.E_NOTIMPL);
        }