[xdebug-dev] xdebug xdebug/xdebug.c xdebug/xdebug_private.h xdebug/xdebug_profiler.c - Fixed bug #68: Summary not written when script ended with "exit()".

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Tue, 21 Sep 2004 01:39:52 +0200

Date: Tue Sep 21 01:39:52 CEST 2004
User: Derick Rethans
Directory: xdebug

Log Message:
[0.50]
- Fixed bug #68: Summary not written when script ended with "exit()".

Modified files:
           xdebug/xdebug.c (version: 1.236)
           xdebug/xdebug_private.h (version: 1.13)
           xdebug/xdebug_profiler.c (version: 1.26)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.235
retrieving revision 1.236
diff -u -r1.235 -r1.236
--- xdebug/xdebug.c:1.235 Wed Sep 15 05:53:46 2004 GMT
+++ xdebug/xdebug.c Mon Sep 20 21:39:52 2004 GMT
@@ -84,6 +84,7 @@
 
 #ifdef ZEND_ENGINE_2
 void xdebug_throw_exception_hook(zval *exception TSRMLS_DC);
+int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS);
 #endif
 
 static zval *get_zval(znode *node, temp_variable *Ts, int *is_var);
@@ -421,6 +422,11 @@
         old_error_cb = zend_error_cb;
         new_error_cb = xdebug_error_cb;
 
+ /* Overload the "exit" opcode */
+#ifdef ZEND_ENGINE_2
+ zend_opcode_handlers[ZEND_EXIT] = xdebug_exit_handler;
+#endif
+
         if (zend_xdebug_initialised == 0) {
                 zend_error(E_WARNING, "Xdebug MUST be loaded as a Zend extension");
         }
@@ -727,6 +733,7 @@
         tmp->filename = NULL;
         tmp->include_filename = NULL;
         tmp->profile.call_list = xdebug_llist_alloc(profile_call_entry_dtor);
+ tmp->op_array = op_array;
 
         if (EG(current_execute_data) && EG(current_execute_data)->op_array) {
                 /* Normal function calls */
@@ -1482,6 +1489,12 @@
                 }
         }
 }
+
+int xdebug_exit_handler(ZEND_OPCODE_HANDLER_ARGS)
+{
+ xdebug_profiler_deinit(TSRMLS_C);
+ zend_exit_handler(ZEND_OPCODE_HANDLER_ARGS_PASSTHRU);
+}
 #endif
 
 void xdebug_error_cb(int type, const char *error_filename, const uint error_lineno, const char *format, va_list args)

[FILE: /xdebug/xdebug_private.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- xdebug/xdebug_private.h:1.12 Tue Aug 03 18:46:06 2004 GMT
+++ xdebug/xdebug_private.h Mon Sep 20 21:39:52 2004 GMT
@@ -162,6 +162,7 @@
         /* misc properties */
         int refcount;
         struct _function_stack_entry *prev;
+ zend_op_array *op_array;
 } function_stack_entry;
 
 function_stack_entry *xdebug_get_stack_head(TSRMLS_D);

[FILE: /xdebug/xdebug_profiler.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- xdebug/xdebug_profiler.c:1.25 Fri Jul 09 11:54:26 2004 GMT
+++ xdebug/xdebug_profiler.c Mon Sep 20 21:39:52 2004 GMT
@@ -62,6 +62,21 @@
         return SUCCESS;
 }
 
+int xdebug_profiler_deinit(TSRMLS_D)
+{
+ function_stack_entry *fse;
+ xdebug_llist_element *le;
+
+ for (le = XDEBUG_LLIST_TAIL(XG(stack)); le != NULL; le = XDEBUG_LLIST_PREV(le)) {
+ fse = XDEBUG_LLIST_VALP(le);
+ if (fse->user_defined == XDEBUG_INTERNAL) {
+ xdebug_profiler_function_internal_end(fse TSRMLS_CC);
+ } else {
+ xdebug_profiler_function_user_end(fse, fse->op_array TSRMLS_CC);
+ }
+ }
+}
+
 static inline void xdebug_profiler_function_push(function_stack_entry *fse)
 {
         fse->profile.time += xdebug_get_utime();
Received on Tue Sep 21 2004 - 01:40:04 BST

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