Beispiel #1
0
		public void LaunchDebugEngine(string apkPath, Dot42.DebuggerLib.Debugger debugger, Guid debuggerGuid, int launchFlags, Action<LauncherStates, string> stateUpdate)
		{
			var sdDebugger = DebuggerService.CurrentDebugger as Dot42Debugger;            
			if (sdDebugger == null) {
				MessageBox.Show("Dot42 Debugger expected");
				return;
			}
			sdDebugger.Attach(apkPath, debugger, debuggerGuid);
		}
Beispiel #2
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public CreateAvdControl(Dot42.AvdLib.AvdManager manager)
 {
     this.manager = manager;
     InitializeComponent();
     // Load frameworks
     cbTarget.Items.AddRange(Frameworks.Instance.ToArray());
     if (cbTarget.Items.Count > 0)
     {
         cbTarget.SelectedIndex = 0;
     }
     else
     {
         cbTarget.Enabled = false;
     }
     // Update controls
     OnNameTextChanged(null, null);
 }
Beispiel #3
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DelegateInstanceType(XMethodDefinition calledMethod, ClassDefinition instanceDefinition, Dot42.DexLib.MethodDefinition instanceCtor)
 {
     this.calledMethod = calledMethod;
     this.instanceDefinition = instanceDefinition;
     this.instanceCtor = instanceCtor;
 }
Beispiel #4
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");
			}
		}
Beispiel #5
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);
			                         });
		}
Beispiel #6
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public DebugProcess(Dot42.DebuggerLib.Debugger debugger, MapFile mapFile)
     : base(debugger, mapFile, null)
 {
 }
 /// <summary>
 /// This breakpoint is reached.
 /// </summary>
 protected override void OnTrigger(Dot42.DebuggerLib.Events.Jdwp.Breakpoint @event)
 {
     Dot42Debugger.Instance.OnBreakpointTriggered(bookmark);
 }
Beispiel #8
0
 protected override DalvikThread CreateThread(Dot42.DebuggerLib.ThreadId id)
 {
     return new DebugThread(id, this);
 }