示例#1
0
        public async void Start()
        {
            var project = _studio.GetDefaultProject();

            if (project == null)
            {
                OnEndSession();
                _console.WriteLine("No Default project set. Please set a default project before debugging.");
                return;
            }

            bool success = false;

            success = await _studio.BuildAsync(project);

            if (!success)
            {
                OnEndSession();
                return;
            }

            if (project.Debugger2 == null)
            {
                OnEndSession();
                _console.WriteLine("No Debug adaptor is set for default project.");
                return;
            }

            var debugger2 = project.Debugger2 as IDebugger2;

            if (await debugger2.InstallAsync(IoC.Get <IConsole>(), project))
            {
                _session = debugger2.CreateSession(project);

                _session.TargetUnhandledException += _session_TargetStopped;
                _session.TargetStopped            += _session_TargetStopped;
                _session.TargetHitBreakpoint      += _session_TargetStopped;
                _session.TargetSignaled           += _session_TargetStopped;
                _session.TargetInterrupted        += _session_TargetStopped;
                _session.TargetExited             += _session_TargetExited;
                _session.TargetStarted            += _session_TargetStarted;
                _session.TargetReady += _session_TargetReady;

                _session.Breakpoints = Breakpoints;

                _session.Run(debugger2.GetDebuggerStartInfo(project), debugger2.GetDebuggerSessionOptions(project));

                _studio.CurrentPerspective = Perspective.Debugging;

                DebugSessionStarted?.Invoke(this, EventArgs.Empty);
            }
        }
示例#2
0
        public async void Start()
        {
            var project = _shell.GetDefaultProject();

            if (project == null)
            {
                OnEndSession();
                _console.WriteLine("No Default project set. Please set a default project before debugging.");
                return;
            }

            bool success = false;

            await _shell.TaskRunner.RunTask(() => success = project.ToolChain.Build(_console, project).GetAwaiter().GetResult());

            if (!success)
            {
                OnEndSession();
                return;
            }

            if (project.Debugger2 == null)
            {
                OnEndSession();
                _console.WriteLine("No Debug adaptor is set for default project.");
                return;
            }

            var debugger2 = project.Debugger2 as IDebugger2;

            await debugger2.InstallAsync(IoC.Get <IConsole>());

            _session = debugger2.CreateSession(project);

            _session.Breakpoints = Breakpoints;

            _session.Run(debugger2.GetDebuggerStartInfo(project), debugger2.GetDebuggerSessionOptions(project));

            _session.TargetStopped       += _session_TargetStopped;
            _session.TargetHitBreakpoint += _session_TargetStopped;
            _session.TargetSignaled      += _session_TargetStopped;
            _session.TargetInterrupted   += _session_TargetStopped;
            _session.TargetExited        += _session_TargetExited;
            _session.TargetStarted       += _session_TargetStarted;
            _session.TargetReady         += _session_TargetReady;

            _shell.CurrentPerspective = Perspective.Debug;

            DebugSessionStarted?.Invoke(this, new EventArgs());
        }