Beispiel #1
0
 public DbgObjectFactoryImpl(DbgManagerImpl owner, DbgRuntimeImpl runtime, DbgEngine engine, Lazy <BoundCodeBreakpointsService> boundCodeBreakpointsService)
 {
     this.owner   = owner ?? throw new ArgumentNullException(nameof(owner));
     this.runtime = runtime ?? throw new ArgumentNullException(nameof(runtime));
     this.engine  = engine ?? throw new ArgumentNullException(nameof(engine));
     this.boundCodeBreakpointsService = boundCodeBreakpointsService ?? throw new ArgumentNullException(nameof(boundCodeBreakpointsService));
 }
Beispiel #2
0
 public StopDebuggingHelper(DbgManagerImpl owner, Action <bool> onCompleted)
 {
     lockObj          = new object();
     this.owner       = owner;
     this.onCompleted = onCompleted;
     processes        = new List <DbgProcess>();
 }
Beispiel #3
0
        public DbgProcessImpl(DbgManagerImpl owner, Dispatcher dispatcher, int pid, DbgProcessState state, bool shouldDetach)
        {
            lockObj         = new object();
            engineInfos     = new List <EngineInfo>();
            threads         = new List <DbgThread>();
            this.owner      = owner ?? throw new ArgumentNullException(nameof(owner));
            this.state      = state;
            cachedIsRunning = CalculateIsRunning_NoLock();
            Id           = pid;
            ShouldDetach = shouldDetach;

            const int dwDesiredAccess = NativeMethods.PROCESS_VM_OPERATION | NativeMethods.PROCESS_VM_READ |
                                        NativeMethods.PROCESS_VM_WRITE | NativeMethods.PROCESS_QUERY_LIMITED_INFORMATION;

            hProcess = NativeMethods.OpenProcess(dwDesiredAccess, false, pid);
            if (hProcess.IsInvalid)
            {
                throw new InvalidOperationException($"Couldn't open process {pid}, error: 0x{Marshal.GetLastWin32Error():X8}");
            }

            Bitness         = ProcessUtilities.GetBitness(hProcess.DangerousGetHandle());
            Architecture    = GetArchitecture(Bitness);
            OperatingSystem = GetOperatingSystem();
            var info = GetProcessName(pid);

            Filename  = info.filename ?? string.Empty;
            Name      = info.name ?? string.Empty;
            debugging = CalculateDebugging_NoLock();

            new DelayedIsRunningHelper(this, dispatcher, RaiseDelayedIsRunningChanged_DbgThread);
        }
Beispiel #4
0
        public DbgProcessImpl(DbgManagerImpl owner, Dispatcher dispatcher, ulong pid, DbgProcessState state, bool shouldDetach)
        {
            lockObj         = new object();
            engineInfos     = new List <EngineInfo>();
            threads         = new List <DbgThread>();
            this.owner      = owner ?? throw new ArgumentNullException(nameof(owner));
            this.state      = state;
            cachedIsRunning = CalculateIsRunning_NoLock();
            Id           = pid;
            ShouldDetach = shouldDetach;

            const int dwDesiredAccess = NativeMethods.PROCESS_VM_OPERATION | NativeMethods.PROCESS_VM_READ |
                                        NativeMethods.PROCESS_VM_WRITE | NativeMethods.PROCESS_QUERY_LIMITED_INFORMATION;

            hProcess = NativeMethods.OpenProcess(dwDesiredAccess, false, (int)pid);
            if (hProcess.IsInvalid)
            {
                throw new InvalidOperationException($"Couldn't open process {pid}");
            }

            Bitness  = ProcessUtilities.GetBitness(hProcess.DangerousGetHandle());
            Machine  = GetMachine(Bitness);
            Filename = GetProcessFilename(pid) ?? string.Empty;
            Name     = Path.GetFileName(Filename);

            new DelayedIsRunningHelper(this, dispatcher, RaiseDelayedIsRunningChanged_DbgThread);
        }
Beispiel #5
0
        public DbgRuntimeImpl(DbgManagerImpl owner, DbgProcess process, DbgEngine engine)
        {
            lockObj    = new object();
            this.owner = owner ?? throw new ArgumentNullException(nameof(owner));
            Process    = process ?? throw new ArgumentNullException(nameof(process));
            Engine     = engine ?? throw new ArgumentNullException(nameof(engine));
            var info = engine.RuntimeInfo;

            Id                  = info.Id;
            Guid                = info.Guid;
            RuntimeKindGuid     = info.RuntimeKindGuid;
            Name                = info.Name;
            Tags                = info.Tags;
            appDomains          = new List <DbgAppDomain>();
            modules             = new List <DbgModule>();
            threads             = new List <DbgThreadImpl>();
            closeOnContinueList = new List <DbgObject>();
            InternalRuntime     = engine.CreateInternalRuntime(this) ?? throw new InvalidOperationException();
        }
 public DbgCurrentRuntime(DbgManagerImpl owner) => this.owner = owner;
 public DbgCurrentProcess(DbgManagerImpl owner) => this.owner = owner;
 public DbgCurrentThread(DbgManagerImpl owner) => this.owner = owner;
Beispiel #9
0
 public BoundBreakpointsManager(DbgManagerImpl owner) => this.owner = owner ?? throw new ArgumentNullException(nameof(owner));
 public BreakAllHelper(DbgManagerImpl owner)
 {
     this.owner = owner;
     infos      = new List <Info>();
 }