Ejemplo n.º 1
0
		public CorDebugFrame (CorDebugChain chain, WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call call, uint depth)
		{
			m_chain = chain;
			m_depthTinyCLR = depth;
			m_call = call;
			m_IP = IP_NOT_INITIALIZED;
		}
Ejemplo n.º 2
0
		public static uint AppDomainIdFromCall (Engine engine, WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call call)
		{
			uint appDomainId = CorDebugAppDomain.CAppDomainIdForNoAppDomainSupport;

			if (engine.Capabilities.AppDomains) {
				WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx callEx = call as WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx;

				appDomainId = callEx.m_appDomainID;
			}

			return appDomainId;
		}
Ejemplo n.º 3
0
        bool _WP.IController.QueueOutput( _WP.MessageRaw raw )
        {
            _WP.Packet pkt = new _WP.Packet();
            
            new _WP.Converter( this.ParentIController.Capabilities ).Deserialize( pkt, raw.m_header );

            if(m_requests.Count > c_ForcedPurgeLimit) Purge( c_ForcedPurgeThreshold );

            m_requests[pkt.m_seq] = DateTime.Now;

            return this.ParentIController.QueueOutput( raw );
        }
Ejemplo n.º 4
0
        internal bool ProcessMessage( _WP.IncomingMessage msg, bool fReply )
        {
            m_requests.Remove( msg.Header.m_seqReply );

            return m_owner.ProcessMessage( msg.Raw.m_header, msg.Raw.m_payload, fReply );
        }
Ejemplo n.º 5
0
 internal bool CanProcessMessageReply( _WP.IncomingMessage msg )
 {
     return m_requests.Contains( msg.Header.m_seqReply );
 }
Ejemplo n.º 6
0
        bool _WP.IControllerHostLocal.ProcessMessage( _WP.IncomingMessage msg, bool fReply )
        {
            bool fRes = true;

            ArrayList stubs = FindGatewayStubsForMessage( msg, fReply );

            foreach(GatewayStub stub in stubs)
            {
                try
                {
                    if(!stub.ProcessMessage( msg, fReply ))
                    {
                        fRes = false;
                    }
                }
                catch
                {
                }
            }

            return fRes;
        }
 public void OnWPCommand(_WP.IncomingMessage msg, bool fReply)
 {
     switch (msg.Header.m_cmd)
     {
         case _WP.Commands.c_Monitor_ProgramExit:
             this.Invoke((MethodInvoker)SoftDisconnect);
             break;
     }
 }
Ejemplo n.º 8
0
 public AppDomainInfo(uint id, _WP.Commands.Debugging_Resolve_AppDomain.Reply reply)
 {
     m_id = id;
     m_reply = reply;
 }
Ejemplo n.º 9
0
 bool _WP.IController.QueueOutput( _WP.MessageRaw raw )
 {
     return m_ctrl.QueueOutput( raw );
 }
Ejemplo n.º 10
0
        void OnMessage( _WP.IncomingMessage msg, string text )
        {
            byte[] buf = Encoding.ASCII.GetBytes( text );

            HandleOutput( buf, 0, buf.Length );
        }
Ejemplo n.º 11
0
		public CorDebugChain(CorDebugThread thread, WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call[] calls)
		{
			m_thread = thread;

			ArrayList frames = new ArrayList(calls.Length);
			bool lastFrameWasUnmanaged = false;

			if(thread.IsVirtualThread)
			{
				frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_FUNC_EVAL));
			}

			for(uint i = 0; i < calls.Length; i++)
			{
				WireProtocol.Commands.Debugging_Thread_Stack.Reply.Call call = calls[i];
				WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx callEx = call as WireProtocol.Commands.Debugging_Thread_Stack.Reply.CallEx;

				if(callEx != null)
				{
					if((callEx.m_flags & WireProtocol.Commands.Debugging_Thread_Stack.Reply.c_AppDomainTransition) != 0)
					{
						//No internal frame is used in the TinyCLR.  This is simply to display the AppDomain transition 
						//in the callstack of Visual Studio.
						frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_APPDOMAIN_TRANSITION));
					}

					if((callEx.m_flags & WireProtocol.Commands.Debugging_Thread_Stack.Reply.c_PseudoStackFrameForFilter) != 0)
					{
						//No internal frame is used in the TinyCLR for filters.  This is simply to display the transition 
						//in the callstack of Visual Studio.
						frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_M2U));
						frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_U2M));
					}

					if((callEx.m_flags & WireProtocol.Commands.Debugging_Thread_Stack.Reply.c_MethodKind_Interpreted) != 0)
					{
						if(lastFrameWasUnmanaged)
						{
							frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_U2M));
						}

						lastFrameWasUnmanaged = false;
					}
					else
					{
						if(!lastFrameWasUnmanaged)
						{
							frames.Add(new CorDebugInternalFrame(this, CorDebugInternalFrameType.STUBFRAME_M2U));
						}

						lastFrameWasUnmanaged = true;
					}
				}


				frames.Add(new CorDebugFrame(this, call, i));
			}

			m_frames = (CorDebugFrame[])frames.ToArray(typeof(CorDebugFrame));

			uint depthCLR = 0;
			for(int iFrame = m_frames.Length - 1; iFrame >= 0; iFrame--)
			{
				m_frames[iFrame].m_depthCLR = depthCLR;
				depthCLR++;
			}
		}
