Ejemplo n.º 1
0
        public int Bind()
        {
            IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(m_bpRequestInfo.bpLocation.unionmember2));

            string filename;

            docPosition.GetFileName(out filename);

            TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition   = new TEXT_POSITION[1];
            EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

            Command bpCommand = new BreakpointCommand(Path.GetFileName(filename), (int)startPosition[0].dwLine + 1);

            m_engine.EnqueueCommand(bpCommand);

            AD7DocumentContext docContext = new AD7DocumentContext(filename, startPosition[0], endPosition[0]);

            AD7BreakpointResolution breakpointResolution = new AD7BreakpointResolution(this.m_engine, docContext);
            AD7BoundBreakpoint      boundBreakpoint      = new AD7BoundBreakpoint(this.m_engine, this, breakpointResolution);

            string fileandline = Path.GetFileName(filename) + ((int)startPosition[0].dwLine + 1).ToString();

            m_bpManager.StoreBoundBreakpoint(fileandline, boundBreakpoint);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 2
0
        public int Bind()
        {
            IDebugDocumentPosition2 docPosition = (IDebugDocumentPosition2)(Marshal.GetObjectForIUnknown(m_bpRequestInfo.bpLocation.unionmember2));

            string filename;
            docPosition.GetFileName(out filename);

            TEXT_POSITION[] startPosition = new TEXT_POSITION[1];
            TEXT_POSITION[] endPosition = new TEXT_POSITION[1];
            EngineUtils.CheckOk(docPosition.GetRange(startPosition, endPosition));

            Command bpCommand = new BreakpointCommand(Path.GetFileName(filename), (int)startPosition[0].dwLine + 1);
            m_engine.EnqueueCommand(bpCommand);

            AD7DocumentContext docContext = new AD7DocumentContext(filename, startPosition[0], endPosition[0]);

            AD7BreakpointResolution breakpointResolution = new AD7BreakpointResolution(this.m_engine, docContext);
            AD7BoundBreakpoint boundBreakpoint = new AD7BoundBreakpoint(this.m_engine, this, breakpointResolution);

            string fileandline = Path.GetFileName(filename) + ((int)startPosition[0].dwLine + 1).ToString();
            m_bpManager.StoreBoundBreakpoint(fileandline, boundBreakpoint);

            return VSConstants.S_OK;
        }
Ejemplo n.º 3
0
        private async Task ReadNamedPipeAsync()
        {
            string pipeID = pID.ToString();

            using (NamedPipeServerStream pipeServer = new NamedPipeServerStream("luaPipeR" + pipeID, PipeDirection.In, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous))
            {
                await Task.Factory.FromAsync((cb, state) => pipeServer.BeginWaitForConnection(cb, state), ar => pipeServer.EndWaitForConnection(ar), null);

                using (StreamReader pipeReader = new StreamReader(pipeServer))
                {
                    await TaskScheduler.Default;

                    while (this.keepReadPipeOpen)
                    {
                        string command = await pipeReader.ReadLineAsync();

                        switch (command)
                        {
                        case "BreakpointHit":
                        {
                            debugThread.SourceFile = await pipeReader.ReadLineAsync();

                            debugThread.Line     = uint.Parse(await pipeReader.ReadLineAsync());
                            debugThread.FuncName = await pipeReader.ReadLineAsync();

                            // Receive Callstack
                            debugThread.FrameCount = int.Parse(await pipeReader.ReadLineAsync());

                            List <Frame> frames = new List <Frame>(debugThread.FrameCount);

                            for (int stackLineIndex = 0; stackLineIndex < debugThread.FrameCount; stackLineIndex++)
                            {
                                string func = await pipeReader.ReadLineAsync();

                                string source = await pipeReader.ReadLineAsync();

                                string line = await pipeReader.ReadLineAsync();

                                frames.Add(new Frame(func, source, line));
                            }

                            debugThread.StackFrames = frames;

                            int numberToRead = int.Parse(await pipeReader.ReadLineAsync());

                            List <Variable> variables = new List <Variable>(numberToRead);

                            for (int localIndex = 0; localIndex < numberToRead; localIndex++)
                            {
                                variables.Add(new Variable(await pipeReader.ReadLineAsync(), await pipeReader.ReadLineAsync(), await pipeReader.ReadLineAsync()));
                            }

                            debugThread.NumberOfLocals = numberToRead;
                            debugThread.Locals         = variables;
                            AD7BreakpointEvent.Send(this, breakpointManager.GetBoundBreakpoint(debugThread.SourceFile + debugThread.Line));
                            break;
                        }

                        case "BreakpointBound":
                            string fileandline = await pipeReader.ReadLineAsync();

                            AD7BoundBreakpoint boundbp = breakpointManager.GetBoundBreakpoint(fileandline);

                            AD7BreakpointBoundEvent boundBreakpointEvent = new AD7BreakpointBoundEvent(boundbp);
                            Send(boundBreakpointEvent, AD7BreakpointBoundEvent.IID, this);
                            break;

                        case "StepComplete":
                        {
                            debugThread.FrameCount = 1;
                            debugThread.SourceFile = await pipeReader.ReadLineAsync();

                            debugThread.Line     = uint.Parse(await pipeReader.ReadLineAsync());
                            debugThread.FuncName = await pipeReader.ReadLineAsync();

                            // Receive Callstack
                            debugThread.FrameCount = int.Parse(await pipeReader.ReadLineAsync());

                            List <Frame> frames = new List <Frame>(debugThread.FrameCount);

                            for (int stackLineIndex = 0; stackLineIndex < debugThread.FrameCount; stackLineIndex++)
                            {
                                string func = await pipeReader.ReadLineAsync();

                                string source = await pipeReader.ReadLineAsync();

                                string line = await pipeReader.ReadLineAsync();

                                frames.Add(new Frame(func, source, line));
                            }

                            debugThread.StackFrames = frames;

                            int numberToRead = int.Parse(await pipeReader.ReadLineAsync());

                            List <Variable> variables = new List <Variable>(numberToRead);

                            for (int localIndex = 0; localIndex < numberToRead; localIndex++)
                            {
                                variables.Add(new Variable(await pipeReader.ReadLineAsync(), await pipeReader.ReadLineAsync(), await pipeReader.ReadLineAsync()));
                            }

                            debugThread.NumberOfLocals = numberToRead;
                            debugThread.Locals         = variables;


                            Send(new AD7StepCompleteEvent(), AD7StepCompleteEvent.IID, this);
                            break;
                        }
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public AD7BreakpointBoundEvent(AD7BoundBreakpoint boundBreakpoint)
 {
     m_boundBreakpoint = boundBreakpoint;
 }
Ejemplo n.º 5
0
 public void StoreBoundBreakpoint(string fileandline, AD7BoundBreakpoint bp)
 {
     // store bound breakpoint in list, need to be able to get
     m_boundBreakpoints.Add(fileandline, bp);
 }
Ejemplo n.º 6
0
 public AD7BreakpointBoundEvent(AD7BoundBreakpoint boundBreakpoint)
 {
     m_boundBreakpoint = boundBreakpoint;
 }