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); }
private async Task WriteNamedPipeAsync() { string pipeID = pID.ToString(); using (NamedPipeServerStream pipeServer = new NamedPipeServerStream("luaPipeW" + pipeID, PipeDirection.Out, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous)) { await Task.Factory.FromAsync((cb, state) => pipeServer.BeginWaitForConnection(cb, state), ar => pipeServer.EndWaitForConnection(ar), null); using (StreamWriter pipeWriter = new StreamWriter(pipeServer)) { pipeWriter.AutoFlush = true; keepWritePipeOpen = true; // Transition to a background thread await TaskScheduler.Default; while (keepWritePipeOpen) { Command command = await this.writeCommandQueue.DequeueAsync(); switch (command.Kind) { case CommandKind.Breakpoint: BreakpointCommand bpCommand = command as BreakpointCommand; await pipeWriter.WriteLineAsync("Breakpoint\0"); await pipeWriter.WriteLineAsync(bpCommand.File + "\0"); await pipeWriter.WriteLineAsync(bpCommand.LineNumber.ToString() + "\0"); break; case CommandKind.Step: await pipeWriter.WriteLineAsync("Step\0"); break; case CommandKind.Continue: await pipeWriter.WriteLineAsync("Continue\0"); break; case CommandKind.Detach: keepWritePipeOpen = false; break; case CommandKind.DebuggerEnvironmentReady: await pipeWriter.WriteLineAsync("DebuggerEnvironmentReady\0"); break; } } } } }
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; }