Exemplo n.º 1
0
        async Task <DebugStore> LoadStore(SessionId sessionId, CancellationToken token)
        {
            var context = GetContext(sessionId);

            if (Interlocked.CompareExchange(ref context.store, new DebugStore(), null) != null)
            {
                return(await context.Source.Task);
            }

            try {
                var loaded_pdbs = await SendMonoCommand(sessionId, MonoCommands.GetLoadedFiles(), token);

                var the_value = loaded_pdbs.Value? ["result"]? ["value"];
                var the_pdbs  = the_value?.ToObject <string[]> ();

                await context.store.Load(sessionId, the_pdbs, token);
            } catch (Exception e) {
                context.Source.SetException(e);
            }

            if (!context.Source.Task.IsCompleted)
            {
                context.Source.SetResult(context.store);
            }
            return(await context.Source.Task);
        }
Exemplo n.º 2
0
        async Task LoadStore(SessionId sessionId, CancellationToken token)
        {
            var loaded_pdbs = await SendMonoCommand(sessionId, MonoCommands.GetLoadedFiles(), token);

            var the_value = loaded_pdbs.Value? ["result"]? ["value"];
            var the_pdbs  = the_value?.ToObject <string[]> ();

            store = new DebugStore();
            await store.Load(sessionId, the_pdbs, token);
        }
Exemplo n.º 3
0
        async Task <DebugStore> LoadStore(SessionId sessionId, CancellationToken token)
        {
            var context = GetContext(sessionId);

            if (Interlocked.CompareExchange(ref context.store, new DebugStore(logger), null) != null)
            {
                return(await context.Source.Task);
            }

            try {
                var loaded_pdbs = await SendMonoCommand(sessionId, MonoCommands.GetLoadedFiles(), token);

                var the_value = loaded_pdbs.Value? ["result"]? ["value"];
                var the_pdbs  = the_value?.ToObject <string[]> ();

                await foreach (var source in context.store.Load(sessionId, the_pdbs, token).WithCancellation(token))
                {
                    var scriptSource = JObject.FromObject(source.ToScriptSource(context.Id, context.AuxData));
                    Log("verbose", $"\tsending {source.Url} {context.Id} {sessionId.sessionId}");

                    SendEvent(sessionId, "Debugger.scriptParsed", scriptSource, token);

                    foreach (var req in context.BreakpointRequests.Values)
                    {
                        if (req.TryResolve(source))
                        {
                            await SetBreakpoint(sessionId, context.store, req, token);
                        }
                    }
                }
            } catch (Exception e) {
                context.Source.SetException(e);
            }

            if (!context.Source.Task.IsCompleted)
            {
                context.Source.SetResult(context.store);
            }
            return(context.store);
        }