예제 #1
0
		internal Process(NDebugger debugger, ICorDebugProcess corProcess)
		{
			this.debugger = debugger;
			this.corProcess = corProcess;
			
			this.callbackInterface = new ManagedCallback(this);
		}
예제 #2
0
        internal Process(NDebugger debugger, ICorDebugProcess corProcess)
        {
            this.debugger   = debugger;
            this.corProcess = corProcess;

            this.callbackInterface = new ManagedCallback(this);
        }
예제 #3
0
        internal Process(NDebugger debugger, ICorDebugProcess corProcess, string filename, string workingDirectory)
        {
            this.debugger         = debugger;
            this.corProcess       = corProcess;
            this.workingDirectory = workingDirectory;
            this.Filename         = System.IO.Path.GetFullPath(filename);     // normalize path

            this.callbackInterface = new ManagedCallback(this);
        }
예제 #4
0
 public Breakpoint(NDebugger debugger, string fileName, byte[] checkSum, int line, int column, bool enabled)
 {
     this.debugger = debugger;
     this.fileName = fileName;
     this.checkSum = checkSum;
     this.line     = line;
     this.column   = column;
     this.enabled  = enabled;
 }
예제 #5
0
 public ILBreakpoint(NDebugger debugger, string typeName, int line, int metadataToken, int offset, bool enabled)
 {
     this.Debugger      = debugger;
     this.Line          = line;
     this.TypeName      = typeName;
     this.MetadataToken = metadataToken;
     this.ILOffset      = offset;
     this.Enabled       = enabled;
 }
예제 #6
0
 public ILBreakpoint(NDebugger debugger, TextLocation location, TextLocation endLocation, MethodKey methodKey, uint offset, bool enabled)
 {
     this.Debugger    = debugger;
     this.Location    = location;
     this.EndLocation = endLocation;
     this.MethodKey   = methodKey;
     this.ILOffset    = offset;
     this.Enabled     = enabled;
 }
예제 #7
0
        /// <summary>
        /// Create a new target VM for the giveb process id.
        /// </summary>
        /// <param name="pid">Process ID of the IKVM</param>
        internal TargetVM(int pid)
        {
            debugger = new NDebugger();
            System.Diagnostics.Process sysProcess = System.Diagnostics.Process.GetProcessById(pid);
            process = debugger.Attach(sysProcess);
            process.Exited += new EventHandler(ProcessExited);

            process.ModuleLoaded += new EventHandler<ModuleEventArgs>(ModuleLoaded);
            process.Paused += new EventHandler<ProcessEventArgs>(Paused);
            process.Resumed += new EventHandler<ProcessEventArgs>(Resumed);

        }
예제 #8
0
        /// <summary>
        /// Create a new target VM for the giveb process id.
        /// </summary>
        /// <param name="pid">Process ID of the IKVM</param>
        internal TargetVM(int pid, JdwpEventHandler jdwpEventHandler)
        {
            this.jdwpEventHandler = jdwpEventHandler;
            debugger = new NDebugger();
            System.Diagnostics.Process sysProcess = System.Diagnostics.Process.GetProcessById(pid);
            process = debugger.Attach(sysProcess);
            process.Exited += new EventHandler(ProcessExited);

            process.ModuleLoaded += new EventHandler<ModuleEventArgs>(ModuleLoaded);
            process.Paused += new EventHandler<ProcessEventArgs>(Paused);
            process.Resumed += new EventHandler<ProcessEventArgs>(Resumed);
            process.ThreadStarted += new EventHandler<ThreadEventArgs>(ThreadStarted);
        }
예제 #9
0
		internal Process(NDebugger debugger, ICorDebugProcess corProcess, string workingDirectory)
		{
			this.debugger = debugger;
			this.corProcess = corProcess;
			this.workingDirectory = workingDirectory;
			
			this.callbackInterface = new ManagedCallback(this);
			
			activeEvals = new EvalCollection(debugger);
			modules = new ModuleCollection(debugger);
			modules.Added += OnModulesAdded;
			threads = new ThreadCollection(debugger);
			appDomains = new AppDomainCollection(debugger);
		}
예제 #10
0
파일: Process.cs 프로젝트: BahNahNah/dnSpy
        internal Process(NDebugger debugger, ICorDebugProcess corProcess, string workingDirectory)
        {
            this.debugger = debugger;
            this.corProcess = corProcess;
            this.workingDirectory = workingDirectory;

            this.callbackInterface = new ManagedCallback(this);

            activeEvals = new EvalCollection(debugger);
            modules = new ModuleCollection(debugger);
            modules.Added += OnModulesAdded;
            threads = new ThreadCollection(debugger);
            appDomains = new AppDomainCollection(debugger);
        }
