Ejemplo n.º 1
0
        private void SendLoadComplete(AD7Thread thread)
        {
            Debug.WriteLine("Sending load complete" + GetHashCode());
            AD7ProgramCreateEvent.Send(this);

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

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

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

            _processLoadedThread = null;

            EventHandler <AD7EngineEventArgs> attached = EngineAttached;

            if (attached != null)
            {
                attached(this, new AD7EngineEventArgs(this));
            }
        }
Ejemplo n.º 2
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, NodeStackFrame threadContext)
        {
            _engine = engine;
            _thread = thread;
            _stackFrame = threadContext;

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

            _parameters = threadContext.Parameters.ToArray();
            _locals     = threadContext.Locals.ToArray();
        }
Ejemplo n.º 4
0
        // EnumThreads is called by the debugger when it needs to enumerate the threads in the program.
        public int EnumThreads(out IEnumDebugThreads2 ppEnum)
        {
            var       threadObjects = new AD7Thread[1];
            AD7Thread adThread      = _threads.Item2;

            Debug.Assert(adThread != null);
            threadObjects[0] = adThread;

            ppEnum = new AD7ThreadEnum(threadObjects);

            return(VSConstants.S_OK);
        }
Ejemplo n.º 5
0
        private void OnThreadCreated(object sender, EventArgs e)
        {
            var nodeThread = new NodeThread(_process, _process.Id);
            var newThread  = new AD7Thread(this, nodeThread);

            _threads = new Tuple <NodeThread, AD7Thread>(nodeThread, newThread);

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

                if (_programCreated)
                {
                    // we've delviered the program created event, deliver the load complete event
                    SendLoadComplete(_threads.Item2);
                }
                else
                {
                    // we haven't delivered the program created event, wait until we do to deliver the process loaded event.
                    _processLoadedThread = _threads.Item2;
                }
            }

            AttachThreadEvents(_process.Debugger);
        }
Ejemplo n.º 7
0
 private void SendThreadStart(AD7Thread ad7Thread)
 {
     Send(new AD7ThreadCreateEvent(), AD7ThreadCreateEvent.IID, ad7Thread);
 }
Ejemplo n.º 8
0
        private void OnThreadCreated(object sender, EventArgs e)
        {
            var nodeThread = new NodeThread(_process, _process.Id);
            var newThread = new AD7Thread(this, nodeThread);
            _threads = new Tuple<NodeThread, AD7Thread>(nodeThread, newThread);

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

                if (_programCreated)
                {
                    // we've delviered the program created event, deliver the load complete event
                    SendLoadComplete(_threads.Item2);
                }
                else
                {
                    // we haven't delivered the program created event, wait until we do to deliver the process loaded event.
                    _processLoadedThread = _threads.Item2;
                }
            }

            AttachThreadEvents(_process.Debugger);
        }
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)
        {
            var threadObjects = new AD7Thread[1];
            AD7Thread adThread = _threads.Item2;

            Debug.Assert(adThread != null);
            threadObjects[0] = adThread;

            ppEnum = new AD7ThreadEnum(threadObjects);

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

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

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

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

            _processLoadedThread = null;

            EventHandler<AD7EngineEventArgs> attached = EngineAttached;
            if (attached != null)
            {
                attached(this, new AD7EngineEventArgs(this));
            }
        }