Пример #1
0
        private bool Initialize(QmlEngine engine, IDebugBreakpointRequest2 request)
        {
            var locationType = new enum_BP_LOCATION_TYPE[1];

            if (request.GetLocationType(locationType) != VSConstants.S_OK)
            {
                return(false);
            }

            var requestInfo = new BP_REQUEST_INFO[1];

            if (request.GetRequestInfo(enum_BPREQI_FIELDS.BPREQI_ALLFIELDS, requestInfo)
                != VSConstants.S_OK)
            {
                return(false);
            }

            if (requestInfo[0].bpLocation.bpLocationType
                != (uint)enum_BP_LOCATION_TYPE.BPLT_CODE_FILE_LINE)
            {
                return(false);
            }

            var docPosition = Marshal.GetObjectForIUnknown(requestInfo[0].bpLocation.unionmember2)
                              as IDebugDocumentPosition2;

            if (docPosition == null)
            {
                return(false);
            }

            if (docPosition.GetFileName(out string fileName) != VSConstants.S_OK)
            {
                return(false);
            }

            if (!ValidExtensions.Where(x => string.Equals(x, Path.GetExtension(fileName))).Any())
            {
                return(false);
            }

            TEXT_POSITION[] beginPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition   = new TEXT_POSITION[1];
            if (docPosition.GetRange(beginPosition, endPosition) != VSConstants.S_OK)
            {
                return(false);
            }

            Engine        = engine;
            Request       = request;
            LocationType  = locationType[0];
            RequestInfo   = requestInfo[0];
            FileName      = fileName;
            BeginPosition = beginPosition[0];
            EndPosition   = endPosition[0];

            breakpoints = new HashSet <Breakpoint>();

            return(true);
        }
Пример #2
0
        public static Program Create(
            QmlEngine engine,
            IDebugProcess2 nativeProc,
            string execPath,
            string execArgs)
        {
            var _this = new Program();

            return(_this.Initialize(engine, nativeProc, execPath, execArgs) ? _this : null);
        }
Пример #3
0
 public static CodeContext Create(
     QmlEngine engine, Program program,
     string filePath, uint fileLine)
 {
     return(new CodeContext()
     {
         Engine = engine,
         Program = program,
         FilePath = filePath,
         FileLine = fileLine
     });
 }
Пример #4
0
 protected DebugEvent(
     QmlEngine engine,
     Guid interfaceId,
     uint attributes,
     IDebugProgram2 program        = null,
     IDebugThread2 thread          = null,
     IDebugEventCallback2 callback = null)
 {
     InterfaceId = interfaceId;
     Attributes  = attributes;
     Engine      = engine;
     Program     = program;
     Thread      = thread;
     Callback    = (callback != null) ? callback : engine;
 }
Пример #5
0
        private bool Initialize(
            QmlEngine engine,
            IDebugProcess2 nativeProc,
            string execPath,
            string execArgs)
        {
            Engine     = engine;
            NativeProc = nativeProc;

            var nativeProcId = new AD_PROCESS_ID[1];

            nativeProc.GetPhysicalProcessId(nativeProcId);
            NativeProcId = nativeProcId[0].dwProcessId;

            ExecPath = execPath;
            ExecArgs = execArgs;

            Debugger = QmlDebugger.Create(this, execPath, execArgs);
            if (Debugger == null)
            {
                return(false);
            }

            VsDebugger = VsServiceProvider.GetService <IVsDebugger>();
            if (VsDebugger != null)
            {
                ThreadHelper.JoinableTaskFactory.Run(async() =>
                {
                    await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
                    VsDebugger.AdviseDebugEventCallback(this);
                });
            }
            vsDebuggerThreadDispatcher = Dispatcher.CurrentDispatcher;

            ProcessId     = Guid.NewGuid();
            CurrentFrames = new List <StackFrame>();

            lock (criticalSectionGlobal) {
                if (runningPrograms == 0)
                {
                    originalBreakAllProcesses = BreakAllProcesses;
                }
                runningPrograms++;
            }

            return(true);
        }
Пример #6
0
        public static PendingBreakpoint Create(QmlEngine engine, IDebugBreakpointRequest2 request)
        {
            var _this = new PendingBreakpoint();

            return(_this.Initialize(engine, request) ? _this : null);
        }
Пример #7
0
 public OutputStringEvent(QmlEngine engine, string outputString)
     : base(engine, typeof(IDebugOutputStringEvent2).GUID, ASYNCHRONOUS)
 {
     this.outputString = outputString;
 }
Пример #8
0
 public EngineCreateEvent(QmlEngine engine)
     : base(engine, typeof(IDebugEngineCreateEvent2).GUID, ASYNCHRONOUS)
 {
 }