예제 #11
0
        static unsafe public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments)
        {
            debugger.TraceMessage("Executing " + filename + " " + arguments);

            uint[] processStartupInfo = new uint[17];
            processStartupInfo[0] = sizeof(uint) * 17;
            uint[] processInfo = new uint[4];

            ICorDebugProcess outProcess;

            if (string.IsNullOrEmpty(workingDirectory))
            {
                workingDirectory = System.IO.Path.GetDirectoryName(filename);
            }

            _SECURITY_ATTRIBUTES secAttr = new _SECURITY_ATTRIBUTES();

            secAttr.bInheritHandle       = 0;
            secAttr.lpSecurityDescriptor = IntPtr.Zero;
            secAttr.nLength = (uint)sizeof(_SECURITY_ATTRIBUTES);

            fixed(uint *pprocessStartupInfo = processStartupInfo)
            {
                fixed(uint *pprocessInfo = processInfo)
                {
                    outProcess = debugger.CorDebug.CreateProcess(
                        filename,                                           // lpApplicationName
                        // If we do not prepend " ", the first argument migh just get lost
                        " " + arguments,                                    // lpCommandLine
                        ref secAttr,                                        // lpProcessAttributes
                        ref secAttr,                                        // lpThreadAttributes
                        1,                                                  //TRUE                    // bInheritHandles
                        0x00000010 /*CREATE_NEW_CONSOLE*/,                  // dwCreationFlags
                        IntPtr.Zero,                                        // lpEnvironment
                        workingDirectory,                                   // lpCurrentDirectory
                        (uint)pprocessStartupInfo,                          // lpStartupInfo
                        (uint)pprocessInfo,                                 // lpProcessInformation,
                        CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS // debuggingFlags
                        );
                }
            }

            return(new Process(debugger, outProcess, filename, workingDirectory));
        }
예제 #12
0
        static unsafe public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments)
        {
            debugger.TraceMessage("Executing " + filename);

            uint[] processStartupInfo = new uint[17];
            processStartupInfo[0] = sizeof(uint) * 17;
            uint[] processInfo = new uint[4];

            ICorDebugProcess outProcess;

            if (workingDirectory == null || workingDirectory == "")
            {
                workingDirectory = System.IO.Path.GetDirectoryName(filename);
            }

            fixed(uint *pprocessStartupInfo = processStartupInfo)
            fixed(uint *pprocessInfo = processInfo)
            outProcess =
                debugger.CorDebug.CreateProcess(
                    filename,                                           // lpApplicationName
                    // If we do not prepend " ", the first argument migh just get lost
                    " " + arguments,                                    // lpCommandLine
                    ref _SECURITY_ATTRIBUTES.Default,                   // lpProcessAttributes
                    ref _SECURITY_ATTRIBUTES.Default,                   // lpThreadAttributes
                    1,                                                  //TRUE                    // bInheritHandles
                    0x00000010 /*CREATE_NEW_CONSOLE*/,                  // dwCreationFlags
                    IntPtr.Zero,                                        // lpEnvironment
                    workingDirectory,                                   // lpCurrentDirectory
                    (uint)pprocessStartupInfo,                          // lpStartupInfo
                    (uint)pprocessInfo,                                 // lpProcessInformation,
                    CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS // debuggingFlags
                    );

            Process process = new Process(debugger, outProcess);

            process.workingDirectory = workingDirectory;
            return(process);
        }
예제 #13
0
		internal Process(NDebugger debugger, ICorDebugProcess corProcess, string filename, string workingDirectory)
		{
			this.debugger = debugger;
			this.corProcess = corProcess;
			this.workingDirectory = workingDirectory;
			this.Filename = System.IO.Path.GetFullPath(filename); // normalize path
			
			this.callbackInterface = new ManagedCallback(this);
		}
