protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (UnityDebuggerStartInfo)startInfo; StartUnity(dsi); StartListening(dsi); }
protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (MeeGoSoftDebuggerStartInfo)startInfo; StartProcess(dsi); StartListening(dsi); }
private void StartProcess(DebuggerStartInfo startInfo) { var psi = new ProcessStartInfo(startInfo.Command) { Arguments = string.Format(startInfo.Arguments), UseShellExecute = false, RedirectStandardOutput = true, CreateNoWindow = true, WorkingDirectory = startInfo.WorkingDirectory, }; proc = Process.Start(psi); appout = proc.StandardOutput; proc.EnableRaisingEvents = true; proc.Exited += delegate { Exit(); }; LogWriter(false, "Process started\n"); appthread = new Thread(AppOutput); appthread.Name = "Application output interpeter"; appthread.IsBackground = true; appthread.Start(); }
internal static void InternalRun(ExecutionCommand cmd, DebuggerEngine factory, IConsole c) { if (factory == null) { factory = GetFactoryForCommand(cmd); if (factory == null) { throw new InvalidOperationException("Unsupported command: " + cmd); } } DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo(cmd); startInfo.UseExternalConsole = c is ExternalConsole; startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose; currentEngine = factory; session = factory.CreateSession(); session.Initialize(); console = c; SetupSession(); try { session.Run(startInfo, GetUserOptions()); } catch { Cleanup(); throw; } }
protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (MonoMacDebuggerStartInfo)startInfo; var startArgs = (SoftDebuggerRemoteArgs)dsi.StartArgs; var cmd = dsi.ExecutionCommand; int assignedPort; StartListening(dsi, out assignedPort); Action <string> stdout = s => OnTargetOutput(false, s); Action <string> stderr = s => OnTargetOutput(true, s); var asi = new ApplicationStartInfo(cmd.AppPath); asi.Environment ["MONOMAC_DEBUGLAUNCHER_OPTIONS"] = string.Format("--debug --debugger-agent=transport=dt_socket,address={0}:{1}", startArgs.Address, assignedPort); process = MonoMacExecutionHandler.OpenApplication(cmd, asi, stdout, stderr); process.Completed += delegate { EndSession(); process = null; }; }
protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (MonoMacDebuggerStartInfo)startInfo; var cmd = dsi.ExecutionCommand; StartListening(dsi); var psi = new ProcessStartInfo(cmd.LaunchScript) { Arguments = "", RedirectStandardOutput = true, RedirectStandardError = true, UseShellExecute = false }; psi.EnvironmentVariables["MONO_OPTIONS"] = string.Format("--debug --debugger-agent=transport=dt_socket,address={0}:{1}", dsi.Address, dsi.DebugPort); process = System.Diagnostics.Process.Start(psi); ConnectOutput(process.StandardOutput, false); ConnectOutput(process.StandardError, true); process.EnableRaisingEvents = true; process.Exited += delegate { EndSession(); process = null; }; }
protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (MoonlightDebuggerStartInfo)startInfo; StartBrowserProcess(dsi); StartListening(dsi); }
protected override string GetConnectingMessage(DebuggerStartInfo dsi) { Ide.DispatchService.GuiDispatch(() => Ide.IdeApp.Workbench.CurrentLayout = "Debug" ); return(base.GetConnectingMessage(dsi)); }
protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (MoonlightDebuggerStartInfo)startInfo; int assignedDebugPort; StartListening(dsi, out assignedDebugPort); StartBrowserProcess(dsi, assignedDebugPort); }
/*protected override string GetConnectingMessage (SoftDebuggerStartInfo dsi) * { * return string.Format ("Waiting for debugger to connect on {0}:{1}...", dsi.Address, dsi.DebugPort); * }*/ protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (MonoBrickSoftDebuggerStartInfo)startInfo; StartProcess(dsi); Thread.Sleep(500); StartConnecting(dsi); }
protected override void OnRun(DebuggerStartInfo startInfo) { base.OnRun(startInfo); UseOperationThread = true; Project startupProject = ((Mono.Debugging.VisualStudio.StartInfo)startInfo).StartupProject; IVsHierarchy hierarchy = startupProject.ToHierarchy(); IProjectNode node = startupProject.AsProjectNode(); BuildPropertyStorage storage = new BuildPropertyStorage(hierarchy, node.Configuration.ActiveConfigurationName); var enableAotMode = storage.GetPropertyValue <bool>(XamarinWindowsConstants.EnableAotModeProperty); var bundleAsemblies = storage.GetPropertyValue <bool>(XamarinWindowsConstants.BundleAssembliesProperty); var generateDebuggableAotModules = storage.GetPropertyValue <bool>(XamarinWindowsConstants.GenerateDebuggableAotModulesProperty); var additionalMonoOptions = storage.GetPropertyValue <string>(XamarinWindowsConstants.AdditionalMonoOptionsProperty)?.Trim(); var monoLogLevel = storage.GetPropertyValue <string>(XamarinWindowsConstants.MonoLogLevelProperty); var monoLogMask = storage.GetPropertyValue <string>(XamarinWindowsConstants.MonoLogMaskProperty); var startArguments = startupProject.ConfigurationManager.ActiveConfiguration.Properties.Item("StartArguments").Value.ToString(); var assemblyPath = GetOutputAssembly(startupProject, enableAotMode, generateDebuggableAotModules); var monoDirectory = Path.Combine(GetInstallPath(), @"MSBuild\Xamarin\Windows\x64\Release"); var monoPath = Path.Combine(GetInstallPath(), @"Common7\IDE\ReferenceAssemblies\Microsoft\Framework\Xamarin.Windows\v1.0"); var args = ((Mono.Debugging.VisualStudio.StartInfo)startInfo).StartArgs as SoftDebuggerListenArgs; process = new System.Diagnostics.Process(); var workingDirectory = Path.GetDirectoryName(assemblyPath); var monoOptions = $"--debug --debugger-agent=transport=dt_socket,address=127.0.0.1:{args.DebugPort}"; if (!string.IsNullOrEmpty(additionalMonoOptions)) { monoOptions += " " + additionalMonoOptions; } if (!enableAotMode) { process.StartInfo = new ProcessStartInfo(Path.Combine(monoDirectory, "mono-sgen.exe"), monoOptions + $" \"{assemblyPath}\" {startArguments}".TrimEnd()); } else { IVsBuildPropertyStorage buildPropertyStorage = (IVsBuildPropertyStorage)hierarchy; string nativeProjectName = buildPropertyStorage.GetMSBuildPropertyValue("_XWNativeProjectName", null); var launcherExe = Path.Combine(workingDirectory, nativeProjectName + ".exe"); process.StartInfo = new ProcessStartInfo(launcherExe, startArguments); process.StartInfo.EnvironmentVariables["MONO_BUNDLED_OPTIONS"] = monoOptions; } process.StartInfo.WorkingDirectory = workingDirectory; process.StartInfo.UseShellExecute = false; if (!string.IsNullOrEmpty(monoLogLevel)) { process.StartInfo.EnvironmentVariables["MONO_LOG_LEVEL"] = monoLogLevel; } if (!string.IsNullOrEmpty(monoLogMask)) { process.StartInfo.EnvironmentVariables["MONO_LOG_MASK"] = monoLogMask; } process.StartInfo.EnvironmentVariables["MONO_PATH"] = monoPath; process.Start(); }
protected override void OnRun(DebuggerStartInfo startInfo) { started = true; MonoDebuggerStartInfo info = (MonoDebuggerStartInfo)startInfo; controller.StartDebugger(info); InitMdbVersion(info.MonoPrefix); controller.DebuggerServer.Run(info, Options); }
protected void Launch(DebuggerStartInfo startInfo) { pauseWhenFinished = !startInfo.CloseExternalConsoleOnExit; StartDebugAgent(); LaunchRequest launchRequest = CreateLaunchRequest(startInfo); protocolClient.SendRequestSync(launchRequest); protocolClient.SendRequestSync(new ConfigurationDoneRequest()); }
protected DebuggerSession Start(string test) { DotNetExecutionCommand cmd = new DotNetExecutionCommand(); cmd.Command = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "MonoDevelop.Debugger.Tests.TestApp.exe"); cmd.Arguments = test; DebuggerStartInfo si = engine.CreateDebuggerStartInfo(cmd); DebuggerSession session = engine.CreateSession(); DebuggerSessionOptions ops = new DebuggerSessionOptions(); ops.EvaluationOptions = EvaluationOptions.DefaultOptions; ops.EvaluationOptions.EvaluationTimeout = 100000; FilePath path = Util.TestsRootDir; path = path.ParentDirectory.Combine("src", "addins", "MonoDevelop.Debugger", "MonoDevelop.Debugger.Tests.TestApp", "Main.cs").FullPath; TextFile file = TextFile.ReadFile(path); int i = file.Text.IndexOf("void " + test); if (i == -1) { throw new Exception("Test not found: " + test); } i = file.Text.IndexOf("/*break*/", i); if (i == -1) { throw new Exception("Break marker not found: " + test); } int line, col; file.GetLineColumnFromPosition(i, out line, out col); Breakpoint bp = session.Breakpoints.Add(path, line); bp.Enabled = true; ManualResetEvent done = new ManualResetEvent(false); session.OutputWriter = delegate(bool isStderr, string text) { Console.WriteLine("PROC:" + text); }; session.TargetHitBreakpoint += delegate { done.Set(); }; session.Run(si, ops); if (!done.WaitOne(3000)) { throw new Exception("Timeout while waiting for initial breakpoint"); } return(session); }
protected override void OnRun(DebuggerStartInfo startInfo) { var mfStartInfo = startInfo as MicroFrameworkDebuggerStartInfo; if (mfStartInfo == null) //This should never happen... { throw new InvalidOperationException(); } var command = mfStartInfo.MFCommand; var portDefinition = ((MicroFrameworkExecutionTarget)command.Target).PortDefinition; using (var deployEngine = new Engine(portDefinition)) { deployEngine.Start(); string newCommand = "/CorDebug_DeployDeviceName:" + portDefinition.PersistName; var listOfAseemblies = new ArrayList(); //TODO: Check if this is robust enough will "be" and "le" really always be in output folder? OutputDirectory = command.OutputDirectory; string dir = command.OutputDirectory; if (deployEngine.IsTargetBigEndian) { dir = Path.Combine(dir, "be"); } else { dir = Path.Combine(dir, "le"); } string[] files = Directory.GetFiles(dir, "*.pe"); foreach (var file in files) { newCommand = "/load:" + file + " " + newCommand; using (var fs = new FileStream(file, FileMode.Open)) { byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Length); listOfAseemblies.Add(data); } } startInfo.Command = newCommand; deployEngine.Deployment_Execute(listOfAseemblies, false, (str) => OnDebuggerOutput(false, "Deploy: " + str + Environment.NewLine)); deployEngine.RebootDevice(Engine.RebootOption.RebootClrWaitForDebugger); } VsPackage.MessageCentre.Session = this; try { CorDebugProcess process = CorDebugProcess.CreateProcess(new DebugPortSupplier().FindPort("USB"), startInfo.Command); process.StartDebugging(this, false); // StartDebugging() will either get a connected device into a debuggable state and start the dispatch thread, or throw. } catch (ProcessExitException) { VsPackage.MessageCentre.DeploymentMsg(DiagnosticStrings.InitializeProcessFailedProcessDied); } catch (Exception ex) { VsPackage.MessageCentre.DeploymentMsg(DiagnosticStrings.InitializeProcessFailed); VsPackage.MessageCentre.InternalErrorMsg(false, ex.Message); } }
protected override void OnRun(DebuggerStartInfo startInfo) { var ceStartInfo = (CryEngineSoftDebuggerStartInfo)startInfo; var instancePort = Launch(ceStartInfo); var instanceStartInfo = PrepareInstanceStartInfo(instancePort); StartConnecting(instanceStartInfo, 5000, 20); }
protected override void OnRun(DebuggerStartInfo startInfo) { targetProcessId = 0; StartDebuggerSession(startInfo, 0); OnStarted(); WaitForDebugEvent(); // Wait for the first breakpoint/exception/program exit to occur }
protected override LaunchRequest CreateLaunchRequest(DebuggerStartInfo startInfo) { var properties = new Dictionary <string, JToken>(); properties.Add("args", JToken.FromObject(startInfo.Arguments.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))); properties.Add("program", JToken.FromObject(startInfo.Command)); var result = new LaunchRequest(); result.Args.ConfigurationProperties = properties; return(result); }
protected override void OnRun(DebuggerStartInfo startInfo) { var dsi = (IPhoneDebuggerStartInfo)startInfo; var cmd = dsi.ExecutionCommand; if (cmd.Simulator) { StartSimulatorProcess(cmd); } StartListening(dsi); }
internal static void InternalRun(ExecutionCommand cmd, DebuggerEngine factory, IConsole c) { if (factory == null) { factory = GetFactoryForCommand(cmd); if (factory == null) { throw new InvalidOperationException("Unsupported command: " + cmd); } } if (session != null) { throw new InvalidOperationException("A debugger session is already started"); } DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo(cmd); startInfo.UseExternalConsole = c is ExternalConsole; startInfo.CloseExternalConsoleOnExit = c.CloseOnDispose; currentEngine = factory; session = factory.CreateSession(); session.ExceptionHandler = ExceptionHandler; // When using an external console, create a new internal console which will be used // to show the debugger log if (startInfo.UseExternalConsole) { console = (IConsole)IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor(); } else { console = c; } SetupSession(); // Dispatch synchronously to avoid start/stop races DispatchService.GuiSyncDispatch(delegate { oldLayout = IdeApp.Workbench.CurrentLayout; IdeApp.Workbench.CurrentLayout = "Debug"; }); try { session.Run(startInfo, GetUserOptions()); } catch { Cleanup(); throw; } }
protected override void OnRun(DebuggerStartInfo startInfo) { targetProcessId = 0; StartDebuggerSession(startInfo, 0); targetProcessId = debuggee.GetProcessId(); OnStarted(); debuggee.Continue(); }
void StartDebuggerSession(DebuggerStartInfo startInfo, long attachToProcessId) { IsDebugging = true; debuggeeEvent = new ManualResetEvent(false); debuggee = new Debuggee(); RegisterCallbacks(); Engine.LaunchExecutable(startInfo.Command + (string.IsNullOrWhiteSpace(startInfo.Arguments) ? "" : (" " + startInfo.Arguments)), Path.GetDirectoryName(startInfo.Command), debuggee); WaitForDebugEvent(); }
public DebuggerStartInfo GetDebuggerStartInfo(IProject project) { var startInfo = new DebuggerStartInfo() { Command = "dotnet" + Platforms.Platform.ExecutableExtension, Arguments = project.Executable, WorkingDirectory = System.IO.Path.GetDirectoryName(project.Executable), UseExternalConsole = false, CloseExternalConsoleOnExit = true }; return(startInfo); }
protected override string GetConnectingMessage(DebuggerStartInfo dsi) { var iphDsi = (IPhoneDebuggerStartInfo)dsi; var args = (SoftDebuggerListenArgs)iphDsi.StartArgs; string message = GettextCatalog.GetString("Waiting for debugger to connect on {0}:{1}...", args.Address, args.DebugPort); if (!iphDsi.ExecutionCommand.Simulator) { message += "\n" + GettextCatalog.GetString("Please start the application on the device."); } return(message); }
public DebuggerStartInfo GetDebuggerStartInfo(IProject project) { var startInfo = new DebuggerStartInfo() { Command = Path.Combine(project.CurrentDirectory, project.Executable).ToPlatformPath(), Arguments = "", WorkingDirectory = System.IO.Path.GetDirectoryName(Path.Combine(project.CurrentDirectory, project.Executable)), UseExternalConsole = false, CloseExternalConsoleOnExit = true }; return(startInfo); }
void StartDebuggerSession(DebuggerStartInfo startInfo, long attachToProcessId) { IsDebugging = true; EngineStarting = true; bool showConsole = false; DebugCreateProcessOptions opt = new DebugCreateProcessOptions(); if (attachToProcessId == 0) { opt.CreateFlags = CreateFlags.DebugOnlyThisProcess | (showConsole ? CreateFlags.CreateNewConsole : 0); opt.EngCreateFlags = EngCreateFlags.Default; } if (attachToProcessId != 0) { Engine.CreateProcessAndAttach(0, null, opt, null, null, (uint)attachToProcessId, AttachFlags.InvasiveNoInitialBreak); } else { Engine.CreateProcessAndAttach(0, startInfo.Command + (string.IsNullOrWhiteSpace(startInfo.Arguments) ? "" : (" " + startInfo.Arguments)), opt, Path.GetDirectoryName(startInfo.Command), "", 0, 0); Engine.Symbols.SourcePath = (string.IsNullOrWhiteSpace(startInfo.WorkingDirectory)) ? Path.GetDirectoryName(startInfo.Command) : startInfo.WorkingDirectory; Engine.Symbols.SymbolPath = startInfo.WorkingDirectory; } Engine.IsSourceCodeOrientedStepping = true; Engine.WaitForEvent(); Engine.Execute("bc"); // Clear breakpoint list Engine.Execute("ld *"); // Extraordinarily important: Load symbols for all modules! - Only then, the stuff from the .pdb seems to get loaded into the debug environment Engine.WaitForEvent(); foreach (Breakpoint bp in Breakpoints) { ulong off = 0; if (!Engine.Symbols.GetOffsetByLine(bp.FileName, (uint)bp.Line, out off)) { continue; } Engine.AddBreakPoint(BreakPointOptions.Enabled).Offset = off; //bp.Breakpoint = DebugManagement.Engine.AddBreakPoint(BreakPointOptions.Enabled); //bp.Breakpoint.Offset = off; } EngineStarting = false; }
internal static void InternalRun(ExecutionCommand cmd, DebuggerEngine factory, OperationConsole c) { if (factory == null) { factory = GetFactoryForCommand(cmd); if (factory == null) { throw new InvalidOperationException("Unsupported command: " + cmd); } } if (session != null) { throw new InvalidOperationException("A debugger session is already started"); } DebuggerStartInfo startInfo = factory.CreateDebuggerStartInfo(cmd); startInfo.UseExternalConsole = c is ExternalConsole; if (startInfo.UseExternalConsole) { startInfo.CloseExternalConsoleOnExit = ((ExternalConsole)c).CloseOnDispose; } currentEngine = factory; session = factory.CreateSession(); session.ExceptionHandler = ExceptionHandler; // When using an external console, create a new internal console which will be used // to show the debugger log if (startInfo.UseExternalConsole) { console = IdeApp.Workbench.ProgressMonitors.GetRunProgressMonitor().Console; } else { console = c; } SetupSession(); SetDebugLayout(); try { session.Run(startInfo, GetUserOptions()); } catch { Cleanup(); throw; } }
public void SetMessage(DebuggerStartInfo dsi, string message, bool listening, int attemptNumber) { //FIXME: we don't support changing the message if (disposed || cts != null) { return; } cts = new System.Threading.CancellationTokenSource(); //MessageService is threadsafe but we want this to be async Gtk.Application.Invoke(delegate { RunDialog(message); }); }
protected override void OnRun(DebuggerStartInfo startInfo) { //StopExecution(); StartDebuggerSession(startInfo, 0); //currentProcessName = startInfo.Command + " " + startInfo.Arguments; currentProcessName = startInfo.Command + ".exe" + " " + startInfo.Arguments; //currentProcessName = "console1.exe"; OnStarted(); WaitForDebugEvent(); // Wait for the first breakpoint/exception/program exit to occur }
protected override void OnRun(DebuggerStartInfo startInfo) { // Create the debugger string dversion = CorDebugger.GetDebuggerVersionFromFile(startInfo.Command); dbg = new CorDebugger(dversion); Dictionary <string, string> env = new Dictionary <string, string> (); foreach (DictionaryEntry de in Environment.GetEnvironmentVariables()) { env[(string)de.Key] = (string)de.Value; } foreach (KeyValuePair <string, string> var in startInfo.EnvironmentVariables) { env[var.Key] = var.Value; } // The second parameter of CreateProcess is the command line, and it includes the application being launched string cmdLine = "\"" + startInfo.Command + "\" " + startInfo.Arguments; process = dbg.CreateProcess(startInfo.Command, cmdLine, startInfo.WorkingDirectory, env); processId = process.Id; process.OnCreateProcess += new CorProcessEventHandler(OnCreateProcess); process.OnCreateAppDomain += new CorAppDomainEventHandler(OnCreateAppDomain); process.OnAssemblyLoad += new CorAssemblyEventHandler(OnAssemblyLoad); process.OnAssemblyUnload += new CorAssemblyEventHandler(OnAssemblyUnload); process.OnCreateThread += new CorThreadEventHandler(OnCreateThread); process.OnThreadExit += new CorThreadEventHandler(OnThreadExit); process.OnModuleLoad += new CorModuleEventHandler(OnModuleLoad); process.OnModuleUnload += new CorModuleEventHandler(OnModuleUnload); process.OnProcessExit += new CorProcessEventHandler(OnProcessExit); process.OnUpdateModuleSymbols += new UpdateModuleSymbolsEventHandler(OnUpdateModuleSymbols); process.OnDebuggerError += new DebuggerErrorEventHandler(OnDebuggerError); process.OnBreakpoint += new BreakpointEventHandler(OnBreakpoint); process.OnStepComplete += new StepCompleteEventHandler(OnStepComplete); process.OnBreak += new CorThreadEventHandler(OnBreak); process.OnNameChange += new CorThreadEventHandler(OnNameChange); process.OnEvalComplete += new EvalEventHandler(OnEvalComplete); process.OnEvalException += new EvalEventHandler(OnEvalException); process.Continue(false); OnStarted(); }