Ejemplo n.º 1
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, PythonStackFrame threadContext) {
            _engine = engine;
            _thread = thread;
            _stackFrame = threadContext;

            _parameters = threadContext.Parameters.ToArray();
            _locals = threadContext.Locals.ToArray();
        }
Ejemplo n.º 2
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, PythonStackFrame threadContext)
        {
            _engine     = engine;
            _thread     = thread;
            _stackFrame = threadContext;

            _parameters = threadContext.Parameters.ToArray();
            _locals     = threadContext.Locals.ToArray();
        }
Ejemplo n.º 3
0
        private void OnAsyncBreakComplete(object sender, ThreadEventArgs e)
        {
            AD7Thread thread;

            if (!_threads.TryGetValue(e.Thread, out thread))
            {
                _threads[e.Thread] = thread = new AD7Thread(this, e.Thread);
            }
            Send(new AD7AsyncBreakCompleteEvent(), AD7AsyncBreakCompleteEvent.IID, thread);
        }
Ejemplo n.º 4
0
        // Continue is called from the SDM when it wants execution to continue in the debugee
        // but have stepping state remain. An example is when a tracepoint is executed,
        // and the debugger does not want to actually enter break mode.
        public int Continue(IDebugThread2 pThread)
        {
            AssertMainThread();

            AD7Thread thread = (AD7Thread)pThread;

            // TODO: How does this differ from ExecuteOnThread?
            thread.GetDebuggedThread().Resume();

            return(VSConstants.S_OK);
        }
Ejemplo n.º 5
0
        private void OnDebuggerOutput(object sender, OutputEventArgs e)
        {
            AD7Thread thread;

            if (!_threads.TryGetValue(e.Thread, out thread))
            {
                _threads[e.Thread] = thread = new AD7Thread(this, e.Thread);
            }

            Send(new AD7DebugOutputStringEvent2(e.Output), AD7DebugOutputStringEvent2.IID, thread);
        }
Ejemplo n.º 6
0
        // ExecuteOnThread is called when the SDM wants execution to continue and have
        // stepping state cleared.  See http://msdn.microsoft.com/en-us/library/bb145596.aspx for a
        // description of different ways we can resume.
        public int ExecuteOnThread(IDebugThread2 pThread)
        {
            AssertMainThread();

            // clear stepping state on the thread the user was currently on
            AD7Thread thread = (AD7Thread)pThread;

            thread.GetDebuggedThread().ClearSteppingState();

            _process.Resume();

            return(VSConstants.S_OK);
        }
Ejemplo n.º 7
0
 private void OnProcessLoaded(object sender, ThreadEventArgs e)
 {
     lock (_syncLock) {
         if (_programCreated)
         {
             // we've delviered the program created event, deliver the load complete event
             SendLoadComplete(_threads[e.Thread]);
         }
         else
         {
             Debug.WriteLine("Delaying load complete " + GetHashCode());
             // we haven't delivered the program created event, wait until we do to deliver the process loaded event.
             _processLoadedThread = _threads[e.Thread];
         }
     }
 }
Ejemplo n.º 8
0
        private void OnThreadCreated(object sender, ThreadEventArgs e)
        {
            var newThread = new AD7Thread(this, e.Thread);

            _threads.Add(e.Thread, newThread);

            lock (_syncLock) {
                if (_programCreated)
                {
                    SendThreadStart(newThread);
                }
                else
                {
                    _startThread = newThread;
                }
            }
        }
Ejemplo n.º 9
0
        private void SendLoadComplete(AD7Thread thread)
        {
            Debug.WriteLine("Sending load complete" + GetHashCode());
            Send(new AD7LoadCompleteEvent(), AD7LoadCompleteEvent.IID, thread);

            if (_startModule != null)
            {
                SendModuleLoaded(_startModule);
                _startModule = null;
            }
            if (_startThread != null)
            {
                SendThreadStart(_startThread);
                _startThread = null;
            }
            _processLoadedThread = null;
            _loadComplete.Set();
        }
