From: robekras Date: Wed, 14 Jun 2006 10:04:34 +0000 (+0000) Subject: 1) Open port 7869 for dbg communication if we run a non remote debug session, as... X-Git-Url: http://secure.phpeclipse.com 1) Open port 7869 for dbg communication if we run a non remote debug session, as the free dbg version uses only this port as default. 2) Terminate the debug session if the DBGC_END event is send from dbg. (We have to wait for a new version of dbg, due to the fact that dbg in the current version (2.13.1) closes the socket before DBGC_END is send). --- diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java index 1cbb0a9..89ef3a2 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGInterface.java @@ -976,6 +976,7 @@ public class PHPDBGInterface { case PHPDBGBase.DBGC_END: sessionEnded = true; + this.proxy.setTerminated(); break; case PHPDBGBase.DBGC_BREAKPOINT: diff --git a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java index 5c7e639..77d751e 100644 --- a/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java +++ b/net.sourceforge.phpeclipse.debug.core/src/net/sourceforge/phpdt/internal/debug/core/PHPDBGProxy.java @@ -96,6 +96,14 @@ public class PHPDBGProxy { phpLoop.notifyWait (); } + + public void setTerminated () { + try { + PHPMainThread.terminate (); + } + catch (DebugException e) { + } + } /** * TODO Is this method called from anywhere? @@ -115,15 +123,26 @@ public class PHPDBGProxy { } /** - * - * TODO The example for setting up DBG within PHP.ini shows ports from 10000 to 10016 ??? - * if my interpretation is correct. - * How can we find the correct DBG port? + * Find a free unused port between 10001 and 10101 if the current debug session + * is for remote debugging, and a unused port 7869 if it is used as non remote debugging. + * + * For remote debugging the used port is submitted with the URL. + * E.g. http://localhost/index.php?DBGSESSID=1@localhost:10001 + * For non remote debugging (if PHPeclipse used e.g. php cli directly) no port + * can be submitted by parameter, and only the default port (7869) can be used. + * + * @note: The free dbg version doesn't allow to set the appropriate port within php.ini! + * + * */ protected void createServerSocket () { - port = SocketUtil.findUnusedLocalPort ("localhost", 10001, 10101); // Get the first free port in the range from 10001 to 10101 - -// port = 10001; + if (this.remote) { + port = SocketUtil.findUnusedLocalPort ("localhost", 10001, 10101); // Get the first free port in the range from 10001 to 10101 + } + else { + port = SocketUtil.findUnusedLocalPort ("localhost", 7869, 7869); // Get the first free port in the range from 7869 to 7869 + } + if (port == -1) { // Did we get a free port? PHPDebugCorePlugin.log (5, "Cannot find free port!!!!"); // No, output a error message @@ -135,7 +154,6 @@ public class PHPDBGProxy { //System.out.println("ServerSocket on port: " + port); } } catch (IOException e) { - // IO Error PHPDebugCorePlugin.log (e); stop (); }