예제 #14
0
        static unsafe Process StartInternal(NDebugger debugger, string filename, string workingDirectory, string arguments)
        {
            debugger.TraceMessage("Executing " + filename);

            uint[] processStartupInfo = new uint[17];
            processStartupInfo[0] = sizeof(uint) * 17;
            uint[] processInfo = new uint[4];

            SafeFileHandle prnt_inp;
            SafeFileHandle prnt_out;
            SafeFileHandle prnt_err;
            SafeFileHandle input_handle;
            SafeFileHandle output_handle;
            SafeFileHandle err_handle;
//			CreatePipe(out prnt_out,out output_handle,false);
//			CreatePipe(out prnt_inp,out input_handle,true);
            STARTUPINFO startupInfo = new STARTUPINFO();

            startupInfo.cb = Marshal.SizeOf(startupInfo);

            SECURITY_ATTRIBUTES lpPipeAttributes = new SECURITY_ATTRIBUTES();

            lpPipeAttributes.bInheritHandle = true;
            //CreatePipe(out output_handle, out input_handle,lpPipeAttributes,0);
            CreatePipe(out prnt_inp, out input_handle, true);
            CreatePipe(out prnt_out, out output_handle, false);
            CreatePipe(out prnt_err, out err_handle, false);
            startupInfo.hStdInput  = input_handle;
            startupInfo.hStdOutput = output_handle;
            startupInfo.hStdError  = err_handle;
            ICorDebugProcess outProcess;
//			processStartupInfo[14] = (uint)GCHandle.Alloc(input_handle,GCHandleType.Pinned).AddrOfPinnedObject().ToInt32();
//			processStartupInfo[15] = (uint)GCHandle.Alloc(output_handle,GCHandleType.Pinned).AddrOfPinnedObject().ToInt32();
            StreamWriter standardInput = new StreamWriter(new FileStream(prnt_inp, FileAccess.Write, 0x1000, false), Encoding.GetEncoding(GetConsoleCP()), 0x1000);

            standardInput.AutoFlush = true;
            Encoding     encoding       = Encoding.GetEncoding(GetConsoleOutputCP());
            StreamReader standardOutput = new StreamReader(new FileStream(prnt_out, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);
            StreamReader errorOutput    = new StreamReader(new FileStream(prnt_err, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);

            if (workingDirectory == null || workingDirectory == "")
            {
                workingDirectory = System.IO.Path.GetDirectoryName(filename);
            }

            fixed(uint *pprocessStartupInfo = processStartupInfo)
            fixed(uint *pprocessInfo = processInfo)
            outProcess =
                debugger.CorDebug.CreateProcess(
                    filename,                             // lpApplicationName
                    // If we do not prepend " ", the first argument migh just get lost
                    " " + arguments,                      // lpCommandLine
                    ref _SECURITY_ATTRIBUTES.Default,     // lpProcessAttributes
                    ref _SECURITY_ATTRIBUTES.Default,     // lpThreadAttributes
                    1,                                    //TRUE                    // bInheritHandles
                    //0x00000010 /*CREATE_NEW_CONSOLE*/,    // dwCreationFlags
                    0x08000000,
                    IntPtr.Zero,                                                           // lpEnvironment
                    workingDirectory,                                                      // lpCurrentDirectory
                    startupInfo,
                    //(uint)pprocessStartupInfo,        // lpStartupInfo
                    (uint)pprocessInfo,                                                   // lpProcessInformation,
                    CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS                   // debuggingFlags
                    );

            Process p = new Process(debugger, outProcess);

            p.StandardInput  = standardInput;
            p.StandardOutput = standardOutput;
            p.StandardError  = errorOutput;
            return(p);
        }
예제 #15
0
 public DebugHelper()
 {
     //System.Threading.Thread.CurrentThread.SetApartmentState(System.Threading.ApartmentState.MTA);
     dbg = new NDebugger();
     //th = new System.Threading.Thread(new System.Threading.ParameterizedThreadStart(frm.RefreshPad));
     this.workbench = WorkbenchServiceFactory.Workbench;
 }
예제 #16
0
 public Breakpoint(NDebugger debugger, ICorDebugFunctionBreakpoint corBreakpoint)
 {
     this.debugger = debugger;
     this.corBreakpoints.Add(corBreakpoint);
 }
예제 #17
0
		static unsafe Process StartInternal(NDebugger debugger, string filename, string workingDirectory, string arguments)
		{
			debugger.TraceMessage("Executing " + filename);
			
			uint[] processStartupInfo = new uint[17];
			processStartupInfo[0] = sizeof(uint) * 17;
			uint[] processInfo = new uint[4];
			
			SafeFileHandle prnt_inp;
			SafeFileHandle prnt_out;
			SafeFileHandle prnt_err;
			SafeFileHandle input_handle;
			SafeFileHandle output_handle;
			SafeFileHandle err_handle;
//			CreatePipe(out prnt_out,out output_handle,false);
//			CreatePipe(out prnt_inp,out input_handle,true);
			STARTUPINFO startupInfo = new STARTUPINFO();
  			startupInfo.cb = Marshal.SizeOf(startupInfo);

			SECURITY_ATTRIBUTES lpPipeAttributes = new SECURITY_ATTRIBUTES();
  			lpPipeAttributes.bInheritHandle = true;
			//CreatePipe(out output_handle, out input_handle,lpPipeAttributes,0);
			CreatePipe(out prnt_inp, out input_handle, true);
			CreatePipe(out prnt_out, out output_handle, false);
			CreatePipe(out prnt_err, out err_handle, false);
			startupInfo.hStdInput = input_handle;
			startupInfo.hStdOutput = output_handle;
			startupInfo.hStdError = err_handle;
			ICorDebugProcess outProcess;
//			processStartupInfo[14] = (uint)GCHandle.Alloc(input_handle,GCHandleType.Pinned).AddrOfPinnedObject().ToInt32();
//			processStartupInfo[15] = (uint)GCHandle.Alloc(output_handle,GCHandleType.Pinned).AddrOfPinnedObject().ToInt32();
			StreamWriter standardInput = new StreamWriter(new FileStream(prnt_inp, FileAccess.Write, 0x1000, false), Encoding.GetEncoding(GetConsoleCP()), 0x1000);
    		standardInput.AutoFlush = true;
			Encoding encoding = Encoding.GetEncoding(GetConsoleOutputCP());
    		StreamReader standardOutput = new StreamReader(new FileStream(prnt_out, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);
			StreamReader errorOutput = new StreamReader(new FileStream(prnt_err, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);
			if (workingDirectory == null || workingDirectory == "") {
				workingDirectory = System.IO.Path.GetDirectoryName(filename);
			}
			
			fixed (uint* pprocessStartupInfo = processStartupInfo)
				fixed (uint* pprocessInfo = processInfo)
					outProcess =
						debugger.CorDebug.CreateProcess(
							filename,   // lpApplicationName
							  // If we do not prepend " ", the first argument migh just get lost
							" " + arguments,                       // lpCommandLine
							ref _SECURITY_ATTRIBUTES.Default,                       // lpProcessAttributes
							ref _SECURITY_ATTRIBUTES.Default,                      // lpThreadAttributes
							1,//TRUE                    // bInheritHandles
							//0x00000010 /*CREATE_NEW_CONSOLE*/,    // dwCreationFlags
							0x08000000,
							IntPtr.Zero,                       // lpEnvironment
							workingDirectory,                       // lpCurrentDirectory
							startupInfo,
							//(uint)pprocessStartupInfo,        // lpStartupInfo
							(uint)pprocessInfo,               // lpProcessInformation,
							CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS   // debuggingFlags
							);
			
			Process p = new Process(debugger, outProcess);
			p.StandardInput = standardInput;
			p.StandardOutput = standardOutput;
			p.StandardError = errorOutput;
			return p;
		}
예제 #18
0
		internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled)
		{
			this.debugger = debugger;
			this.sourcecodeSegment = sourcecodeSegment;
			this.enabled = enabled;
		}
예제 #19
0
 public DebuggerEventArgs(NDebugger debugger)
 {
     this.debugger = debugger;
 }
 public ManagedCallbackSwitch(NDebugger debugger)
 {
     this.debugger = debugger;
 }
예제 #21
0
		public void InitializeService()
		{
			List<ISymbolSource> symbolSources = new List<ISymbolSource>();
			symbolSources.Add(PdbSymbolSource);
			symbolSources.AddRange(AddInTree.BuildItems<ISymbolSource>("/SharpDevelop/Services/DebuggerService/SymbolSource", null, false));
			
			// init NDebugger
			CurrentDebugger = new NDebugger();
			CurrentDebugger.Options = DebuggingOptions.Instance;
			CurrentDebugger.SymbolSources = symbolSources;
			
			foreach (BreakpointBookmark b in SD.BookmarkManager.Bookmarks.OfType<BreakpointBookmark>()) {
				AddBreakpoint(b);
			}
			
			SD.BookmarkManager.BookmarkAdded += (sender, e) => {
				BreakpointBookmark bm = e.Bookmark as BreakpointBookmark;
				if (bm != null) {
					AddBreakpoint(bm);
				}
			};
			
			SD.BookmarkManager.BookmarkRemoved += (sender, e) => {
				BreakpointBookmark bm = e.Bookmark as BreakpointBookmark;
				if (bm != null) {
					Breakpoint bp = bm.InternalBreakpointObject as Breakpoint;
					CurrentDebugger.RemoveBreakpoint(bp);
				}
			};
			
			if (Initialize != null) {
				Initialize(this, null);
			}
		}
예제 #22
0
 internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled)
 {
     this.debugger          = debugger;
     this.sourcecodeSegment = sourcecodeSegment;
     this.enabled           = enabled;
 }
		public virtual void TestFixtureSetUp()
		{
			debugger = new NDebugger();
			debugger.MTA2STA.CallMethod = CallMethod.Manual;
		}
예제 #24
0
 public BreakpointCollection(NDebugger debugger) : base(debugger)
 {
 }
 public ThreadCollection(NDebugger debugger) : base(debugger)
 {
 }
예제 #26
0
		public void InitializeService()
		{
			if (useRemotingForThreadInterop) {
				// This needs to be called before instance of NDebugger is created
				string path = RemotingConfigurationHelpper.GetLoadedAssemblyPath("Debugger.Core.dll");
				new RemotingConfigurationHelpper(path).Configure();
			}
			
			// get decompiler service
			var items = AddInTree.BuildItems<IDebuggerDecompilerService>("/SharpDevelop/Services/DebuggerDecompilerService", null, false);
			if (items.Count > 0)
				debuggerDecompilerService = items[0];
			
			// init NDebugger
			debugger = new NDebugger();
			debugger.Options = DebuggingOptions.Instance;
			debugger.DebuggerTraceMessage    += debugger_TraceMessage;
			debugger.Processes.Added         += debugger_ProcessStarted;
			debugger.Processes.Removed       += debugger_ProcessExited;
			
			DebuggerService.BreakPointAdded  += delegate (object sender, BreakpointBookmarkEventArgs e) {
				AddBreakpoint(e.BreakpointBookmark);
			};
			
			foreach (BreakpointBookmark b in DebuggerService.Breakpoints) {
				AddBreakpoint(b);
			}
			
			if (Initialize != null) {
				Initialize(this, null);
			}
		}
예제 #27
0
		public Breakpoint(NDebugger debugger, string fileName, byte[] checkSum, int line, int column, bool enabled)
		{
			this.debugger = debugger;
			this.fileName = fileName;
			this.checkSum = checkSum;
			this.line = line;
			this.column = column;
			this.enabled = enabled;
		}
		public ManagedCallbackProxy(NDebugger debugger, ManagedCallbackSwitch callbackSwitch)
		{
			this.debugger = debugger;
			this.callbackSwitch = callbackSwitch;
		}
예제 #29
0
		public Breakpoint(NDebugger debugger, ICorDebugFunctionBreakpoint corBreakpoint)
		{
			this.debugger = debugger;
			this.corBreakpoints.Add(corBreakpoint);
		}
예제 #30
0
 public ILBreakpoint(NDebugger debugger, TextLocation location, TextLocation endLocation, MethodKey methodKey, uint offset, bool enabled)
 {
     this.Debugger = debugger;
     this.Location = location;
     this.EndLocation = endLocation;
     this.MethodKey = methodKey;
     this.ILOffset = offset;
     this.Enabled = enabled;
 }
예제 #31
0
 public ProcessCollection(NDebugger debugger) : base(debugger)
 {
 }
예제 #32
0
 public DebuggerEventArgs(NDebugger debugger)
 {
     this.debugger = debugger;
 }
예제 #33
0
		static public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments)
		{
			return debugger.MTA2STA.Call<Process>(delegate{
			                                      	return StartInternal(debugger, filename, workingDirectory, arguments);
			                                      });
		}
예제 #34
0
		public ILBreakpoint(NDebugger debugger, string typeName, int line, int metadataToken, int memberToken, int offset, bool enabled)
		{
			this.Debugger = debugger;
			this.Line = line;
			this.TypeName = typeName;
			this.MetadataToken = metadataToken;
			this.MemberMetadataToken = memberToken;
			this.ILOffset = offset;
			this.Enabled = enabled;
		}
예제 #35
0
		public void InitializeService()
		{
			if (useRemotingForThreadInterop) {
				// This needs to be called before instance of NDebugger is created
				string path = RemotingConfigurationHelpper.GetLoadedAssemblyPath("Debugger.Core.dll");
				new RemotingConfigurationHelpper(path).Configure();
			}
			
			debugger = new NDebugger();
			
			debugger.Options = DebuggingOptions.Instance;
			
			debugger.DebuggerTraceMessage    += debugger_TraceMessage;
			debugger.Processes.Added         += debugger_ProcessStarted;
			debugger.Processes.Removed       += debugger_ProcessExited;
			
			DebuggerService.BreakPointAdded  += delegate (object sender, BreakpointBookmarkEventArgs e) {
				AddBreakpoint(e.BreakpointBookmark);
			};
			
			foreach (BreakpointBookmark b in DebuggerService.Breakpoints) {
				AddBreakpoint(b);
			}
			
			if (Initialize != null) {
				Initialize(this, null);
			}
		}
예제 #36
0
 public ManagedCallbackProxy(NDebugger debugger, ManagedCallbackSwitch callbackSwitch)
 {
     this.debugger       = debugger;
     this.callbackSwitch = callbackSwitch;
 }
예제 #37
0
 public EvalCollection(NDebugger debugger) : base(debugger)
 {
 }
 public CollectionWithEvents(NDebugger debugger)
 {
     this.debugger = debugger;
 }
예제 #39
0
 public ModuleCollection(NDebugger debugger) : base(debugger)
 {
 }
		public ManagedCallbackSwitch(NDebugger debugger)
		{
			this.debugger = debugger;
		}
예제 #41
0
 static public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments)
 {
     return(debugger.MTA2STA.Call <Process>(delegate {
         return StartInternal(debugger, filename, workingDirectory, arguments);
     }));
 }
