예제 #1
0
 public void Validate()
 {
     if (DumpedProcess.WasSpecified)
     {
         JobFactoryHelpers.ValidateDumpFilePathForInput(JobFactoryHelpers.GetDumpFilePath(DumpedProcess.DumpFile));
     }
 }
예제 #2
0
        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
            });
        }
예제 #3
0
 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);
     }
 }
예제 #4
0
 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
           };
 }
예제 #5
0
 public string GetDumpFilePath(IProcessInfo process) => JobFactoryHelpers.GetDumpFilePath(DumpFile ?? $"memorydump-{process.Pid}");