Ejemplo n.º 12
0
 public void OnCommand(WireProtocol.IncomingMessage msg, bool fReply)
 {
     switch(msg.Header.m_cmd)
     {
         case WireProtocol.Commands.c_Debugging_Execution_BreakpointHit:
             DrainBreakpoints();
             break;
         case WireProtocol.Commands.c_Monitor_ProgramExit:
             this.ICorDebugProcess.Terminate(0);
             break;
         case WireProtocol.Commands.c_Monitor_Ping:
         case WireProtocol.Commands.c_Debugging_Button_Report:
         case WireProtocol.Commands.c_Debugging_Lcd_NewFrame:
         case WireProtocol.Commands.c_Debugging_Lcd_NewFrameData:
         case WireProtocol.Commands.c_Debugging_Value_GetStack:
             //nop
             break;
         default:
             VsPackage.MessageCentre.InternalErrorMsg(false, "Unexpected command=" + msg.Header.m_cmd );
             break;
     }
 }
Ejemplo n.º 13
0
        public void OnMessage(WireProtocol.IncomingMessage msg, string text)
        {
            if (m_threads != null && m_threads.Count > 0)
            {
                if(m_appDomains != null && m_appDomains.Count > 0)
                {
                  EnqueueEvent( new ManagedCallbacks.ManagedCallbackDebugMessage( (CorDebugThread)m_threads[0], (CorDebugAppDomain)m_appDomains[0], "TinyCLR_Message", text, LoggingLevelEnum.LStatusLevel0 ) );
                }
            }
            else
            {
                VsPackage.MessageCentre.DebugMsg(text);
            }

        }
 public void OnWPMessage(_WP.IncomingMessage msg, string text)
 {
     char[] NEWLINE_CHARS = { '\r', '\n' };
     text = text.TrimEnd(NEWLINE_CHARS);
     if (String.IsNullOrEmpty(text))
     {
         LogText("");
     }
     else
     {
         LogText(String.Concat("Received message from device: ", text));
     }
 }
Ejemplo n.º 15
0
 internal void SetOwner( _WP.IControllerHostLocal owner )
 {
     m_owner = owner; 
 }        
Ejemplo n.º 16
0
        //--//

        private GatewayStub FindGatewayStubForReply( _WP.IncomingMessage msg )
        {
            ArrayList stubs = CreateCopyOfStubs();

            for(int iStub = stubs.Count - 1; iStub >= 0; iStub--)
            {
                GatewayStub stub = (GatewayStub)stubs[iStub];

                if(stub.CanProcessMessageReply( msg ))
                    return stub;
            }

            return null;
        }
Ejemplo n.º 17
0
 bool _WP.IController.QueueOutput( _WP.MessageRaw raw )
 {
     return this.ParentIControllerRemote.QueueOutput( raw );
 }
Ejemplo n.º 18
0
        private GatewayStub FindGatewayStubForRpc( _WP.IncomingMessage msg )
        {
            object payload = msg.Payload;
            uint epType    = 0;
            uint epId      = 0;

            _WP.Commands.Debugging_Messaging_Address addr = null;

            switch(msg.Header.m_cmd)
            {
                case _WP.Commands.c_Debugging_Messaging_Query:
                    addr   = ((_WP.Commands.Debugging_Messaging_Query)payload).m_addr;

                    epType = addr.m_to_Type;
                    epId   = addr.m_to_Id;
                    break;
                case _WP.Commands.c_Debugging_Messaging_Reply:
                    addr   = ((_WP.Commands.Debugging_Messaging_Reply)payload).m_addr;

                    epType = addr.m_from_Type;
                    epId   = addr.m_from_Id;
                    break;
                case _WP.Commands.c_Debugging_Messaging_Send:
                    addr   = ((_WP.Commands.Debugging_Messaging_Send)payload).m_addr;

                    epType = addr.m_to_Type;
                    epId   = addr.m_to_Id;
                    break;
                default:
                    return null;
            }

            ulong epKey = EndpointKeyFromTypeId( epType, epId );

            GatewayStub stub = (GatewayStub)m_endpoints[epKey];

            return stub;
        }
