public static UnityAttachInfo GetUnityAttachInfo(long processId, ref IUnityDbgConnector connector)
        {
            if (ConnectorRegistry.Connectors.ContainsKey((uint)processId))
            {
                connector = ConnectorRegistry.Connectors[(uint)processId];
                return(connector.SetupConnection());
            }
            else if (UnityPlayers.ContainsKey((uint)processId))
            {
                PlayerConnection.PlayerInfo player = UnityPlayers[(uint)processId];
                int port = 0 == player.m_DebuggerPort
                    ? (int)(56000 + processId % 1000)
                    : (int)player.m_DebuggerPort;
                try
                {
                    return(new UnityAttachInfo(player.m_Id, player.m_IPEndPoint.Address, port));
                }
                catch (Exception ex)
                {
                    throw new Exception($"Unable to attach to {player.m_IPEndPoint.Address}:{port}", ex);
                }
            }

            long defaultPort = 56000 + (processId % 1000);

            return(new UnityAttachInfo(null, IPAddress.Loopback, (int)defaultPort));
        }
        public override void Disconnect(Response response, dynamic args)
        {
            Log.Write($"UnityDebug: Disconnect: {args}");
            Log.Write($"UnityDebug: Disconnect: {response}");
            if (unityDebugConnector != null)
            {
                unityDebugConnector.OnDisconnect();
                unityDebugConnector = null;
            }

            lock (m_Lock)
            {
                if (m_Session != null)
                {
                    m_DebuggeeExecuting = true;
                    m_Breakpoints       = null;
                    m_Session.Breakpoints.Clear();
                    m_Session.Continue();
                    m_Session.Detach();
                    m_Session.Adaptor.Dispose();
                    m_Session = null;
                }
            }

            SendOutput("stdout", "UnityDebug: Disconnected");
            SetResponse(response);
        }
Example #3
0
        protected override void OnAttachToProcess(long processId)
        {
            if (connectorRegistry.Connectors.ContainsKey((uint)processId))
            {
                currentConnector = connectorRegistry.Connectors[(uint)processId];
                StartConnecting(currentConnector.SetupConnection(), 3, 1000);
                return;
            }
            else if (UnitySoftDebuggerEngine.UnityPlayers.ContainsKey((uint)processId))
            {
                PlayerConnection.PlayerInfo player = UnitySoftDebuggerEngine.UnityPlayers[(uint)processId];
                int port = (0 == player.m_DebuggerPort
                                        ? (int)(56000 + (processId % 1000))
                                        : (int)player.m_DebuggerPort);
                try {
                    StartConnecting(new SoftDebuggerStartInfo(new SoftDebuggerConnectArgs(player.m_Id, player.m_IPEndPoint.Address, (int)port)), 3, 1000);
                } catch (Exception ex) {
                    throw new Exception(string.Format("Unable to attach to {0}:{1}", player.m_IPEndPoint.Address, port), ex);
                }
                return;
            }

            long defaultPort = 56000 + (processId % 1000);

            StartConnecting(new SoftDebuggerStartInfo(new SoftDebuggerConnectArgs(null, IPAddress.Loopback, (int)defaultPort)), 3, 1000);
        }
        public override Task <DebugResult> Disconnect()
        {
            if (unityDebugConnector != null)
            {
                unityDebugConnector.OnDisconnect();
                unityDebugConnector = null;
            }

            Debugger.Disconnect();
            return(Task.FromResult(CreateDebugResult("UnityDebug: Disconnected")));
        }
        public override void Disconnect(Response response, dynamic args)
        {
            if (unityDebugConnector != null)
            {
                unityDebugConnector.OnDisconnect();
                unityDebugConnector = null;
            }

            Debugger.Disconnect();
            SendOutput("stdout", "UnityDebug: Disconnected");
            SendResponse(response);
        }
Example #6
0
        protected override void OnDetach()
        {
            try {
                base.OnDetach();
            } catch (ObjectDisposedException) {
            } catch (VMDisconnectedException) {
            } catch (NullReferenceException) {
            }

            if (currentConnector != null)
            {
                currentConnector.OnDisconnect();
                currentConnector = null;
            }
        }
Example #7
0
        protected override void OnDetach()
        {
            try {
                Ide.DispatchService.GuiDispatch(() =>
                                                Ide.IdeApp.Workbench.CurrentLayout = UnityProjectServiceExtension.EditLayout
                                                );

                VirtualMachine.Detach();
                base.EndSession();
            } catch (ObjectDisposedException) {
            } catch (VMDisconnectedException) {
            } catch (NullReferenceException) {
            }

            if (currentConnector != null)
            {
                currentConnector.OnDisconnect();
                currentConnector = null;
            }
        }
		protected override void OnDetach()
		{
			try {
				base.OnDetach();
			} catch (ObjectDisposedException) {
			} catch (VMDisconnectedException) {
			} catch (NullReferenceException) {
			}

			if (currentConnector != null) {
				currentConnector.OnDisconnect();
				currentConnector = null;
			}
		}
		protected override void OnAttachToProcess (long processId)
		{
			if (connectorRegistry.Connectors.ContainsKey((uint)processId)) {
				currentConnector = connectorRegistry.Connectors[(uint)processId];
				StartConnecting(currentConnector.SetupConnection(), 3, 1000);
				return;
			} else if (UnitySoftDebuggerEngine.UnityPlayers.ContainsKey ((uint)processId)) {
				PlayerConnection.PlayerInfo player = UnitySoftDebuggerEngine.UnityPlayers[(uint)processId];
				int port = (0 == player.m_DebuggerPort
					? (int)(56000 + (processId % 1000))
					: (int)player.m_DebuggerPort);
				try {
					StartConnecting (new SoftDebuggerStartInfo (new SoftDebuggerConnectArgs (player.m_Id, player.m_IPEndPoint.Address, (int)port)), 3, 1000);
				} catch (Exception ex) {
					throw new Exception (string.Format ("Unable to attach to {0}:{1}", player.m_IPEndPoint.Address, port), ex);
				}
				return;
			}
			base.OnAttachToProcess (processId);
		}
		public override Task<DebugResult> Disconnect()
		{
			if (unityDebugConnector != null) {
				unityDebugConnector.OnDisconnect ();
				unityDebugConnector = null;
			}

			Debugger.Disconnect();
			return Task.FromResult(CreateDebugResult("UnityDebug: Disconnected"));
		}
        public override void Disconnect(Response response, dynamic args)
        {
            if (unityDebugConnector != null) {
                unityDebugConnector.OnDisconnect ();
                unityDebugConnector = null;
            }

            Debugger.Disconnect();
            SendOutput("stdout", "UnityDebug: Disconnected");
            SendResponse(response);
        }
		protected override void OnDetach()
		{
			try
			{
				Ide.DispatchService.GuiDispatch(() =>
					Ide.IdeApp.Workbench.CurrentLayout = UnityProjectServiceExtension.EditLayout
				);

				VirtualMachine.Detach();
				base.EndSession();
			}
			catch (ObjectDisposedException)
			{
			}
			catch (VMDisconnectedException)
			{
			}
			catch (NullReferenceException)
			{
			}

			if (currentConnector != null) {
				currentConnector.OnDisconnect();
				currentConnector = null;
			}
		}