예제 #42
0
		public void InitializeService()
		{
			debugger = new NDebugger();
			
			//debugger.Options = DebuggingOptions.Instance;
			
			debugger.DebuggerTraceMessage    += debugger_TraceMessage;
			debugger.Processes.Added         += debugger_ProcessStarted;
			debugger.Processes.Removed       += debugger_ProcessExited;
			
			DebuggerService.BreakPointAdded  += delegate (object sender, BreakpointBookmarkEventArgs e) {
				AddBreakpoint(e.BreakpointBookmark);
			};
			
			foreach (BreakpointBookmark b in DebuggerService.Breakpoints) {
				AddBreakpoint(b);
			}
			
			if (Initialize != null) {
				Initialize(this, null);
			}
		}
예제 #43
0
		public void InitializeDebugger()
		{
			debuggerCore = debugger.DebuggerCore;
		}
예제 #44
0
		static unsafe public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments)
		{
			debugger.TraceMessage("Executing " + filename + " " + arguments);
			
			uint[] processStartupInfo = new uint[17];
			processStartupInfo[0] = sizeof(uint) * 17;
			uint[] processInfo = new uint[4];
			
			ICorDebugProcess outProcess;
			
			if (workingDirectory == null || workingDirectory == "") {
				workingDirectory = System.IO.Path.GetDirectoryName(filename);
			}
			
			_SECURITY_ATTRIBUTES secAttr = new _SECURITY_ATTRIBUTES();
			secAttr.bInheritHandle = 0;
			secAttr.lpSecurityDescriptor = IntPtr.Zero;
			secAttr.nLength = (uint)sizeof(_SECURITY_ATTRIBUTES);
			
			fixed (uint* pprocessStartupInfo = processStartupInfo)
				fixed (uint* pprocessInfo = processInfo)
				outProcess =
				debugger.CorDebug.CreateProcess(
					filename,   // lpApplicationName
					// If we do not prepend " ", the first argument migh just get lost
					" " + arguments,                       // lpCommandLine
					ref secAttr,                       // lpProcessAttributes
					ref secAttr,                      // lpThreadAttributes
					1,//TRUE                    // bInheritHandles
					0x00000010 /*CREATE_NEW_CONSOLE*/,    // dwCreationFlags
					IntPtr.Zero,                       // lpEnvironment
					workingDirectory,                       // lpCurrentDirectory
					(uint)pprocessStartupInfo,        // lpStartupInfo
					(uint)pprocessInfo,               // lpProcessInformation,
					CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS   // debuggingFlags
				);
			
			return new Process(debugger, outProcess, workingDirectory);
		}
 public AppDomainCollection(NDebugger dbgr) : base(dbgr)
 {
 }