Example #1
0
        private void Initialize()
        {
            _debugger = CreateDebuggerClient();
            _control = _debugger as IDebugControl4;
            _symbols = _debugger as IDebugSymbols4;
            _systemObjects = _debugger as IDebugSystemObjects3;
            _advanced = _debugger as IDebugAdvanced3;
            _spaces = _debugger as IDebugDataSpaces4;

            // in case previous debugging session hasn't finished correctly
            // some leftover breakpoints may exist (even if debugging target has changed)
            _control.ClearBreakpoints();
            _requestHelper = new RequestHelper(_advanced, _spaces, _symbols);
            _commandExecutor = new CommandExecutor(_control);
            _output = new OutputCallbacks();

            _callbacks = new EventCallbacks(_control);
            _callbacks.BreakpointHit += OnBreakpoint;
            _callbacks.ExceptionHit += OnException;
            _callbacks.BreakHappened += OnBreak;
            _callbacks.ThreadStarted += OnThreadStarted;
            _callbacks.ThreadFinished += OnThreadFinished;
            _callbacks.ProcessExited += OnProcessExited;

            _debugger.SetEventCallbacks(_callbacks);
            _debugger.SetOutputCallbacks(_output);
            _debugger.SetInputCallbacks(new InputCallbacks());

            _visualizers = new VisualizerRegistry(new DefaultVisualizer(_requestHelper, _symbols, _output));
            InitializeHandlers();
        }