private void HandleLaunchRequest(DAPRequest request, DAPLaunchRequest launch) { Config = launch.dbgOptions; if (launch.backendHost == null || launch.backendPort == 0) { throw new RequestFailedException("'backendHost' and 'backendPort' launch configuration variables must be set!"); } if (Config == null) { Config = new DAPCustomConfiguration(); } if (launch.noDebug) { throw new RequestFailedException("Cannot attach to game with debugging disabled"); } try { DbgClient = new AsyncProtobufClient(launch.backendHost, launch.backendPort); } catch (SocketException e) { throw new RequestFailedException("Could not connect to Lua debugger backend: " + e.Message); } DbgCli = new DebuggerClient(DbgClient) { OnBackendConnected = this.OnBackendConnected, OnBreakpointTriggered = this.OnBreakpointTriggered, OnEvaluateFinished = Evaluator.OnEvaluateFinished, OnContextUpdated = this.OnContextUpdated, OnModInfo = this.OnModInfo, OnDebugOutput = this.OnDebugOutput, OnResults = this.OnResults, OnDebuggerReady = this.OnDebuggerReady, OnSourceResponse = this.OnSourceResponse, OnGetVariablesFinished = Evaluator.OnGetVariablesFinished }; if (LogStream != null) { DbgCli.EnableLogging(LogStream); } DbgCli.SendConnectRequest(DBGProtocolVersion); DbgThread = new Thread(new ThreadStart(DebugThreadMain)); DbgThread.Start(); var reply = new DAPLaunchResponse(); Stream.SendReply(request, reply); }
private void HandleLaunchRequest(DAPRequest request, DAPLaunchRequest launch) { Config = launch.dbgOptions; ModUuid = launch.modUuid; if (!File.Exists(launch.debugInfoPath)) { throw new RequestFailedException("Story debug file does not exist: " + launch.debugInfoPath); } DebugInfoPath = launch.debugInfoPath; try { DbgClient = new AsyncProtobufClient(launch.backendHost, launch.backendPort); } catch (SocketException e) { throw new RequestFailedException("Could not connect to Osiris backend server: " + e.Message); } DbgCli = new DebuggerClient(DbgClient, DebugInfo) { OnStoryLoaded = this.OnStoryLoaded, OnDebugSessionEnded = this.OnDebugSessionEnded, OnBackendInfo = this.OnBackendInfo, OnBreakpointTriggered = this.OnBreakpointTriggered, OnGlobalBreakpointTriggered = this.OnGlobalBreakpointTriggered, OnStorySyncData = this.OnStorySyncData, OnStorySyncFinished = this.OnStorySyncFinished, OnDebugOutput = this.OnDebugOutput }; if (LogStream != null) { DbgCli.EnableLogging(LogStream); } DbgCli.SendIdentify(DBGProtocolVersion); DbgThread = new Thread(new ThreadStart(DebugThreadMain)); DbgThread.Start(); Breakpoints = new BreakpointManager(DbgCli); var reply = new DAPLaunchResponse(); Stream.SendReply(request, reply); var initializedEvt = new DAPInitializedEvent(); Stream.SendEvent("initialized", initializedEvt); }