예제 #1
0
 public OutputEventArgs(NodeProcess process, string output)
 {
     _process = process;
     _output  = output;
 }
 public static void RegisterProcess(Guid id, NodeProcess process)
 {
     Targets[id] = new WeakReference(process);
 }
예제 #3
0
 private void AttachProcessEvents(NodeProcess process)
 {
     process.ProcessLoaded += OnProcessLoaded;
     process.ProcessExited += OnProcessExited;
     process.ProcessOutput += OnProcessOutput;
     process.ThreadCreated += OnThreadCreated;
     process.ThreadExited += OnThreadExited;
 }
예제 #4
0
 public OutputEventArgs(NodeProcess process, string output)
 {
     _process = process;
     _output = output;
 }
예제 #5
0
        // Called by the SDM to indicate that a synchronous debug event, previously sent by the DE to the SDM,
        // was received and processed. The only event we send in this fashion is Program Destroy.
        // It responds to that event by shutting down the engine.
        int IDebugEngine2.ContinueFromSynchronousEvent(IDebugEvent2 eventObject)
        {
            if (!(eventObject is AD7ProgramDestroyEvent))
            {
                Debug.Fail("Unknown syncronious event");
                return VSConstants.E_FAIL;
            }

            _ad7ProgramId = Guid.Empty;

            _modules.Clear();
            _process.Close();

            _threads = null;
            _events = null;
            _process = null;

            return VSConstants.S_OK;
        }
예제 #6
0
        // Launches a process by means of the debug engine.
        // Normally, Visual Studio launches a program using the IDebugPortEx2::LaunchSuspended method and then attaches the debugger
        // to the suspended program. However, there are circumstances in which the debug engine may need to launch a program
        // (for example, if the debug engine is part of an interpreter and the program being debugged is an interpreted language),
        // in which case Visual Studio uses the IDebugEngineLaunch2::LaunchSuspended method
        // The IDebugEngineLaunch2::ResumeProcess method is called to start the process after the process has been successfully launched in a suspended state.
        int IDebugEngineLaunch2.LaunchSuspended(string pszServer, IDebugPort2 port, string exe, string args, string dir, string env, string options, enum_LAUNCH_FLAGS launchFlags, uint hStdInput,
                                                uint hStdOutput, uint hStdError, IDebugEventCallback2 ad7Callback, out IDebugProcess2 process)
        {
            Debug.Assert(_events == null);
            Debug.Assert(_process == null);
            Debug.Assert(_ad7ProgramId == Guid.Empty);

            _events = ad7Callback;

            List<string[]> dirMapping = null;

            Guid processId;
            if (Guid.TryParse(exe, out processId))
            {
                _process = DebugConnectionListener.GetProcess(processId);
                _attached = true;
                _pseudoAttach = true;
            }
            else
            {
                _process = new NodeProcess(exe, args, dir, BreakOnAllExceptions, dirMapping);
            }

            _programCreated = false;

            AttachProcessEvents(_process);

            _process.Start();

            var adProcessId = new AD_PROCESS_ID
                {
                    ProcessIdType = (uint) enum_AD_PROCESS_ID.AD_PROCESS_ID_SYSTEM,
                    dwProcessId = (uint) _process.Id
                };

            EngineUtils.RequireOk(port.GetProcess(adProcessId, out process));
            Debug.WriteLine("NodeEngine LaunchSuspended returning S_OK");
            Debug.Assert(process != null);
            Debug.Assert(!_process.HasExited);

            return VSConstants.S_OK;
        }
예제 #7
0
 public static bool TryAttach(int pid, out NodeProcess process)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 public NodeThread(NodeProcess process, long identity)
 {
     _process = process;
     _identity = identity;
     Name = "Worker Thread";
 }
예제 #9
0
 public static void RegisterProcess(Guid id, NodeProcess process)
 {
     Targets[id] = new WeakReference(process);
 }
예제 #10
0
 public static bool TryAttach(int pid, out NodeProcess process)
 {
     throw new NotImplementedException();
 }
예제 #11
0
 public NodeThread(NodeProcess process, long identity)
 {
     _process  = process;
     _identity = identity;
     Name      = "Worker Thread";
 }