public static MICommandFactory GetInstance(MIMode mode, Debugger debugger) { MICommandFactory commandFactory; switch (mode) { case MIMode.Gdb: commandFactory = new GdbMICommandyFactory(); break; case MIMode.Lldb: commandFactory = new LlldbMICommandFactory(); break; case MIMode.Clrdbg: commandFactory = new ClrdbgMICommandFactory(); break; default: throw new ArgumentException("mode"); } commandFactory._debugger = debugger; commandFactory.Mode = mode; commandFactory.Radix = 10; return(commandFactory); }
internal static bool GetRequiresRootAttach(MIMode mode) { // If "ptrace_scope" is a value other than 0, only root can attach to arbitrary processes if (GetPtraceScope() != 0) { return(true); // Attaching to any non-child process requires root } return(false); }
internal static bool GetRequiresRootAttach(MIMode mode) { if (mode != MIMode.Clrdbg) { // If "ptrace_scope" is a value other than 0, only root can attach to arbitrary processes if (GetPtraceScope() != 0) { return true; // Attaching to any non-child process requires root } } return false; }
public static MICommandFactory GetInstance(MIMode mode, Debugger debugger) { MICommandFactory commandFactory; switch (mode) { case MIMode.Gdb: commandFactory = new GdbMICommandFactory(); break; case MIMode.Lldb: commandFactory = new LlldbMICommandFactory(); break; case MIMode.Clrdbg: commandFactory = new ClrdbgMICommandFactory(); break; default: throw new ArgumentException("mode"); } commandFactory._debugger = debugger; commandFactory.Mode = mode; commandFactory.Radix = 10; return commandFactory; }
public static UnixShellPortLaunchOptions CreateForAttachRequest(Microsoft.VisualStudio.Debugger.Interop.UnixPortSupplier.IDebugUnixShellPort unixPort, int processId, MIMode miMode, string getClrDbgUrl, string remoteDebuggingDirectory, string remoteDebuggingSubDirectory, string debuggerVersion) { var @this = new UnixShellPortLaunchOptions(startRemoteDebuggerCommand: null, unixPort: unixPort, miMode: miMode, baseLaunchOptions: null, getClrDbgUrl: getClrDbgUrl, remoteDebuggerInstallationDirectory: remoteDebuggingDirectory, remoteDebuggerInstallationSubDirectory: remoteDebuggingSubDirectory, clrdbgVersion: debuggerVersion); @this.ProcessId = processId; @this.SetupCommands = new ReadOnlyCollection<LaunchCommand>(new LaunchCommand[] { }); @this.SetInitializationComplete(); return @this; }
public UnixShellPortLaunchOptions(string startRemoteDebuggerCommand, Microsoft.VisualStudio.Debugger.Interop.UnixPortSupplier.IDebugUnixShellPort unixPort, MIMode miMode, BaseLaunchOptions baseLaunchOptions, string getClrDbgUrl = null, string remoteDebuggerInstallationDirectory = null, string remoteDebuggerInstallationSubDirectory = null, string clrdbgVersion = null) { this.UnixPort = unixPort; this.DebuggerMIMode = miMode; if (!string.IsNullOrWhiteSpace(getClrDbgUrl)) { GetClrDbgUrl = getClrDbgUrl; } if (!string.IsNullOrWhiteSpace(remoteDebuggerInstallationDirectory)) { DebuggerInstallationDirectory = remoteDebuggerInstallationDirectory; } if (!string.IsNullOrWhiteSpace(remoteDebuggerInstallationSubDirectory)) { ClrDbgInstallationSubDirectory = remoteDebuggerInstallationSubDirectory; } if (!string.IsNullOrWhiteSpace(clrdbgVersion)) { ClrDbgVersion = clrdbgVersion; } if (string.IsNullOrEmpty(startRemoteDebuggerCommand)) { switch (miMode) { case MIMode.Gdb: startRemoteDebuggerCommand = "gdb --interpreter=mi"; break; case MIMode.Lldb: // TODO: Someday we should likely use a download script here too startRemoteDebuggerCommand = "lldb-mi --interpreter=mi"; break; case MIMode.Clrdbg: string debuggerHomeDirectory; if (DebuggerInstallationDirectory.StartsWith("/", StringComparison.OrdinalIgnoreCase)) { debuggerHomeDirectory = DebuggerInstallationDirectory; } else { string userHomeDirectory = UnixPort.GetUserHomeDirectory(); debuggerHomeDirectory = string.Format(CultureInfo.InvariantCulture, "{0}/{1}", userHomeDirectory, DebuggerInstallationDirectory); } if (!HasSuccessfulPreviousLaunch(this)) { startRemoteDebuggerCommand = string.Format(CultureInfo.InvariantCulture, ClrdbgFirstLaunchCommand, debuggerHomeDirectory, ClrDbgVersion, ClrDbgInstallationSubDirectory); } else { startRemoteDebuggerCommand = string.Format(CultureInfo.InvariantCulture, ClrdbgSubsequentLaunchCommand, debuggerHomeDirectory, ClrDbgVersion, ClrDbgInstallationSubDirectory); } break; default: throw new ArgumentOutOfRangeException("miMode"); } } this.StartRemoteDebuggerCommand = startRemoteDebuggerCommand; if (baseLaunchOptions != null) { this.InitializeCommonOptions(baseLaunchOptions); this.BaseOptions = baseLaunchOptions; } }