Пример #1
0
        /// <summary>
        /// We're done loading the initial threads.
        /// Notify the GUI that we're good to go.
        /// </summary>
        private void OnLoadThreadsDone(Dot42.DebuggerLib.Debugger debugger, DebugProcess debugProcess)
        {
            // Notify module
            //eventCallback.Send(program, new ModuleLoadEvent(program.MainModule, "Loading module", true));
            //eventCallback.Send(program, new SymbolSearchEvent(program.MainModule, "Symbols loaded", enum_MODULE_INFO_FLAGS.MIF_SYMBOLS_LOADED));

            var mainThread = debugProcess.ThreadManager.MainThread();

            if (mainThread != null)
            {
                // Threads loaded
                // Load complete
                //eventCallback.Send(mainThread, new LoadCompleteEvent());
                //eventCallback.Send(mainThread, new EntryPointEvent());

                // Resume now
                debugger.VirtualMachine.ResumeAsync();

                // Notify SD
                Action onDebugStarted = () => {
                    if (stateUpdate != null)
                    {
                        stateUpdate(LauncherStates.Attached, string.Empty);
                        stateUpdate = null;
                    }
                    DebugStarted.Fire(this);
                };
                Dot42Addin.InvokeAsyncAndForget(onDebugStarted);
            }
            else
            {
                DLog.Error(DContext.VSDebuggerLauncher, "No main thread found");
            }
        }
Пример #2
0
        /// <summary>
        /// Fire the IsProcessRunningChanged event.
        /// </summary>
        private void OnDebugProcessIsSuspendedChanged(object sender, EventArgs e)
        {
            var isProcessRunning = IsProcessRunning;

            if (isProcessRunning)
            {
                // Reset state
                CurrentThread = null;
            }
            Dot42Addin.InvokeAsyncAndForget(() => OnDebugProcessIsSuspendedChangedOnMainThread(isProcessRunning));
        }
Пример #3
0
 /// <summary>
 /// Debug process has stopped.
 /// </summary>
 private void OnDebugProcessTerminated(object sender, EventArgs e)
 {
     DebugProcess = null;
     Dot42Addin.InvokeAsyncAndForget(() => {
         try {
             DebugStopped.Fire(this);
         } catch (Exception ex) {
             LoggingService.Warn("Error in DebugStopped", ex);
             // Ignore
         }
         ResetBreakpointBookmark();
     });
 }
Пример #4
0
        /// <summary>
        /// Attach to the given debugger and start debugging.
        /// </summary>
        public void Attach(string apkPath, Dot42.DebuggerLib.Debugger debugger, Guid debuggerGuid)
        {
            // Cleanup static state
            Launcher.GetAndRemoveDebugger(debuggerGuid, out stateUpdate);

            // Notify SD
            Dot42Addin.InvokeAsyncAndForget(() => DebugStarting.Fire(this));

            // Load map file
            var mapFilePath = Path.ChangeExtension(apkPath, ".d42map");
            var mapFile     = File.Exists(mapFilePath) ? new MapFile(mapFilePath) : new MapFile();

            // Suspend and prepare the VM
            var suspend = debugger.VirtualMachine.SuspendAsync();
            var prepare = suspend.ContinueWith(t => {
                t.ForwardException();
                return(debugger.PrepareAsync());
            }).Unwrap();
            var debugProcess = new DebugProcess(debugger, mapFile);

            DebugProcess = debugProcess;
            var initializeBreakpoints = prepare.ContinueWith(t => {
                t.ForwardException();
                // Setup breakpoints
                Dot42Addin.Invoke(() => debugProcess.BreakpointManager.InitializeBreakpoints(DebuggerService.Breakpoints));
            });
            var loadThreads = initializeBreakpoints.ContinueWith(t => {
                t.ForwardException();
                return(debugProcess.ThreadManager.RefreshAsync());
            }).Unwrap();

            loadThreads.ContinueWith(t => {
                t.ForwardException();
                OnLoadThreadsDone(debugger, debugProcess);
            });
        }
Пример #5
0
 /// <summary>
 /// Called when a breakpoint has been reached.
 /// </summary>
 internal void OnBreakpointTriggered(BreakpointBookmark bb)
 {
     OnDebugProcessIsSuspendedChanged(this, EventArgs.Empty);
     Dot42Addin.InvokeAsyncAndForget(() => JumpToCurrentLine());
 }
Пример #6
0
 /// <summary>
 /// Fire the CurrentThreadChanged event.
 /// </summary>
 private void OnCurrentThreadChanged(object sender, EventArgs e)
 {
     Dot42Addin.InvokeAsyncAndForget(() => CurrentThreadChanged.Fire(this));
 }
 public SetupDot42ProjectCommand()
 {
     Dot42Addin.InitializeLocations();
 }
Пример #8
0
 public PrepareApplicationProjectCommand()
 {
     Dot42Addin.InitializeLocations();
 }
Пример #9
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public Dot42ProjectBehavior()
 {
     Dot42Addin.FixAddinTreeConditions();
     Dot42Addin.InitializeLocations();
 }