[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c - Added a patch by Lucas Nealan (lucas@php.net) and Brian Shire (shire@php.net)

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Thu, 11 Jun 2009 10:10:35 +0200

Date: Thu Jun 11 10:10:35 CEST 2009
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Added a patch by Lucas Nealan (lucas[@]php.net) and Brian Shire (shire[@]php.net)
  of Facebook to allow connections to the initiating request's IP address for
  remote debugging.

Modified files:
           xdebug/php_xdebug.h (version: 1.150)
           xdebug/xdebug.c (version: 1.449)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.149
retrieving revision 1.150
diff -u -r1.149 -r1.150
--- xdebug/php_xdebug.h:1.149 Thu May 07 18:39:13 2009 GMT
+++ xdebug/php_xdebug.h Thu Jun 11 06:10:34 2009 GMT
@@ -203,6 +203,7 @@
         long remote_mode; /* XDEBUG_NONE, XDEBUG_JIT, XDEBUG_REQ */
         char *remote_handler; /* php3, gdb, dbgp */
         zend_bool remote_autostart; /* Disables the requirement for XDEBUG_SESSION_START */
+ zend_bool remote_connect_back; /* connect back to the HTTP requestor */
         char *remote_log; /* Filename to log protocol communication to */
         FILE *remote_log_file; /* File handler for protocol log */
         long remote_cookie_expire_time; /* Expire time for the remote-session cookie */

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.448
retrieving revision 1.449
diff -u -r1.448 -r1.449
--- xdebug/xdebug.c:1.448 Wed Jun 03 05:31:26 2009 GMT
+++ xdebug/xdebug.c Thu Jun 11 06:10:34 2009 GMT
@@ -288,6 +288,7 @@
         PHP_INI_ENTRY("xdebug.remote_mode", "req", PHP_INI_ALL, OnUpdateDebugMode)
         STD_PHP_INI_ENTRY("xdebug.remote_port", "9000", PHP_INI_ALL, OnUpdateLong, remote_port, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_BOOLEAN("xdebug.remote_autostart","0", PHP_INI_ALL, OnUpdateBool, remote_autostart, zend_xdebug_globals, xdebug_globals)
+ STD_PHP_INI_BOOLEAN("xdebug.remote_connect_back","0", PHP_INI_SYSTEM, OnUpdateBool, remote_connect_back, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_ENTRY("xdebug.remote_log", "", PHP_INI_ALL, OnUpdateString, remote_log, zend_xdebug_globals, xdebug_globals)
         PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateIDEKey)
         STD_PHP_INI_ENTRY("xdebug.remote_cookie_expire_time", "3600", PHP_INI_ALL, OnUpdateLong, remote_cookie_expire_time, zend_xdebug_globals, xdebug_globals)
@@ -843,6 +844,11 @@
                 XG(ide_key) = xdstrdup(idekey);
         }
 
+ /* This is to kick the global variable JIT-mechanism in PHP */
+#ifdef ZEND_ENGINE_2
+ zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
+#endif
+
         /* Check if we have this special get variable that stops a debugging
          * request without executing any code */
         if (
@@ -1523,7 +1529,13 @@
                         (XG(remote_mode) == XDEBUG_REQ)
                 ) {
                         /* Initialize debugging session */
- XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
+ if (XG(remote_connect_back)) {
+ zval **remote_addr = NULL;
+ zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr);
+ XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port));
+ } else {
+ XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
+ }
                         if (XG(context).socket >= 0) {
                                 XG(remote_enabled) = 1;
 
@@ -2337,7 +2349,13 @@
 static void xdebug_do_jit(TSRMLS_D)
 {
         if (!XG(remote_enabled) && XG(remote_enable) && (XG(remote_mode) == XDEBUG_JIT)) {
- XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
+ if (XG(remote_connect_back)) {
+ zval **remote_addr = NULL;
+ zend_hash_find(Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]), "REMOTE_ADDR", 12, (void**)&remote_addr);
+ XG(context).socket = xdebug_create_socket(Z_STRVAL_PP(remote_addr), XG(remote_port));
+ } else {
+ XG(context).socket = xdebug_create_socket(XG(remote_host), XG(remote_port));
+ }
                 if (XG(context).socket >= 0) {
                         XG(remote_enabled) = 0;
 
Received on Thu Jun 11 2009 - 10:10:38 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST