public void Validate() { if (DumpedProcess.WasSpecified) { JobFactoryHelpers.ValidateDumpFilePathForInput(JobFactoryHelpers.GetDumpFilePath(DumpedProcess.DumpFile)); } }
public IDebugJob CreateJob(ConsoleLog console) { var process = JobFactoryHelpers.TryResolveTargetProcess(RunningProcess, console); var debugTarget = new DebugRunningProcess(process, DebugMode.Snapshot); var fullDumpFilePath = JobFactoryHelpers.ValidateDumpFilePathForOutput(GetDumpFilePath(process), OverwriteDumpFileIfExists); return(new DumpMemoryJob(debugTarget, fullDumpFilePath) { OverwriteDumpFileIfExists = OverwriteDumpFileIfExists }); }
public void Validate() { if (!RunningProcess.SuspendProcess) { throw new ErrorWithExitCodeException(1, "The -x switch is required in order to dump the contents of memory.") { ShowUsage = true } } ; if (JobFactoryHelpers.TryResolveTargetProcessQuietly(RunningProcess, out var process)) { JobFactoryHelpers.ValidateDumpFilePathForOutput(GetDumpFilePath(process), OverwriteDumpFileIfExists); } }
private IDebugSessionTarget GetDebugTarget(ConsoleLog console) { if (RunningProcess.WasSpecified) { var process = JobFactoryHelpers.TryResolveTargetProcess(RunningProcess, console); return(new DebugRunningProcess(process, RunningProcess.SuspendProcess ? DebugMode.Snapshot : DebugMode.Observe)); } if (DumpedProcess.WasSpecified) { var fullDumpFilePath = JobFactoryHelpers.ValidateDumpFilePathForInput(JobFactoryHelpers.GetDumpFilePath(DumpedProcess.DumpFile)); return(new DebugMemoryDump(fullDumpFilePath)); } throw new ErrorWithExitCodeException(1, new ProcessNotSpecifiedException().Message) { ShowUsage = true }; }
public string GetDumpFilePath(IProcessInfo process) => JobFactoryHelpers.GetDumpFilePath(DumpFile ?? $"memorydump-{process.Pid}");