Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public DebuggerClient(AsyncProtobufClient client)
 {
     Client = client;
     Client.MessageReceived = this.MessageReceived;
 }