void OnBreakpointChanged(BreakpointChangedEventArgs e)
 {
     BreakpointChanged?.Invoke(this, e);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Spin off a thread that will constantly try to get new events from the SbListener.
        /// </summary>
        public void Start()
        {
            if (IsRunning)
            {
                return;
            }

            _tokenSource = new CancellationTokenSource();
            var task = Task.Run(() => {
                try
                {
                    while (!_tokenSource.IsCancellationRequested)
                    {
                        if (!_lldbListener.WaitForEvent(_listenerIntervalInSeconds,
                                                        out SbEvent lldbEvent))
                        {
                            continue;
                        }

                        if (lldbEvent == null)
                        {
                            return;
                        }

                        var eventType = lldbEvent.GetEventType();
                        if (lldbEvent.IsBreakpointEvent)
                        {
                            BreakpointChanged?.Invoke(
                                null, new BreakpointChangedEventArgs(lldbEvent));
                        }
                        else if ((eventType & EventType.STATE_CHANGED) != 0)
                        {
                            StateChanged?.Invoke(null, new StateChangedEventArgs(lldbEvent));
                        }
                        else if ((eventType & EventType.STRUCTURED_DATA) != 0)
                        {
                            var update = _descriptionParser.Parse <FileProcessingUpdate>(
                                lldbEvent.GetDescription());
                            if (update != null)
                            {
                                FileUpdateReceived
                                ?.Invoke(null, new FileUpdateReceivedEventArgs(update));
                            }
                        }
                    }
                }
                catch (TaskCanceledException)
                {
                    Trace.WriteLine($"Listener was stopped");
                }
                catch (Exception exception)
                {
                    Trace.WriteLine(
                        "Internal error: Failed to receive event from listener due to " +
                        exception.Message);
                    ExceptionOccured?.Invoke(null, new ExceptionOccuredEventArgs(exception));
                }
            }, _tokenSource.Token);

            IsRunning = true;
        }
Exemplo n.º 3
0
 internal void RaiseBreakpointChanged(BreakpointChangedEventArgs args)
 {
     BreakpointChanged?.Invoke(this, args);
 }