internal ScriptDebugSession(int port, MoonSharpVsCodeDebugServer server, AsyncDebugger debugger) : base(port, server, debugger) { if (debugger == null) { throw new ArgumentNullException(nameof(debugger)); } }
/// <summary> /// Attaches the specified script to the debugger /// </summary> /// <param name="script">The script.</param> /// <param name="name">The name of the script.</param> /// <param name="sourceFinder">A function which gets in input a source code and returns the path to /// source file to use. It can return null and in that case (or if the file cannot be found) /// a temporary file will be generated on the fly.</param> /// <exception cref="ArgumentException">If the script has already been attached to this debugger.</exception> public void AttachToScript(Script script, string name, Func<SourceCode, string> sourceFinder = null) { lock (m_Lock) { if (m_DebuggerList.Any(d => d.Script == script)) throw new ArgumentException("Script already attached to this debugger."); var debugger = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), name); script.AttachDebugger(debugger); m_DebuggerList.Add(debugger); if (m_Current == null) m_Current = debugger; } }
internal MoonSharpDebugSession(int port, MoonSharpVsCodeDebugServer server, AsyncDebugger debugger) { Port = port; Server = server; Debugger = debugger; }
internal MoonSharpDebugSession(MoonSharpVsCodeDebugServer server, AsyncDebugger debugger) : base(true, false) { m_Server = server; m_Debug = debugger; }
public MoonSharpVsCodeDebugServer(Script script, int port, Func<SourceCode, string> sourceFinder = null) { m_Port = port; m_Current = new AsyncDebugger(script, sourceFinder ?? (s => s.Name), "Default script"); m_DebuggerList.Add(m_Current); }
/// <summary> /// Detaches the specified script. The debugger attached to that script will get disconnected. /// </summary> /// <param name="script">The script.</param> /// <exception cref="ArgumentException">Thrown if the script cannot be found.</exception> public void Detach(Script script) { lock (m_Lock) { var removed = m_DebuggerList.FirstOrDefault(d => d.Script == script); if (removed == null) throw new ArgumentException("Cannot detach script - not found."); removed.Client = null; m_DebuggerList.Remove(removed); if (m_Current == removed) { if (m_DebuggerList.Count > 0) m_Current = m_DebuggerList[m_DebuggerList.Count - 1]; else m_Current = null; } } }