internal Process(NDebugger debugger, ICorDebugProcess corProcess) { this.debugger = debugger; this.corProcess = corProcess; this.callbackInterface = new ManagedCallback(this); }
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); }
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 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; }
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; }
/// <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); }
/// <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); }
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); }
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)); }
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); }
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); }
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; }
public Breakpoint(NDebugger debugger, ICorDebugFunctionBreakpoint corBreakpoint) { this.debugger = debugger; this.corBreakpoints.Add(corBreakpoint); }
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; }
internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled) { this.debugger = debugger; this.sourcecodeSegment = sourcecodeSegment; this.enabled = enabled; }
public DebuggerEventArgs(NDebugger debugger) { this.debugger = debugger; }
public ManagedCallbackSwitch(NDebugger debugger) { this.debugger = debugger; }
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); } }
public virtual void TestFixtureSetUp() { debugger = new NDebugger(); debugger.MTA2STA.CallMethod = CallMethod.Manual; }
public BreakpointCollection(NDebugger debugger) : base(debugger) { }
public ThreadCollection(NDebugger debugger) : base(debugger) { }
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); } }
public ManagedCallbackProxy(NDebugger debugger, ManagedCallbackSwitch callbackSwitch) { this.debugger = debugger; this.callbackSwitch = callbackSwitch; }
public ProcessCollection(NDebugger debugger) : base(debugger) { }
static public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments) { return debugger.MTA2STA.Call<Process>(delegate{ return StartInternal(debugger, filename, workingDirectory, arguments); }); }
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; }
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); } }
public EvalCollection(NDebugger debugger) : base(debugger) { }
public CollectionWithEvents(NDebugger debugger) { this.debugger = debugger; }
public ModuleCollection(NDebugger debugger) : base(debugger) { }
static public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments) { return(debugger.MTA2STA.Call <Process>(delegate { return StartInternal(debugger, filename, workingDirectory, arguments); })); }
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); } }
public void InitializeDebugger() { debuggerCore = debugger.DebuggerCore; }
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) { }