internal void StartDebugging() { if (_vm != null) { return; } _vm = VirtualMachineManager.Connect(new IPEndPoint(_ipAddress, 11000)); _vm.EnableEvents(EventType.AssemblyLoad, EventType.ThreadStart, EventType.ThreadDeath, EventType.AssemblyUnload, EventType.UserBreak, EventType.Exception, EventType.UserLog, EventType.KeepAlive, EventType.TypeLoad); EventSet set = _vm.GetNextEventSet(); if (set.Events.OfType <VMStartEvent>().Any()) { //TODO: review by techcap _mainThread = new AD7Thread(_engine, new DebuggedThread(set.Events[0].Thread, _engine)); _engine.Callback.ThreadStarted(_mainThread); Task.Factory.StartNew(ReceiveThread, TaskCreationOptions.LongRunning); } else { throw new Exception("Didnt get VMStart-Event!"); } }
private static VirtualMachine ConnectWithConsoleOutput(Socket dbg_sock, IPEndPoint dbg_ep, StreamReader console, TextWriter logWriter = null) { dbg_sock.Connect(dbg_ep); SendCommand(dbg_sock, START_DEBUGGER_COMMAND); Connection transport = new XamarinTcpConnection(dbg_sock, logWriter); return(VirtualMachineManager.Connect(transport, console, null)); }
void ListenCallback(IAsyncResult ar) { HandleConnection(VirtualMachineManager.EndListen(ar)); Gtk.Application.Invoke(delegate { if (dialog != null) { dialog.Respond(Gtk.ResponseType.Ok); } }); }
void ISoftDebuggerConnectionProvider.EndConnect(IAsyncResult result, out VirtualMachine vm, out string appName) { appName = this.appName; Stream transport, output; CommandConnection.EndStartDebugger(result, out transport, out output); var transportConnection = new IPhoneTransportConnection( CommandConnection, transport); var outputReader = new StreamReader(output); vm = VirtualMachineManager.Connect(transportConnection, outputReader, null); }
/// <summary>Starts the debugger listening for a connection over TCP/IP</summary> protected void StartListening(RemoteDebuggerStartInfo dsi) { appName = dsi.AppName; RegisterUserAssemblies(dsi.UserAssemblyNames); IPEndPoint dbgEP = new IPEndPoint(dsi.Address, dsi.DebugPort); IPEndPoint conEP = dsi.RedirectOutput? new IPEndPoint(dsi.Address, dsi.OutputPort) : null; if (!String.IsNullOrEmpty(dsi.LogMessage)) { LogWriter(false, dsi.LogMessage + "\n"); } OnConnecting(VirtualMachineManager.BeginListen(dbgEP, conEP, HandleCallbackErrors(ListenCallback))); ShowListenDialog(dsi); }
public CoverHost(params string[] args) { cmdargs = args; VirtualMachine = VirtualMachineManager.Launch(args, new LaunchOptions() { AgentArgs = "suspend=y" }); VirtualMachine.EnableEvents( EventType.VMStart, EventType.VMDeath, EventType.VMDisconnect, EventType.AssemblyLoad, EventType.TypeLoad ); Singleton = this; }
static void Main(string[] args) { var managerClient = new ManagerClient(); managerClient.Start(); var vmManager = new VirtualMachineManager(); vmManager.AddVirtualMachine("test"); managerClient.QueueCommand(new ManagerClientCommand() { IPAddress = IPAddress.Parse("127.0.0.1"), Command = new KeyValuePair <string, string>("PrimaryUser", "bestincode") }); }
private void BeginConnect() { var timeout = TimeSpan.FromSeconds(_debugOptions.UserSettings.SSHDebugConnectionTimeout); var asyncResult = VirtualMachineManager.BeginConnect(new IPEndPoint(_ipAddress, _debugPort), ar => { } /*, HostOutputWindowEx.LogInstance*/); var vmTask = Task.Factory.FromAsync(asyncResult, ar => EndConnect(ar)); var timeoutResult = Task.WaitAny(new Task[] { vmTask }, timeout); if (timeoutResult != 0) { VirtualMachineManager.CancelConnection(asyncResult); throw new Exception($"Error: VirtualMachineManager couldn't connect to {_ipAddress}:{_debugPort} within {timeout.TotalSeconds} seconds."); } _vm = vmTask.Result; if (_vm == null) { throw new Exception($"Error: VirtualMachineManager couldn't connect to {_ipAddress}:{_debugPort}. Result was null!"); } }
public void Connect() { WithErrorLogging(() => { Trace("Attempting connection at port {0}...", _debuggerPort); _vm = VirtualMachineManager.Connect(new IPEndPoint(IPAddress.Loopback, _debuggerPort)); _vm.Suspend(); _vm.EnableEvents( EventType.AssemblyLoad, EventType.AssemblyUnload, EventType.AppDomainUnload, EventType.AppDomainCreate, EventType.VMDeath, EventType.VMDisconnect, EventType.TypeLoad ); _methodEntryRequest = _vm.CreateMethodEntryRequest(); StartEventLoop(); }); }
private VirtualMachine EndConnect(IAsyncResult ar) { _vm = VirtualMachineManager.EndConnect(ar); return(_vm); }
internal VirtualBoxVirtualMachine(VirtualMachineManager vmManager, IMachine vboxMachine) : base(vmManager) { this.vboxMachine = vboxMachine; }
static void Main(string[] args) { Console.WriteLine("Connecting"); var vm = VirtualMachineManager.Connect(new System.Net.IPEndPoint(System.Net.IPAddress.Loopback, 56000)); if (vm == null) { Console.WriteLine("Cannot connect to app"); } else { Console.WriteLine("Connected"); } foreach (var th in vm.GetThreads()) { vm.CreateStepRequest(th); } // vm.CreateAssemblyLoadRequest(); System.Threading.Thread.Sleep(2000); Console.WriteLine("Resuming"); // vm.Resume(); // vm.Suspend(); // var types = vm.GetTypesForSourceFile("Script.cs", true); var types = vm.GetTypes("CameraMoveClass.cs", true); foreach (var type in types) { Console.WriteLine($"{type.FullName}"); } // var method = types[0].GetMethod("ToggleEnableSkullScriptAction"); // var bp = vm.SetBreakpoint(method, 0); // Console.WriteLine("Breakpoint set"); // var locals = method.GetLocals(); while (true) { var evset = vm.GetNextEventSet(); if (evset.Events.Length > 0) { Console.WriteLine($"Recieved {evset.Events.Length} events"); foreach (var ev in evset.Events) { Console.WriteLine($"\t{ev}"); } } } }
protected override void OnRun(DebuggerStartInfo startInfo) { if (exited) { throw new InvalidOperationException("Already exited"); } var dsi = (SoftDebuggerStartInfo)startInfo; var runtime = Path.Combine(Path.Combine(dsi.MonoRuntimePrefix, "bin"), "mono"); RegisterUserAssemblies(dsi.UserAssemblyNames); var psi = new System.Diagnostics.ProcessStartInfo(runtime) { Arguments = string.Format("\"{0}\" {1}", dsi.Command, dsi.Arguments), WorkingDirectory = dsi.WorkingDirectory, RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false, CreateNoWindow = true, }; LaunchOptions options = null; if (dsi.UseExternalConsole && dsi.ExternalConsoleLauncher != null) { options = new LaunchOptions(); options.CustomTargetProcessLauncher = dsi.ExternalConsoleLauncher; psi.RedirectStandardOutput = false; psi.RedirectStandardError = false; } var sdbLog = Environment.GetEnvironmentVariable("MONODEVELOP_SDB_LOG"); if (!String.IsNullOrEmpty(sdbLog)) { options = options ?? new LaunchOptions(); options.AgentArgs = string.Format("loglevel=1,logfile='{0}'", sdbLog); } foreach (var env in dsi.MonoRuntimeEnvironmentVariables) { psi.EnvironmentVariables[env.Key] = env.Value; } foreach (var env in startInfo.EnvironmentVariables) { psi.EnvironmentVariables[env.Key] = env.Value; } if (!String.IsNullOrEmpty(dsi.LogMessage)) { OnDebuggerOutput(false, dsi.LogMessage + "\n"); } OnConnecting(VirtualMachineManager.BeginLaunch(psi, HandleCallbackErrors(delegate(IAsyncResult ar) { HandleConnection(VirtualMachineManager.EndLaunch(ar)); }), options )); }
public CoverHost(System.Net.IPEndPoint ip) : this(VirtualMachineManager.Connect(ip)) { launched = false; }
public CoverHost(params string[] args) : this(VirtualMachineManager.Launch(args, new LaunchOptions() { AgentArgs = "suspend=y" })) { launched = true; cmdargs = args; }
internal VirtualMachine(VirtualMachineManager vmManager) { this.vmManager = vmManager; }