[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_handler_dbgp.c - Added the xdebug.remote_log setting that allows you to log debugger

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 4 Apr 2006 19:01:10 +0200

Date: Tue Apr 4 19:01:10 CEST 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[0.25]
- Added the xdebug.remote_log setting that allows you to log debugger
  communication to a log file for debugging. This can also be set through the
  "remote_log" element in the XDEBUG_CONFIG environment variable.

Modified files:
           xdebug/php_xdebug.h (version: 1.104)
           xdebug/xdebug.c (version: 1.309)
           xdebug/xdebug_handler_dbgp.c (version: 1.87)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -r1.103 -r1.104
--- xdebug/php_xdebug.h:1.103 Fri Mar 10 11:10:25 2006 GMT
+++ xdebug/php_xdebug.h Tue Apr 04 15:01:10 2006 GMT
@@ -157,6 +157,8 @@
         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 */
+ char *remote_log; /* Filename to log protocol communication to */
+ FILE *remote_log_file; /* File handler for protocol log */
 
         char *ide_key; /* from environment, USER, USERNAME or empty */
 

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.308
retrieving revision 1.309
diff -u -r1.308 -r1.309
--- xdebug/xdebug.c:1.308 Sun Apr 02 05:31:03 2006 GMT
+++ xdebug/xdebug.c Tue Apr 04 15:01:10 2006 GMT
@@ -327,6 +327,7 @@
         STD_PHP_INI_ENTRY("xdebug.remote_port", "9000", PHP_INI_ALL, OnUpdateLong, remote_port, zend_xdebug_globals, xdebug_globals)
 #endif
         STD_PHP_INI_BOOLEAN("xdebug.remote_autostart","0", PHP_INI_ALL, OnUpdateBool, remote_autostart, 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.allowed_clients", "", PHP_INI_SYSTEM, OnUpdateAllowedClients)
         PHP_INI_ENTRY("xdebug.idekey", "", PHP_INI_ALL, OnUpdateIDEKey)
 PHP_INI_END()
@@ -439,6 +440,9 @@
                 } else
                 if (strcasecmp(envvar, "profiler_enable_trigger") == 0) {
                         name = "xdebug.profiler_enable_trigger";
+ } else
+ if (strcasecmp(envvar, "remote_log") == 0) {
+ name = "xdebug.remote_log";
                 }
 
                 if (name) {

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- xdebug/xdebug_handler_dbgp.c:1.86 Wed Mar 15 21:51:31 2006 GMT
+++ xdebug/xdebug_handler_dbgp.c Tue Apr 04 15:01:10 2006 GMT
@@ -229,6 +229,9 @@
         xdebug_str_ptr_init(ret);
 
         xdebug_xml_return_node(message, &xml_message);
+ if (XG(remote_log_file)) {
+ fprintf(XG(remote_log_file), "-> %s\n\n", xml_message.d);
+ }
 
         xdebug_str_add(ret, xdebug_sprintf("%d", xml_message.l), 1);
         xdebug_str_addl(ret, "\0", 1, 0);
@@ -2020,6 +2023,9 @@
         xdebug_dbgp_cmd *command;
         xdebug_xml_node *error;
 
+ if (XG(remote_log_file)) {
+ fprintf(XG(remote_log_file), "<- %s\n", line);
+ }
         res = xdebug_dbgp_parse_cmd(line, (char**) &cmd, (xdebug_dbgp_arg**) &args);
 
         /* Add command name to return packet */
@@ -2078,7 +2084,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.86 $";
+ return "$Revision: 1.87 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
@@ -2200,6 +2206,16 @@
         context->eval_id_lookup = xdebug_hash_alloc(64, (xdebug_hash_dtor) xdebug_hash_eval_info_dtor);
         context->eval_id_sequence = 0;
 
+ XG(remote_log_file) = NULL;
+ if (XG(remote_log) && strlen(XG(remote_log))) {
+ XG(remote_log_file) = fopen(XG(remote_log), "a");
+ }
+ if (XG(remote_log_file)) {
+ char *timestr = xdebug_get_time();
+ fprintf(XG(remote_log_file), "Log opened at %s\n", timestr);
+ xdfree(timestr);
+ }
+
         xdebug_dbgp_cmdloop(context TSRMLS_CC);
 
         return 1;
@@ -2245,6 +2261,13 @@
         xdebug_hash_destroy(context->breakpoint_list);
         xdfree(context->buffer);
 
+ if (XG(remote_log_file)) {
+ char *timestr = xdebug_get_time();
+ fprintf(XG(remote_log_file), "Log closed at %s\n\n", timestr);
+ xdfree(timestr);
+ fclose(XG(remote_log_file));
+ XG(remote_log_file) = NULL;
+ }
         return 1;
 }
 
Received on Tue Apr 04 2006 - 19:01:12 BST

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