Ejemplo n.º 10
0
        // EnumThreads is called by the debugger when it needs to enumerate the threads in the program.
        public int EnumThreads(out IEnumDebugThreads2 ppEnum)
        {
            AssertMainThread();

            AD7Thread[] threadObjects = new AD7Thread[_threads.Count];
            int         i             = 0;

            foreach (var keyValue in _threads)
            {
                var thread   = keyValue.Key;
                var adThread = keyValue.Value;

                Debug.Assert(adThread != null);
                threadObjects[i++] = adThread;
            }

            ppEnum = new AD7ThreadEnum(threadObjects);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 11
0
        // EnumThreads is called by the debugger when it needs to enumerate the threads in the program.
        public int EnumThreads(out IEnumDebugThreads2 ppEnum)
        {
            if (_mixedMode) {
                ppEnum = null;
                return VSConstants.E_NOTIMPL;
            }

            AssertMainThread();

            AD7Thread[] threadObjects = new AD7Thread[_threads.Count];
            int i = 0;
            foreach (var keyValue in _threads) {
                var thread = keyValue.Key;
                var adThread = keyValue.Value;

                Debug.Assert(adThread != null);
                threadObjects[i++] = adThread;
            }

            ppEnum = new AD7ThreadEnum(threadObjects);

            return VSConstants.S_OK;
        }
Ejemplo n.º 12
0
 private void SendThreadStart(AD7Thread ad7Thread)
 {
     Send(new AD7ThreadCreateEvent(), AD7ThreadCreateEvent.IID, ad7Thread);
 }
Ejemplo n.º 13
0
        private void SendLoadComplete(AD7Thread thread)
        {
            Debug.WriteLine("Sending load complete " + GetHashCode());

            if (_startModule != null) {
                SendModuleLoaded(_startModule);
                _startModule = null;
            }
            if (_startThread != null) {
                SendThreadStart(_startThread);
                _startThread = null;
            }

            var attached = EngineAttached;
            if (attached != null) {
                attached(this, new AD7EngineEventArgs(this));
            }

            Send(new AD7LoadCompleteEvent(), AD7LoadCompleteEvent.IID, thread);

            _processLoadedThread = null;
            _loadComplete.Set();

            StartWebBrowser();
        }
Ejemplo n.º 14
0
        private void OnThreadCreated(object sender, ThreadEventArgs e)
        {
            Debug.WriteLine("Thread created:  " + e.Thread.Id);
            var newThread = new AD7Thread(this, e.Thread);
            _threads.Add(e.Thread, newThread);

            lock (_syncLock) {
                if (_programCreated) {
                    SendThreadStart(newThread);
                } else {
                    _startThread = newThread;
                }
            }
        }
Ejemplo n.º 15
0
        private void OnProcessLoaded(object sender, ThreadEventArgs e)
        {
            lock (_syncLock) {
                if (_pseudoAttach) {
                    _process.Unregister();
                }

                if (_programCreated) {
                    // we've delviered the program created event, deliver the load complete event
                    SendLoadComplete(_threads[e.Thread]);
                } else {
                    Debug.WriteLine("Delaying load complete " + GetHashCode() + " on thread " + _threads[e.Thread].GetDebuggedThread().Id);
                    // we haven't delivered the program created event, wait until we do to deliver the process loaded event.
                    _processLoadedThread = _threads[e.Thread];
                }
            }
        }
Ejemplo n.º 16
0
        private void OnDebuggerOutput(object sender, OutputEventArgs e)
        {
            AD7Thread thread;
            if (!_threads.TryGetValue(e.Thread, out thread)) {
                _threads[e.Thread] = thread = new AD7Thread(this, e.Thread);
            }

            Send(new AD7DebugOutputStringEvent2(e.Output), AD7DebugOutputStringEvent2.IID, thread);
        }
Ejemplo n.º 17
0
 private void OnAsyncBreakComplete(object sender, ThreadEventArgs e)
 {
     AD7Thread thread;
     if (!_threads.TryGetValue(e.Thread, out thread)) {
         _threads[e.Thread] = thread = new AD7Thread(this, e.Thread);
     }
     Send(new AD7AsyncBreakCompleteEvent(), AD7AsyncBreakCompleteEvent.IID, thread);
 }
Ejemplo n.º 18
0
 private void SendThreadStart(AD7Thread ad7Thread)
 {
     Send(new AD7ThreadCreateEvent(), AD7ThreadCreateEvent.IID, ad7Thread);
 }