Ejemplo n.º 19
0
 public OemMonitorInfo(_WP.Commands.Monitor_OemInfo.Reply reply)
 {
     m_releaseInfo = reply.m_releaseInfo;
 }
Ejemplo n.º 20
0
        private ArrayList FindGatewayStubsForMessage( _WP.IncomingMessage msg, bool fReply )
        {
            ArrayList stubs  = null;
            GatewayStub stub = null;
            bool fMulticast  = false;

            msg.Payload = _WP.Commands.ResolveCommandToPayload( msg.Header.m_cmd, fReply, ((_WP.IController)this).Capabilities );

            _WP.Packet bp = msg.Header;

            if(fReply)
            {
                stub = FindGatewayStubForReply( msg );
            }
            else
            {
                switch(bp.m_cmd)
                {
                    case _WP.Commands.c_Monitor_Ping:
                        if((msg.Header.m_flags & _WP.Flags.c_NonCritical) == 0)
                        {
                            _WP.Commands.Monitor_Ping.Reply cmdReply = new _WP.Commands.Monitor_Ping.Reply();
                            cmdReply.m_source    = _WP.Commands.Monitor_Ping.c_Ping_Source_Host;
                            cmdReply.m_dbg_flags = (m_stopDebuggerOnBoot? _WP.Commands.Monitor_Ping.c_Ping_DbgFlag_Stop: 0);
                            
                            msg.Reply( null, _WP.Flags.c_NonCritical, cmdReply);
                        }
                        break;

                    case _WP.Commands.c_Monitor_Message:
                    case _WP.Commands.c_Monitor_ProgramExit:
                    case _WP.Commands.c_Debugging_Button_Report:
                    case _WP.Commands.c_Debugging_Execution_BreakpointHit:
                    case _WP.Commands.c_Debugging_Lcd_NewFrame:
                    case _WP.Commands.c_Debugging_Lcd_NewFrameData:
                        fMulticast = true;
                        break;

                    case _WP.Commands.c_Debugging_Messaging_Query:
                    case _WP.Commands.c_Debugging_Messaging_Reply:
                    case _WP.Commands.c_Debugging_Messaging_Send:
                        stub = FindGatewayStubForRpc( msg );
                        break;
                }
            }

            if(fMulticast)
            {
                stubs = CreateCopyOfStubs();
            }
            else
            {
                stubs = new ArrayList();

                if(stub != null)
                {
                    stubs.Add( stub );
                }
            }

            return stubs;
        }
Ejemplo n.º 21
0
 public AssemblyInfoFromResolveAssembly(_WP.Commands.Debugging_Resolve_Assembly dra)
 {
     m_dra = dra;
 }
Ejemplo n.º 22
0
 private void OnDeviceCommand(_WP.IncomingMessage msg, bool fReply)
 {
     if (!fReply)
     {
         switch (msg.Header.m_cmd)
         {
             case _WP.Commands.c_Profiling_Stream:
                 _WP.Commands.Profiling_Stream pay = (_WP.Commands.Profiling_Stream)msg.Payload;
                 //Some sort of packet ordering with 'pay.seqId' to gurantee packets are need to arrived in the correct order and aren't lost.
                 if (m_firstPacket)
                 {
                     m_firstPacket = false;
                     m_lastSeenStreamPacketID = pay.seqId;
                 }
                 else
                 {
                     if (pay.seqId == 0)
                     {
                         //Sometimes the device manages to send out a packet before the device restarts and manages to throw off sequence id checking.
                         m_lastSeenStreamPacketID = 0;
                     }
                     else
                     {
                         System.Diagnostics.Debug.Assert(pay.seqId == m_lastSeenStreamPacketID + 1);
                         m_lastSeenStreamPacketID = pay.seqId;
                     }
                 }
                 m_bitsReceived += pay.bitLen;
                 m_incomingStream.AppendChunk(pay.payload, 0, pay.bitLen);
                 break;
         }
     }
 }