Exemplo n.º 1
0
        async Task RuntimeReady(SessionId sessionId, CancellationToken token)
        {
            if (store == null)
            {
                await LoadStore(sessionId, token);
            }

            foreach (var s in store.AllSources())
            {
                var ok = JObject.FromObject(new {
                    scriptId                = s.SourceId.ToString(),
                    url                     = s.Url,
                    executionContextId      = this.ctx_id,
                    hash                    = s.DocHashCode,
                    executionContextAuxData = this.aux_ctx_data,
                    dotNetUrl               = s.DotNetUrl,
                });
                //Log ("verbose", $"\tsending {s.Url}");
                SendEvent(sessionId, "Debugger.scriptParsed", ok, token);
            }

            var o = JObject.FromObject(new {
                expression            = MonoCommands.CLEAR_ALL_BREAKPOINTS,
                objectGroup           = "mono_debugger",
                includeCommandLineAPI = false,
                silent        = false,
                returnByValue = true,
            });

            var clear_result = await SendCommand(sessionId, "Runtime.evaluate", o, token);

            if (clear_result.IsErr)
            {
                Log("verbose", $"Failed to clear breakpoints due to {clear_result}");
            }


            runtime_ready = true;

            foreach (var bp in breakpoints)
            {
                if (bp.State != BreakPointState.Pending)
                {
                    continue;
                }
                var res = await EnableBreakPoint(sessionId, bp, token);

                var ret_code = res.Value? ["result"]? ["value"]?.Value <int> ();

                //if we fail we just buble that to the IDE (and let it panic over it)
                if (!ret_code.HasValue)
                {
                    //FIXME figure out how to inform the IDE of that.
                    Log("info", $"FAILED TO ENABLE BP {bp.LocalId}");
                    bp.State = BreakPointState.Disabled;
                }
            }
        }
Exemplo n.º 2
0
        public bool TryResolve(DebugStore store)
        {
            if (request == null || store == null)
            {
                return(false);
            }

            return(store.AllSources().FirstOrDefault(source => TryResolve(source)) != null);
        }