[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_private.h - Added a computerized trace format for easier parsing by external programs.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Fri, 11 Jun 2004 14:42:12 +0200

Date: Fri Jun 11 14:42:12 CEST 2004
User: Derick Rethans
Directory: xdebug

Log Message:
[1.00]
- Added a computerized trace format for easier parsing by external programs.

Modified files:
           xdebug/php_xdebug.h (version: 1.76)
           xdebug/xdebug.c (version: 1.219)
           xdebug/xdebug_private.h (version: 1.11)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- xdebug/php_xdebug.h:1.75 Sun Jun 06 00:03:54 2004 GMT
+++ xdebug/php_xdebug.h Fri Jun 11 10:42:12 2004 GMT
@@ -112,6 +112,7 @@
         char *trace_output_dir;
         char *trace_output_name;
         long trace_options;
+ long trace_format;
         char *tracefile_name;
 
         /* used for code coverage */

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.218
retrieving revision 1.219
diff -u -r1.218 -r1.219
--- xdebug/xdebug.c:1.218 Wed Jun 09 05:21:26 2004 GMT
+++ xdebug/xdebug.c Fri Jun 11 10:42:12 2004 GMT
@@ -242,8 +242,10 @@
         STD_PHP_INI_ENTRY("xdebug.trace_output_dir", "/tmp", PHP_INI_ALL, OnUpdateString, trace_output_dir, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_ENTRY("xdebug.trace_output_name", "crc32", PHP_INI_ALL, OnUpdateString, trace_output_name, zend_xdebug_globals, xdebug_globals)
 #if ZEND_EXTENSION_API_NO < 90000000
+ STD_PHP_INI_ENTRY("xdebug.trace_format", "0", PHP_INI_ALL, OnUpdateInt, trace_format, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_ENTRY("xdebug.trace_options", "0", PHP_INI_ALL, OnUpdateInt, trace_options, zend_xdebug_globals, xdebug_globals)
 #else
+ STD_PHP_INI_ENTRY("xdebug.trace_format", "0", PHP_INI_ALL, OnUpdateLong, trace_format, zend_xdebug_globals, xdebug_globals)
         STD_PHP_INI_ENTRY("xdebug.trace_options", "0", PHP_INI_ALL, OnUpdateLong, trace_options, zend_xdebug_globals, xdebug_globals)
 #endif
         STD_PHP_INI_BOOLEAN("xdebug.collect_includes","1", PHP_INI_ALL, OnUpdateBool, collect_includes, zend_xdebug_globals, xdebug_globals)
@@ -412,6 +414,7 @@
         }
 
         REGISTER_LONG_CONSTANT("XDEBUG_TRACE_APPEND", XDEBUG_TRACE_OPTION_APPEND, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("XDEBUG_TRACE_COMPUTERIZED", XDEBUG_TRACE_OPTION_COMPUTERIZED, CONST_CS | CONST_PERSISTENT);
 
         XG(breakpoint_count) = 0;
         return SUCCESS;
@@ -1237,6 +1240,10 @@
         xdebug_str str = {0, 0, NULL};
         char *tmp_value;
 
+ if (XG(trace_format) != 0) {
+ return xdstrdup("");
+ }
+
         xdebug_str_addl(&str, " ", 20, 0);
         if (XG(show_mem_delta)) {
                 xdebug_str_addl(&str, " ", 8, 0);
@@ -1253,7 +1260,7 @@
         return str.d;
 }
 
-static char* return_trace_stack_frame(function_stack_entry* i, int html TSRMLS_DC)
+static char* return_trace_stack_frame_normal(function_stack_entry* i, int html TSRMLS_DC)
 {
         int c = 0; /* Comma flag */
         int j = 0; /* Counter */
@@ -1332,6 +1339,41 @@
         return str.d;
 }
 
+static char* return_trace_stack_frame_computerized(function_stack_entry* i TSRMLS_DC)
+{
+ int c = 0; /* Comma flag */
+ int j = 0; /* Counter */
+ char *tmp_name;
+ xdebug_str str = {0, 0, NULL};
+
+ tmp_name = show_fname(i->function, 0, 0 TSRMLS_CC);
+ xdebug_str_add(&str, xdebug_sprintf("%d\t", i->level), 1);
+ xdebug_str_add(&str, xdebug_sprintf("%.4f\t", i->time - XG(start_time)), 1);
+ xdebug_str_add(&str, xdebug_sprintf("%lu\t", i->memory), 1);
+ xdebug_str_add(&str, xdebug_sprintf("%+ld\t", i->memory - i->prev_memory), 1);
+ xdebug_str_add(&str, xdebug_sprintf("%s\t", tmp_name), 1);
+ xdfree(tmp_name);
+
+ if (i->include_filename) {
+ xdebug_str_add(&str, i->include_filename, 0);
+ }
+
+ xdebug_str_add(&str, xdebug_sprintf("\t%s\t%d\n", i->filename, i->lineno), 1);
+
+ return str.d;
+}
+
+
+static char* return_trace_stack_frame(function_stack_entry* i, int html TSRMLS_DC)
+{
+ switch (XG(trace_format)) {
+ case 0:
+ return return_trace_stack_frame_normal(i, html TSRMLS_CC);
+ case 1:
+ return return_trace_stack_frame_computerized(i TSRMLS_CC);
+ }
+}
+
 #ifdef ZEND_ENGINE_2
 void xdebug_throw_exception_hook(zval *exception TSRMLS_DC)
 {
@@ -1694,6 +1736,9 @@
         } else {
                 XG(trace_file) = fopen(filename, "w");
         }
+ if (options & XDEBUG_TRACE_OPTION_COMPUTERIZED) {
+ XG(trace_format) = 1;
+ }
         XG(tracefile_name) = estrdup(filename);
         if (XG(trace_file)) {
                 str_time = xdebug_get_time();

[FILE: /xdebug/xdebug_private.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- xdebug/xdebug_private.h:1.10 Sat May 01 19:25:28 2004 GMT
+++ xdebug/xdebug_private.h Fri Jun 11 10:42:12 2004 GMT
@@ -66,7 +66,8 @@
 
 #define XDEBUG_MAX_FUNCTION_LEN 1024
 
-#define XDEBUG_TRACE_OPTION_APPEND 1
+#define XDEBUG_TRACE_OPTION_APPEND 1
+#define XDEBUG_TRACE_OPTION_COMPUTERIZED 2
 
 #define STATUS_STARTING 0
 #define STATUS_STOPPING 1
Received on Fri Jun 11 2004 - 14:42:14 BST

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