/// <summary> /// Test liczenia etapów dla jednego etapu i jednej sekwencji (pustej). /// </summary> public void TestOne() { ProcessStep uno = new ProcessStep("jeden"); Assertion.AssertEquals(1, uno.GetStepCount()); ProcessSequence nil = new ProcessSequence("nic"); Assertion.AssertEquals(0, nil.GetStepCount()); }
public void TestOne() { ProcessStep uno = new ProcessStep("uno"); Assert.AreEqual(1, uno.GetStepCount()); ProcessSequence nil = new ProcessSequence("nil"); Assert.AreEqual(0, nil.GetStepCount()); }
/// <summary> /// Zwraca ma³y przep³yw procesów pokazuj¹cy kompozyt niebêd¹cy /// drzewem. W tym przep³ywie A zawiera B, B zawiera C, a C zawiera A. /// </summary> /// <returns>ma³y przep³yw procesów pokazuj¹cy kompozyt niebêd¹cy drzewem</returns> public static ProcessComponent Cycle() { ProcessSequence a = new ProcessSequence("a"); ProcessSequence b = new ProcessSequence("b"); ProcessSequence c = new ProcessSequence("c"); a.Add(b); b.Add(c); c.Add(a); return(a); }
/* * a * |\ * | b * |/ * c */ /// <summary> /// Zwraca ma³y przep³yw procesów pokazuj¹cy kompozyt niebêd¹cy /// drzewem (ani przy okazji cyklem). W tym przep³ywie A zawiera C i B, /// a B zawiera C. /// </summary> /// <returns></returns> public static ProcessComponent Abc() { ProcessSequence a = new ProcessSequence("a"); ProcessSequence b = new ProcessSequence("b"); ProcessStep c = new ProcessStep("c"); a.Add(c); a.Add(b); b.Add(c); return(a); }
/// <summary> /// Test procesu powtarzanego raz: "umyæ, sp³ukaæ, powtórzyæ". /// </summary> public void TestShampoo() { ProcessStep shampoo = new ProcessStep("umyæ"); ProcessStep rinse = new ProcessStep("sp³ukaæ"); ProcessSequence once = new ProcessSequence("powtórzyæ"); once.Add(shampoo); once.Add(rinse); ProcessSequence instructions = new ProcessSequence("instrukcje"); instructions.Add(once); instructions.Add(once); Assertion.AssertEquals(2, instructions.GetStepCount()); }
/* * abc * / \ * a bc * / \ * b c */ /// <summary> /// Test zwyk³ego drzewka. /// </summary> public void TestTree() { ProcessStep a = new ProcessStep("a"); ProcessStep b = new ProcessStep("b"); ProcessStep c = new ProcessStep("c"); ProcessSequence bc = new ProcessSequence("bc"); bc.Add(b); bc.Add(c); ProcessSequence abc = new ProcessSequence("abc"); abc.Add(a); abc.Add(bc); Assertion.AssertEquals(3, abc.GetStepCount()); }
public void TestShampoo() { ProcessStep shampoo = new ProcessStep("shampoo"); ProcessStep rinse = new ProcessStep("rinse"); ProcessSequence once = new ProcessSequence("once"); once.Add(shampoo); once.Add(rinse); ProcessSequence instructions = new ProcessSequence("instructions"); instructions.Add(once); instructions.Add(once); Assert.AreEqual(2, instructions.GetStepCount()); }
void HandleSequences(GuiConfigDB conf) { foreach (CommandSequence cmdseq in conf.CmdSequenceList) { if (cmdseq.m_seqtype == CommandSequence.COMMAND_TYPE_GCODE) { GCodeSequence gcseq = new GCodeSequence(cmdseq.m_name, cmdseq.m_seq); SequenceManager.Instance().Add(gcseq); } if (cmdseq.m_seqtype == CommandSequence.COMMAND_TYPE_SPAWN_PROCESS) { ProcessSequence cast = (ProcessSequence)cmdseq; SequenceManager.Instance().Add(cast.Clone()); // insert a cloned copy into the sequencemanager } } }
private List<LaunchCommand> GetInitializeCommands() { List<LaunchCommand> commands = new List<LaunchCommand>(); commands.AddRange(_launchOptions.SetupCommands); // If the absolute prefix so path has not been specified, then don't set it to null // because the debugger might already have a default. if (!string.IsNullOrEmpty(_launchOptions.AbsolutePrefixSOLibSearchPath)) { commands.Add(new LaunchCommand("-gdb-set solib-absolute-prefix " + _launchOptions.AbsolutePrefixSOLibSearchPath)); } // On Windows ';' appears to correctly works as a path seperator and from the documentation, it is ':' on unix string pathEntrySeperator = _launchOptions.UseUnixSymbolPaths ? ":" : ";"; string escappedSearchPath = string.Join(pathEntrySeperator, _launchOptions.GetSOLibSearchPath().Select(path => EscapePath(path, ignoreSpaces: true))); if (!string.IsNullOrWhiteSpace(escappedSearchPath)) { if (_launchOptions.DebuggerMIMode == MIMode.Gdb) { // Do not place quotes around so paths for gdb commands.Add(new LaunchCommand("-gdb-set solib-search-path " + escappedSearchPath + pathEntrySeperator, ResourceStrings.SettingSymbolSearchPath)); } else { // surround so lib path with quotes in other cases commands.Add(new LaunchCommand("-gdb-set solib-search-path \"" + escappedSearchPath + pathEntrySeperator + "\"", ResourceStrings.SettingSymbolSearchPath)); } } if (this.MICommandFactory.SupportsStopOnDynamicLibLoad()) { // Do not stop on shared library load/unload events while debugging core dump. // Also check _needTerminalReset because we need to work around a GDB bug and clear the terminal error message. // This clear operation can't be done too early (because GDB only generate this message after start debugging) // or too late (otherwise we might clear debuggee's output). // The stop cause by first module load seems to be the perfect timing to clear the terminal, // that's why we still need to initially turn stop-on-solib-events on then turn it off after the first stop. if ((_needTerminalReset || _launchOptions.WaitDynamicLibLoad) && !this.IsCoreDump) { commands.Add(new LaunchCommand("-gdb-set stop-on-solib-events 1")); } } if (MICommandFactory.SupportsChildProcessDebugging()) { if (_launchOptions.DebugChildProcesses) { _childProcessHandler = new DebugUnixChild(this, this._launchOptions); // TODO: let the user enable/disable this functionality } } // Custom launch options replace the built in launch steps. This is used on iOS // and Linux attach scenarios. if (_launchOptions.CustomLaunchSetupCommands != null) { commands.AddRange(_launchOptions.CustomLaunchSetupCommands); SetTargetArch(_launchOptions.TargetArchitecture); } else { LocalLaunchOptions localLaunchOptions = _launchOptions as LocalLaunchOptions; if (this.IsCoreDump) { // Add executable information this.AddExecutablePathCommand(commands); // Important: this must occur after file-exec-and-symbols but before anything else. this.AddGetTargetArchitectureCommand(commands); // Add core dump information (linux/mac does not support quotes around this path but spaces in the path do work) string coreDump = _launchOptions.UseUnixSymbolPaths ? _launchOptions.CoreDumpPath : EscapePath(_launchOptions.CoreDumpPath); string coreDumpCommand = _launchOptions.DebuggerMIMode == MIMode.Lldb ? String.Concat("target create --core ", coreDump) : String.Concat("-target-select core ", coreDump); string coreDumpDescription = String.Format(CultureInfo.CurrentCulture, ResourceStrings.LoadingCoreDumpMessage, _launchOptions.CoreDumpPath); commands.Add(new LaunchCommand(coreDumpCommand, coreDumpDescription, ignoreFailures: false)); } else if (_launchOptions.ProcessId != 0) { // This is an attach CheckCygwin(commands, localLaunchOptions); // ClrDbg doesn't need -file-exec-and-symbols set. if (this.MICommandFactory.Mode == MIMode.Gdb) { if (_launchOptions is UnixShellPortLaunchOptions) { // This code path is probably applicable when the ExePath is not specified and can be used to determine the full executable path. // For now it is limited to Linux and debugger running on remote machine. Debug.Assert(_launchOptions.ExePath == null); DetermineAndAddExecutablePathCommand(commands, _launchOptions as UnixShellPortLaunchOptions); } else { this.AddExecutablePathCommand(commands); } } // Important: this must occur after file-exec-and-symbols but before anything else. this.AddGetTargetArchitectureCommand(commands); // check for remote string destination = localLaunchOptions?.MIDebuggerServerAddress; if (!string.IsNullOrEmpty(destination)) { commands.Add(new LaunchCommand("-target-select remote " + destination, string.Format(CultureInfo.CurrentUICulture, ResourceStrings.ConnectingMessage, destination))); } Action<string> failureHandler = (string miError) => { if (miError.Trim().StartsWith("ptrace:", StringComparison.OrdinalIgnoreCase)) { string message = string.Format(CultureInfo.CurrentUICulture, ResourceStrings.Error_PTraceFailure, _launchOptions.ProcessId, MICommandFactory.Name, miError); throw new LaunchErrorException(message); } else { string message = string.Format(CultureInfo.CurrentUICulture, ResourceStrings.Error_ExePathInvalid, _launchOptions.ExePath, MICommandFactory.Name, miError); throw new LaunchErrorException(message); } }; commands.Add(new LaunchCommand("-target-attach " + _launchOptions.ProcessId, ignoreFailures: false, failureHandler: failureHandler)); if (this.MICommandFactory.Mode == MIMode.Lldb) { // LLDB finishes attach in break mode. Gdb does finishes in run mode. Issue a continue in lldb to match the gdb behavior commands.Add(new LaunchCommand("-exec-continue", ignoreFailures: false)); } return commands; } else { // The default launch is to start a new process if (!string.IsNullOrWhiteSpace(_launchOptions.WorkingDirectory)) { string escappedDir = EscapePath(_launchOptions.WorkingDirectory); commands.Add(new LaunchCommand("-environment-cd " + escappedDir)); } // TODO: The last clause for LLDB may need to be changed when we support LLDB on Linux if (localLaunchOptions != null && this.MICommandFactory.UseExternalConsoleForLocalLaunch(localLaunchOptions) && (PlatformUtilities.IsWindows() || (PlatformUtilities.IsOSX() && this.MICommandFactory.Mode == MIMode.Lldb))) { commands.Add(new LaunchCommand("-gdb-set new-console on", ignoreFailures: true)); } CheckCygwin(commands, localLaunchOptions); // Send client version to clrdbg to set the capabilities appropriately if (this.MICommandFactory.Mode == MIMode.Clrdbg) { string version = string.Empty; var attribute = this.GetType().GetTypeInfo().Assembly.GetCustomAttribute(typeof(System.Reflection.AssemblyFileVersionAttribute)) as AssemblyFileVersionAttribute; if (attribute != null) { version = attribute.Version; } commands.Add(new LaunchCommand("-gdb-set client-version \"" + version + "\"")); commands.Add(new LaunchCommand("-gdb-set client-ui \"" + Host.GetHostUIIdentifier().ToString() + "\"")); } this.AddExecutablePathCommand(commands); // Important: this must occur after file-exec-and-symbols but before anything else. this.AddGetTargetArchitectureCommand(commands); // LLDB requires -exec-arguments after -file-exec-and-symbols has been run, or else it errors if (!string.IsNullOrWhiteSpace(_launchOptions.ExeArguments)) { commands.Add(new LaunchCommand("-exec-arguments " + _launchOptions.ExeArguments)); } commands.Add(new LaunchCommand("-break-insert main", ignoreFailures: true)); if (null != localLaunchOptions) { string destination = localLaunchOptions.MIDebuggerServerAddress; if (!string.IsNullOrEmpty(destination)) { commands.Add(new LaunchCommand("-target-select remote " + destination, string.Format(CultureInfo.CurrentUICulture, ResourceStrings.ConnectingMessage, destination))); } // Environment variables are set for the debuggee only with the modes that support that if (this.MICommandFactory.Mode != MIMode.Clrdbg) { foreach (EnvironmentEntry envEntry in localLaunchOptions.Environment) { commands.Add(new LaunchCommand(MICommandFactory.GetSetEnvironmentVariableCommand(envEntry.Name, envEntry.Value))); } } } } } return commands; }
private List<LaunchCommand> GetInitializeCommands() { List<LaunchCommand> commands = new List<LaunchCommand>(); commands.AddRange(_launchOptions.SetupCommands); // If the absolute prefix so path has not been specified, then don't set it to null // because the debugger might already have a default. if (!string.IsNullOrEmpty(_launchOptions.AbsolutePrefixSOLibSearchPath)) { commands.Add(new LaunchCommand("-gdb-set solib-absolute-prefix " + _launchOptions.AbsolutePrefixSOLibSearchPath)); } // On Windows ';' appears to correctly works as a path seperator and from the documentation, it is ':' on unix string pathEntrySeperator = _launchOptions.UseUnixSymbolPaths ? ":" : ";"; string escappedSearchPath = string.Join(pathEntrySeperator, _launchOptions.GetSOLibSearchPath().Select(path => EscapePath(path, ignoreSpaces: true))); if (!string.IsNullOrWhiteSpace(escappedSearchPath)) { if (_launchOptions.DebuggerMIMode == MIMode.Gdb) { // Do not place quotes around so paths for gdb commands.Add(new LaunchCommand("-gdb-set solib-search-path " + escappedSearchPath + pathEntrySeperator, ResourceStrings.SettingSymbolSearchPath)); } else { // surround so lib path with quotes in other cases commands.Add(new LaunchCommand("-gdb-set solib-search-path \"" + escappedSearchPath + pathEntrySeperator + "\"", ResourceStrings.SettingSymbolSearchPath)); } } if (this.MICommandFactory.SupportsStopOnDynamicLibLoad()) { // Do not stop on shared library load/unload events while debugging core dump. // Also check _needTerminalReset because we need to work around a GDB bug and clear the terminal error message. // This clear operation can't be done too early (because GDB only generate this message after start debugging) // or too late (otherwise we might clear debuggee's output). // The stop cause by first module load seems to be the perfect timing to clear the terminal, // that's why we still need to initially turn stop-on-solib-events on then turn it off after the first stop. if ((_needTerminalReset || _launchOptions.WaitDynamicLibLoad) && !this.IsCoreDump) { commands.Add(new LaunchCommand("-gdb-set stop-on-solib-events 1")); } } if (MICommandFactory.SupportsChildProcessDebugging()) { if (_launchOptions.DebugChildProcesses) { _childProcessHandler = new DebugUnixChild(this, this._launchOptions); // TODO: let the user enable/disable this functionality } } // Custom launch options replace the built in launch steps. This is used on iOS // and Linux attach scenarios. if (_launchOptions.CustomLaunchSetupCommands != null) { commands.AddRange(_launchOptions.CustomLaunchSetupCommands); } else { LocalLaunchOptions localLaunchOptions = _launchOptions as LocalLaunchOptions; if (this.IsCoreDump) { // Add executable information this.AddExecutablePathCommand(commands); // Add core dump information (linux/mac does not support quotes around this path but spaces in the path do work) string coreDump = _launchOptions.UseUnixSymbolPaths ? _launchOptions.CoreDumpPath : EscapePath(_launchOptions.CoreDumpPath); string coreDumpCommand = _launchOptions.DebuggerMIMode == MIMode.Lldb ? String.Concat("target create --core ", coreDump) : String.Concat("-target-select core ", coreDump); string coreDumpDescription = String.Format(CultureInfo.CurrentCulture, ResourceStrings.LoadingCoreDumpMessage, _launchOptions.CoreDumpPath); commands.Add(new LaunchCommand(coreDumpCommand, coreDumpDescription, ignoreFailures: false)); } else if (_launchOptions.ProcessId != 0) { // This is an attach CheckCygwin(commands, localLaunchOptions); // check for remote string destination = localLaunchOptions?.MIDebuggerServerAddress; if (!string.IsNullOrEmpty(destination)) { commands.Add(new LaunchCommand("-target-select remote " + destination, string.Format(CultureInfo.CurrentUICulture, ResourceStrings.ConnectingMessage, destination))); } int pid = localLaunchOptions.ProcessId; commands.Add(new LaunchCommand(String.Format(CultureInfo.CurrentUICulture, "-target-attach {0}", pid), ignoreFailures: false)); if (this.MICommandFactory.Mode == MIMode.Lldb) { // LLDB finishes attach in break mode. Gdb does finishes in run mode. Issue a continue in lldb to match the gdb behavior commands.Add(new LaunchCommand("-exec-continue", ignoreFailures: false)); } return commands; } else { // The default launch is to start a new process if (!string.IsNullOrWhiteSpace(_launchOptions.ExeArguments)) { commands.Add(new LaunchCommand("-exec-arguments " + _launchOptions.ExeArguments)); } if (!string.IsNullOrWhiteSpace(_launchOptions.WorkingDirectory)) { string escappedDir = EscapePath(_launchOptions.WorkingDirectory); commands.Add(new LaunchCommand("-environment-cd " + escappedDir)); } if (localLaunchOptions != null && PlatformUtilities.IsWindows() && this.MICommandFactory.UseExternalConsoleForLocalLaunch(localLaunchOptions)) { commands.Add(new LaunchCommand("-gdb-set new-console on", ignoreFailures: true)); } CheckCygwin(commands, localLaunchOptions); // Send client version to clrdbg to set the capabilities appropriately if (this.MICommandFactory.Mode == MIMode.Clrdbg) { string version = string.Empty; var attribute = this.GetType().GetTypeInfo().Assembly.GetCustomAttribute(typeof(System.Reflection.AssemblyFileVersionAttribute)) as AssemblyFileVersionAttribute; if (attribute != null) { version = attribute.Version; } commands.Add(new LaunchCommand("-gdb-set client-version \"" + version + "\"")); } this.AddExecutablePathCommand(commands); commands.Add(new LaunchCommand("-break-insert main", ignoreFailures: true)); if (null != localLaunchOptions) { string destination = localLaunchOptions.MIDebuggerServerAddress; if (!string.IsNullOrEmpty(destination)) { commands.Add(new LaunchCommand("-target-select remote " + destination, string.Format(CultureInfo.CurrentUICulture, ResourceStrings.ConnectingMessage, destination))); } } } } return commands; }
/// <summary> /// Dodaje sekwencjê operacji do bufora wyjœciowego. /// </summary> /// <param name="s">sekwencja</param> public void Visit(ProcessSequence s) { VisitComposite("", s); }