Esempio n. 1
0
        void OnReceiveSCThreadStarted(SCThreadStarted msg)
        {
            AD7Thread t = new AD7Thread(engine, msg.ThreadHashCode);

            threads[msg.ThreadHashCode] = t;
            engine.Callback.ThreadStarted(t);
        }
Esempio n. 2
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, StackFrameInfo info, int index)
        {
            Engine = engine;
            uint tId;

            thread.GetThreadId(out tId);
            ThreadID            = (int)tId;
            this.Thread         = thread;
            this.StackFrameInfo = info;
            Index = index;

            _functionName = info.MethodName;
            if (info.LocalVariables != null)
            {
                localVars = new ILProperty[info.LocalVariables.Length];
                for (int i = 0; i < localVars.Length; i++)
                {
                    localVars[i] = new ILProperty(engine, thread, info.LocalVariables[i], this);
                    propertyMapping[info.LocalVariables[i].Name] = localVars[i];
                }
            }
            else
            {
                localVars = new ILProperty[0];
            }
            docContext = new AD7DocumentContext(info);
        }
Esempio n. 3
0
 public ILProperty(AD7Engine engine, AD7Thread thread, VariableInfo info, AD7StackFrame frame)
 {
     this.engine = engine;
     this.thread = thread;
     this.info   = info;
     this.frame  = frame;
 }
Esempio n. 4
0
        protected override IThread HandleTheadStarted(int threadHash)
        {
            AD7Thread t = new AD7Thread(engine, threadHash);

            engine.Callback.ThreadStarted(t);
            return(t);
        }
Esempio n. 5
0
        internal void StepCompleted(AD7Thread thread)
        {
            var iid = new Guid(AD7StepCompleteEvent.IID);

            _eventCallback.Event(_engine, _engine.RemoteProcess, _engine, thread, new AD7StepCompleteEvent(), ref iid,
                                 AD7StoppingEvent.Attributes);
        }
Esempio n. 6
0
        internal void ThreadEnded(AD7Thread thread)
        {
            var iid = new Guid(AD7ThreadDestroyEvent.IID);

            _eventCallback.Event(_engine, _engine.RemoteProcess, _engine, thread, new AD7ThreadDestroyEvent(0), ref iid,
                                 AD7AsynchronousEvent.Attributes);
        }
Esempio n. 7
0
        internal void BreakpointHit(AD7PendingBreakPoint breakpoint, AD7Thread thread)
        {
            var iid = new Guid(AD7BreakpointEvent.IID);

            _eventCallback.Event(_engine, _engine.RemoteProcess, _engine, thread, new AD7BreakpointEvent(breakpoint), ref iid,
                                 AD7StoppingEvent.Attributes);
        }
Esempio n. 8
0
 public AD7Expression(AD7Engine engine, AD7Thread thread, ILProperty root, string[] names)
 {
     this.engine = engine;
     this.parent = root;
     this.thread = thread;
     this.names  = names;
     curIdx      = 1;
 }
Esempio n. 9
0
        void OnReceiveSCStepComplete(SCStepComplete msg)
        {
            AD7Thread t, bpThread = null;

            foreach (var i in msg.StackFrame)
            {
                if (threads.TryGetValue(i.Key, out t))
                {
                    t.StackFrames = i.Value;
                    if (i.Key == msg.ThreadHashCode)
                    {
                        bpThread = t;
                    }
                }
            }
            if (bpThread != null)
            {
                engine.Callback.StepCompleted(bpThread);
            }
        }
Esempio n. 10
0
        public AD7StackFrame(AD7Engine engine, AD7Thread thread, StackFrameInfo info)
        {
            Engine              = engine;
            this.Thread         = thread;
            this.StackFrameInfo = info;

            _functionName = info.MethodName;
            if (info.LocalVariables != null)
            {
                localVars = new ILProperty[info.LocalVariables.Length];
                for (int i = 0; i < localVars.Length; i++)
                {
                    localVars[i] = new ILProperty(info.LocalVariables[i]);
                    propertyMapping[info.LocalVariables[i].Name] = localVars[i];
                }
            }
            else
            {
                localVars = new ILProperty[0];
            }
            docContext = new AD7DocumentContext(info);
        }
