[xdebug-dev] xdebug xdebug/php_xdebug.h xdebug/xdebug.c xdebug/xdebug_handler_dbgp.c xdebug/xdebug_private.h - Fixed support for showing $this in remote debugging sessions.

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Fri, 21 Aug 2009 19:42:39 +0200

Date: Fri Aug 21 19:42:39 CEST 2009
User: Derick Rethans
Directory: xdebug

Log Message:
[5.00]
- Fixed support for showing $this in remote debugging sessions.

Modified files:
           xdebug/php_xdebug.h (version: 1.153)
           xdebug/xdebug.c (version: 1.455)
           xdebug/xdebug_handler_dbgp.c (version: 1.139)
           xdebug/xdebug_private.h (version: 1.29)

[FILE: /xdebug/php_xdebug.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.152
retrieving revision 1.153
diff -u -r1.152 -r1.153
--- xdebug/php_xdebug.h:1.152 Mon Jul 06 07:05:59 2009 GMT
+++ xdebug/php_xdebug.h Fri Aug 21 15:42:38 2009 GMT
@@ -151,6 +151,7 @@
         HashTable *active_symbol_table;
         zend_execute_data *active_execute_data;
         zend_op_array *active_op_array;
+ zval *This;
         unsigned int prev_memory;
         char *file_link_format;
 

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.454
retrieving revision 1.455
diff -u -r1.454 -r1.455
--- xdebug/xdebug.c:1.454 Thu Jul 09 14:51:44 2009 GMT
+++ xdebug/xdebug.c Fri Aug 21 15:42:38 2009 GMT
@@ -832,6 +832,7 @@
         XG(prev_memory) = 0;
         XG(function_count) = 0;
         XG(active_symbol_table) = NULL;
+ XG(This) = NULL;
         XG(last_exception_trace) = NULL;
         XG(last_eval_statement) = NULL;
         XG(do_collect_errors) = 0;
@@ -1597,6 +1598,7 @@
 
         fse->symbol_table = EG(active_symbol_table);
         fse->execute_data = EG(current_execute_data);
+ fse->This = EG(This);
 
         if (XG(remote_enabled) || XG(collect_vars) || XG(show_local_vars)) {
                 /* Because include/require is treated as a stack level, we have to add used

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -r1.138 -r1.139
--- xdebug/xdebug_handler_dbgp.c:1.138 Sat Jul 04 12:31:44 2009 GMT
+++ xdebug/xdebug_handler_dbgp.c Fri Aug 21 15:42:39 2009 GMT
@@ -377,8 +377,8 @@
 
                         /* Handle "this" in a different way */
                         if (type == XF_ST_ROOT && strcmp("this", element) == 0) {
- if (XG(active_execute_data)) {
- retval_p = XG(active_execute_data)->object;
+ if (XG(This)) {
+ retval_p = XG(This);
                                 } else {
                                         retval_p = NULL;
                                 }
@@ -1631,6 +1631,7 @@
 #endif
                         XG(active_symbol_table) = fse->symbol_table;
                         XG(active_op_array) = fse->op_array;
+ XG(This) = fse->This;
                 } else {
                         RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
                 }
@@ -1703,6 +1704,7 @@
 #endif
                         XG(active_symbol_table) = fse->symbol_table;
                         XG(active_op_array) = fse->op_array;
+ XG(This) = fse->This;
                 } else {
                         RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
                 }
@@ -1815,6 +1817,7 @@
 #endif
                 XG(active_symbol_table) = fse->symbol_table;
                 XG(active_op_array) = fse->op_array;
+ XG(This) = fse->This;
         } else {
                 RETURN_RESULT(XG(status), XG(reason), XDEBUG_ERROR_STACK_DEPTH_INVALID);
         }
@@ -1865,6 +1868,7 @@
 static int attach_context_vars(xdebug_xml_node *node, xdebug_var_export_options *options, long context_id, long depth, void (*func)(void *, xdebug_hash_element*, void*) TSRMLS_DC)
 {
         function_stack_entry *fse;
+ char *var_name;
 
         /* right now, we only have zero or one, one being globals, which is
          * always the head of the stack */
@@ -1898,21 +1902,26 @@
 #endif
                 XG(active_symbol_table) = fse->symbol_table;
                 XG(active_op_array) = fse->op_array;
+ XG(This) = fse->This;
 
                 /* Only show vars when they are scanned */
                 if (fse->used_vars) {
                         xdebug_hash *tmp_hash;
                         tmp_hash = xdebug_used_var_hash_from_llist(fse->used_vars);
                         xdebug_hash_apply_with_argument(tmp_hash, (void *) node, func, (void *) options);
+
+ /* zend engine 2 does not give us $this, eval so we can get it */
+ if (!xdebug_hash_find(tmp_hash, "this", 4, (void *) &var_name)) {
+ add_variable_node(node, "this", sizeof("this"), 1, 1, 0, options TSRMLS_CC);
+ }
+
                         xdebug_hash_destroy(tmp_hash);
                 }
 
- /* zend engine 2 does not give us $this, eval so we can get it */
- add_variable_node(node, "$this", sizeof("$this"), 1, 1, 0, options TSRMLS_CC);
-
                 XG(active_symbol_table) = NULL;
                 XG(active_execute_data) = NULL;
                 XG(active_op_array) = NULL;
+ XG(This) = NULL;
                 return 0;
         }
         
@@ -2269,7 +2278,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.138 $";
+ return "$Revision: 1.139 $";
 }
 
 static int xdebug_dbgp_cmdloop(xdebug_con *context, int bail TSRMLS_DC)

[FILE: /xdebug/xdebug_private.h]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- xdebug/xdebug_private.h:1.28 Thu May 07 18:39:13 2009 GMT
+++ xdebug/xdebug_private.h Fri Aug 21 15:42:39 2009 GMT
@@ -166,6 +166,7 @@
         xdebug_llist *used_vars;
         HashTable *symbol_table;
         zend_execute_data *execute_data;
+ zval *This;
 
         /* tracing properties */
         signed long memory;
Received on Fri Aug 21 2009 - 19:55:11 BST

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