Attach() public method

public Attach ( DebuggerSession session, int pid ) : Process
session DebuggerSession
pid int
return Process
示例#1
0
        public void AttachToProcess(long pid, DebuggerSessionOptions sessionOptions)
        {
            Report.Initialize();

            this.SessionOptions = sessionOptions;
            DebuggerConfiguration config = new DebuggerConfiguration();

            mdbAdaptor.Configuration = config;
            mdbAdaptor.InitializeConfiguration();
            config.LoadConfiguration();
            debugger = new MD.Debugger(config);

            DebuggerOptions options = DebuggerOptions.ParseCommandLine(new string[0]);

            options.StopInMain = false;
            session            = new MD.DebuggerSession(config, options, "main", (IExpressionParser)null);
            mdbAdaptor.Session = session;

            Process proc = debugger.Attach(session, (int)pid);

            OnInitialized(debugger, proc);

            ST.ThreadPool.QueueUserWorkItem(delegate {
                NotifyStarted();
            });
        }
示例#2
0
        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;
            }
        }
		public void AttachToProcess (long pid, DebuggerSessionOptions sessionOptions)
		{
			Report.Initialize ();

			this.SessionOptions = sessionOptions;
			DebuggerConfiguration config = new DebuggerConfiguration ();
			mdbAdaptor.Configuration = config;
			mdbAdaptor.InitializeConfiguration ();
			config.LoadConfiguration ();
			debugger = new MD.Debugger (config);

			DebuggerOptions options = DebuggerOptions.ParseCommandLine (new string[0]);
			options.StopInMain = false;
			session = new MD.DebuggerSession (config, options, "main", (IExpressionParser) null);
			mdbAdaptor.Session = session;
			
			Process proc = debugger.Attach (session, (int)pid);
			OnInitialized (debugger, proc);
			
			ST.ThreadPool.QueueUserWorkItem (delegate {
				NotifyStarted ();
			});
		}