Esempio n. 11
0
        void OnReceiveSCBreakpointHit(SCBreakpointHit msg)
        {
            AD7PendingBreakPoint bp;
            AD7Thread            t, bpThread = null;

            if (breakpoints.TryGetValue(msg.BreakpointHashCode, out bp))
            {
                foreach (var i in msg.StackFrame)
                {
                    if (threads.TryGetValue(i.Key, out t))
                    {
                        t.StackFrames = i.Value;
                        if (i.Key == msg.ThreadHashCode)
                        {
                            bpThread = t;
                        }
                    }
                }
                if (bpThread != null)
                {
                    engine.Callback.BreakpointHit(bp, bpThread);
                }
            }
        }
Esempio n. 12
0
        public VariableInfo[] EnumChildren(VariableReference parent, int threadId, uint dwTimeout)
        {
            CSEnumChildren msg = new CSEnumChildren();

            msg.ThreadHashCode = threadId;
            msg.Parent         = parent;
            SendEnumChildren(msg);

            bool aborted;
            var  res = AwaitRPCRequest <VariableInfo[]>(out aborted, (int)dwTimeout);

            if (aborted)
            {
                return new VariableInfo[] { VariableInfo.RequestTimeout }
            }
            ;
            return(res);
        }

        void SendEnumChildren(CSEnumChildren msg)
        {
            sendStream.Position = 0;
            bw.Write(msg.ThreadHashCode);
            WriteVariableReference(msg.Parent);
            socket.Send(DebugMessageType.CSEnumChildren, sendStream.GetBuffer(), (int)sendStream.Position);
        }

        void WriteVariableReference(VariableReference reference)
        {
            bw.Write(reference != null);
            if (reference != null)
            {
                bw.Write(reference.Address);

                bw.Write((byte)reference.Type);
                bw.Write(reference.Offset);
                bw.Write(reference.Name);
                WriteVariableReference(reference.Parent);
                if (reference.Parameters != null)
                {
                    bw.Write(reference.Parameters.Length);
                    foreach (var i in reference.Parameters)
                    {
                        WriteVariableReference(i);
                    }
                }
                else
                {
                    bw.Write(0);
                }
            }
        }

        void OnReceiveSCBreakpointHit(SCBreakpointHit msg)
        {
            AD7PendingBreakPoint bp;
            AD7Thread            t, bpThread = null;

            if (breakpoints.TryGetValue(msg.BreakpointHashCode, out bp))
            {
                foreach (var i in msg.StackFrame)
                {
                    if (threads.TryGetValue(i.Key, out t))
                    {
                        t.StackFrames = i.Value;
                        if (i.Key == msg.ThreadHashCode)
                        {
                            bpThread = t;
                        }
                    }
                }
                if (bpThread != null)
                {
                    engine.Callback.BreakpointHit(bp, bpThread);
                }
            }
        }

        void OnReceiveSCStepComplete(SCStepComplete msg)
        {
            AD7Thread t, bpThread = null;

            foreach (var i in msg.StackFrame)
            {
                if (threads.TryGetValue(i.Key, out t))
                {
                    t.StackFrames = i.Value;
                    if (i.Key == msg.ThreadHashCode)
                    {
                        bpThread = t;
                    }
                }
            }
            if (bpThread != null)
            {
                engine.Callback.StepCompleted(bpThread);
            }
        }

        void OnReceiveSCThreadStarted(SCThreadStarted msg)
        {
            AD7Thread t = new AD7Thread(engine, msg.ThreadHashCode);

            threads[msg.ThreadHashCode] = t;
            engine.Callback.ThreadStarted(t);
        }

        void OnReceiveSCThreadEnded(SCThreadEnded msg)
        {
            AD7Thread t;

            if (threads.TryGetValue(msg.ThreadHashCode, out t))
            {
                engine.Callback.ThreadEnded(t);
                threads.Remove(msg.ThreadHashCode);
            }
        }
    }
Esempio n. 13
0
 public ILProperty(AD7Engine engine, AD7Thread thread, VariableInfo info)
 {
     this.engine = engine;
     this.thread = thread;
     this.info   = info;
 }