[xdebug-dev] xdebug xdebug/xdebug_handler_dbgp.c - provide $this in locals context if we are inside a class.

From: Shane Caraveo <shane[@]caraveo.com>
Date: Thu, 15 Jul 2004 09:29:27 +0200

Date: Thu Jul 15 09:29:27 CEST 2004
User: Shane Caraveo
Directory: xdebug

Log Message:
[1.0]
- provide $this in locals context if we are inside a class.
# zend engine 2 does not have this in the symbol table for some reason, or I am missing something obvious, either way it needs to be dealt with
Modified files:
           xdebug/xdebug_handler_dbgp.c (version: 1.50)

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -r1.49 -r1.50
--- xdebug/xdebug_handler_dbgp.c:1.49 Thu Jul 15 04:04:13 2004 GMT
+++ xdebug/xdebug_handler_dbgp.c Thu Jul 15 05:29:27 2004 GMT
@@ -1249,7 +1249,12 @@
 {
         function_stack_entry *fse;
         xdebug_hash *ht;
-
+#ifdef ZEND_ENGINE_2
+ xdebug_xml_node *contents;
+ zval ret_zval;
+ int res;
+#endif
+
         if ((fse = xdebug_get_stack_frame(depth TSRMLS_CC))) {
                 ht = fse->used_vars;
                 XG(active_symbol_table) = fse->symbol_table;
@@ -1259,6 +1264,22 @@
                         xdebug_hash_apply(ht, (void *) node, func);
                 }
 
+#ifdef ZEND_ENGINE_2
+ /* zend engine 2 does not give us $this, eval so we can get it */
+ contents = get_symbol_contents("this", sizeof("this") TSRMLS_CC);
+ if (!contents) {
+ /* if we cannot get the value directly, then try eval */
+ res = _xdebug_do_eval("$this", &ret_zval TSRMLS_CC);
+ if (res != FAILURE) {
+ contents = get_zval_value_xml_node("this", &ret_zval);
+ zval_dtor(&ret_zval);
+ }
+ }
+ if (contents) {
+ xdebug_xml_add_child(node, contents);
+ }
+#endif
+
                 XG(active_symbol_table) = NULL;
                 return 0;
         }
@@ -1541,7 +1562,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.49 $";
+ return "$Revision: 1.50 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
Received on Thu Jul 15 2004 - 09:29:34 BST

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