Ejemplo n.º 1
0
        private void InitDebugger()
        {
            var debugPayload = File.ReadAllBytes(DebugInfoPath);
            var loader       = new DebugInfoLoader();

            DebugInfo = loader.Load(debugPayload);
            if (DebugInfo.Version != StoryDebugInfo.CurrentVersion)
            {
                throw new InvalidDataException($"Story debug info too old (found version {DebugInfo.Version}, we only support {StoryDebugInfo.CurrentVersion}). Please recompile the story.");
            }

            Formatter            = new ValueFormatter(DebugInfo);
            TracePrinter         = new StackTracePrinter(DebugInfo, Formatter);
            TracePrinter.ModUuid = ModUuid;
            if (Config != null)
            {
                TracePrinter.MergeFrames = !Config.rawFrames;
            }

            EvalResults = new EvaluationResultManager(Formatter);
            Evaluator   = new ExpressionEvaluator(DebugInfo, Stream, DbgCli, Formatter, EvalResults);

            Stack   = null;
            Stopped = false;
            // We're not in debug mode yet. We'll enable debugging when the story is fully synced
            DebuggingStory = false;
        }
Ejemplo n.º 2
0
        public DatabaseEnumerator(DebuggerClient dbgClient, DAPStream dap, StoryDebugInfo debugInfo, ValueFormatter formatter,
                                  EvaluationResultManager resultManager)
        {
            DebugInfo     = debugInfo;
            DAP           = dap;
            DbgClient     = dbgClient;
            Formatter     = formatter;
            ResultManager = resultManager;

            DbgClient.OnBeginDatabaseContents = this.OnBeginDatabaseContents;
            DbgClient.OnDatabaseRow           = this.OnDatabaseRow;
            DbgClient.OnEndDatabaseContents   = this.OnEndDatabaseContents;
        }
        public ExpressionEvaluator(StoryDebugInfo debugInfo, DAPStream dap, DebuggerClient dbgClient, ValueFormatter formatter,
                                   EvaluationResultManager results)
        {
            DebugInfo      = debugInfo;
            DbgClient      = dbgClient;
            DAP            = dap;
            DatabaseDumper = new DatabaseEnumerator(dbgClient, dap, debugInfo, formatter, results);
            EvalResults    = results;

            DbgClient.OnEvaluateRow      = this.OnEvaluateRow;
            DbgClient.OnEvaluateFinished = this.OnEvaluateFinished;

            MakeFunctionNameMap();
        }
Ejemplo n.º 4
0
        private void OnDebugSessionEnded()
        {
            if (DebuggingStory)
            {
                SendOutput("console", "Story unloaded - debug session terminated\r\n");
            }

            DebuggingStory = false;
            Stopped        = false;
            DebugInfo      = null;
            Evaluator      = null;
            EvalResults    = null;
            TracePrinter   = null;
            Formatter      = null;

            var changedBps = Breakpoints.DebugInfoUnloaded();

            // Notify the debugger that the status of breakpoints changed
            changedBps.ForEach(bp => SendBreakpoint("changed", bp));
        }