public Process OpenCoreFile(string core_file) { if ((debugger != null) || (main_process != null)) throw new TargetException (TargetError.AlreadyHaveTarget); Console.WriteLine ("Loading core file {0}", core_file); try { debugger = new Debugger (config); new InterpreterEventSink (this, debugger); Thread[] threads; current_process = main_process = debugger.OpenCoreFile ( session, core_file, out threads); current_thread = current_process.MainThread; return current_process; } catch (TargetException) { debugger.Dispose (); debugger = null; throw; } }
public Process LoadSession(Stream stream) { if ((debugger != null) || (main_process != null)) throw new TargetException (TargetError.AlreadyHaveTarget); try { debugger = new Debugger (config); parser = new ExpressionParser (this); session = new DebuggerSession (config, stream, parser); parser.Session = session; new InterpreterEventSink (this, debugger); CommandResult result; current_process = main_process = debugger.Run (session, out result); current_thread = current_process.MainThread; Wait (result); return current_process; } catch (TargetException ex) { Console.WriteLine ("Got a TargetException during LoadSession: {0}", ex); debugger.Dispose (); debugger = null; throw; } catch (Exception ex) { Console.WriteLine ("Got an Exception during LoadSession: {0}", ex); debugger.Dispose (); debugger = null; throw; } }
public Process Start() { if ((debugger != null) || (main_process != null)) throw new TargetException (TargetError.AlreadyHaveTarget); if (!IsScript) Print ("Starting program: {0} {1}", Options.File, String.Join (" ", Options.InferiorArgs)); try { debugger = new Debugger (config); new InterpreterEventSink (this, debugger); CommandResult result; current_process = main_process = debugger.Run (session, out result); current_thread = current_process.MainThread; Wait (result); return current_process; } catch (TargetException) { debugger.Dispose (); debugger = null; throw; } }
public Process Attach(int pid) { if ((debugger != null) || (main_process != null)) throw new TargetException (TargetError.AlreadyHaveTarget); if (!IsScript) Print ("Attaching to {0}", pid); try { debugger = new Debugger (config); new InterpreterEventSink (this, debugger); CommandResult result; current_process = main_process = debugger.Attach (session, pid, out result); current_thread = current_process.MainThread; Wait (result); return current_process; } catch (TargetException) { debugger.Dispose (); debugger = null; throw; } }