[xdebug-dev] xdebug xdebug/xdebug.c xdebug/xdebug_handler_dbgp.c - Fixed fetching private properies from objects when the object was an

From: Derick Rethans <derick[@]derickrethans.nl>
Date: Fri, 1 Dec 2006 20:38:21 +0100

Date: Fri Dec 1 20:38:21 CET 2006
User: Derick Rethans
Directory: xdebug

Log Message:
[3.00]
- Fixed fetching private properies from objects when the object was an
  array element.
- Improved use of width in stack traces by using tooltips for directories
  and values of parameters.

Modified files:
           xdebug/xdebug.c (version: 1.362)
           xdebug/xdebug_handler_dbgp.c (version: 1.107)

[FILE: /xdebug/xdebug.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.361
retrieving revision 1.362
diff -u -r1.361 -r1.362
--- xdebug/xdebug.c:1.361 Fri Nov 10 10:33:29 2006 GMT
+++ xdebug/xdebug.c Fri Dec 01 18:38:21 2006 GMT
@@ -1565,13 +1565,13 @@
         "<tr><th align='left' bgcolor='#f57900' colspan=\"5\"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> %s: %s in %s on line <i>%d</i></th></tr>\n",
 #if HAVE_PHP_MEMORY_USAGE
         "<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>\n<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>\n",
- "<tr><td bgcolor='#eeeeec' align='center'>%d</td><td bgcolor='#eeeeec' align='center'>%.4f</td><td bgcolor='#eeeeec' align='right'>%ld</td><td bgcolor='#eeeeec'>%s(",
+ "<tr><td bgcolor='#eeeeec' align='center'>%d</td><td bgcolor='#eeeeec' align='center'>%.4f</td><td bgcolor='#eeeeec' align='right'>%ld</td><td bgcolor='#eeeeec'>%s( ",
 #else
         "<tr><th align='left' bgcolor='#e9b96e' colspan='4'>Call Stack</th></tr>\n<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>\n",
- "<tr><td bgcolor='#eeeeec' align='center'>%d</td><td bgcolor='#eeeeec' align='center'>%.4f</td><td bgcolor='#eeeeec'>%s(",
+ "<tr><td bgcolor='#eeeeec' align='center'>%d</td><td bgcolor='#eeeeec' align='center'>%.4f</td><td bgcolor='#eeeeec'>%s( ",
 #endif
         "<font color='#00bb00'>'%s'</font>",
- ")</td><td bgcolor='#eeeeec'>%s<b>:</b>%d</td></tr>\n",
+ " )</td><td title='%s' bgcolor='#eeeeec'>..%s<b>:</b>%d</td></tr>\n",
 #if HAVE_PHP_MEMORY_USAGE
         "<tr><th align='left' colspan='5' bgcolor='#e9b96e'>Variables in local scope (#%d)</th></tr>\n",
 #else
@@ -1724,7 +1724,8 @@
 
                         /* Printing vars */
                         for (j = 0; j < i->varc; j++) {
- char *tmp_varname, *tmp_value, *tmp_fancy_value;
+ char *tmp_varname, *tmp_value, *tmp_fancy_value, *tmp_fancy_synop_value;
+ int newlen;
 
                                 if (c) {
                                         xdebug_str_addl(&str, ", ", 2, 0);
@@ -1733,9 +1734,13 @@
                                 }
                                 tmp_varname = i->var[j].name ? xdebug_sprintf("$%s = ", i->var[j].name) : xdstrdup("");
                                 if (html) {
- tmp_fancy_value = get_zval_synopsis_fancy(tmp_varname, i->var[j].addr, &len, 0, NULL TSRMLS_CC);
- xdebug_str_add(&str, xdebug_sprintf("%s", tmp_fancy_value), 1);
- xdfree(tmp_fancy_value);
+ tmp_value = get_zval_value(i->var[j].addr, 0, NULL);
+ tmp_fancy_value = xmlize(tmp_value, strlen(tmp_value), &newlen);
+ tmp_fancy_synop_value = get_zval_synopsis_fancy(tmp_varname, i->var[j].addr, &len, 0, NULL TSRMLS_CC);
+ xdebug_str_add(&str, xdebug_sprintf("<span title='%s'>%s</span>", tmp_fancy_value, tmp_fancy_synop_value), 1);
+ xdfree(tmp_value);
+ efree(tmp_fancy_value);
+ xdfree(tmp_fancy_synop_value);
                                 } else {
                                         tmp_value = get_zval_synopsis(i->var[j].addr, 0, NULL);
                                         xdebug_str_add(&str, xdebug_sprintf("%s%s", tmp_varname, tmp_value), 1);
@@ -1748,7 +1753,12 @@
                                 xdebug_str_add(&str, xdebug_sprintf(formats[4], i->include_filename), 1);
                         }
 
- xdebug_str_add(&str, xdebug_sprintf(formats[5], i->filename, i->lineno), 1);
+ if (html) {
+ char *just_filename = strrchr(i->filename, '/');
+ xdebug_str_add(&str, xdebug_sprintf(formats[5], i->filename, just_filename, i->lineno), 1);
+ } else {
+ xdebug_str_add(&str, xdebug_sprintf(formats[5], i->filename, i->lineno), 1);
+ }
                 }
 
                 if (XG(dump_globals) && !(XG(dump_once) && XG(dumped))) {

[FILE: /xdebug/xdebug_handler_dbgp.c]

===================================================================
RCS file: cvstemp,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -r1.106 -r1.107
--- xdebug/xdebug_handler_dbgp.c:1.106 Fri Nov 24 07:55:19 2006 GMT
+++ xdebug/xdebug_handler_dbgp.c Fri Dec 01 18:38:21 2006 GMT
@@ -370,32 +370,40 @@
 
 inline static char *fetch_classname_from_zval(zval *z, int *length TSRMLS_DC)
 {
+ if (Z_TYPE_P(z) != IS_OBJECT) {
+ return NULL;
+ }
 #if PHP_MAJOR_VERSION == 4
- zend_class_entry *ce;
- ce = Z_OBJCE_P(z);
- *length = ce->name_length;
- return estrdup(ce->name);
+ {
+ zend_class_entry *ce;
+ ce = Z_OBJCE_P(z);
+ *length = ce->name_length;
+ return estrdup(ce->name);
+ }
 #endif
 #if PHP_MAJOR_VERSION >= 5
- char *name;
- zend_uint name_len;
+ {
+ char *name;
+ zend_uint name_len;
 
- if (Z_OBJ_HT_P(z)->get_class_name == NULL ||
- Z_OBJ_HT_P(z)->get_class_name(z, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) {
- zend_class_entry *ce;
+ if (Z_OBJ_HT_P(z)->get_class_name == NULL ||
+ Z_OBJ_HT_P(z)->get_class_name(z, &name, &name_len, 0 TSRMLS_CC) != SUCCESS) {
+ zend_class_entry *ce;
 
- ce = zend_get_class_entry(z TSRMLS_CC);
- if (!ce) {
- return NULL;
- }
+ ce = zend_get_class_entry(z TSRMLS_CC);
+ if (!ce) {
+ return NULL;
+ }
 
- *length = ce->name_length;
- return estrdup(ce->name);
- }
+ *length = ce->name_length;
+ return estrdup(ce->name);
+ }
 
- *length = name_len;
- return name;
+ *length = name_len;
+ return name;
+ }
 #endif
+ return NULL;
 }
 
 static zval* get_symbol_contents_zval(char* name, int name_length TSRMLS_DC)
@@ -513,7 +521,7 @@
                                                         if (current_classname) {
                                                                 efree(current_classname);
                                                         }
- current_classname = NULL;
+ current_classname = fetch_classname_from_zval(retval, &cc_length TSRMLS_CC);
                                                         if (retval) {
                                                                 st = fetch_ht_from_zval(retval TSRMLS_CC);
                                                         }
@@ -2110,7 +2118,7 @@
 
 char *xdebug_dbgp_get_revision(void)
 {
- return "$Revision: 1.106 $";
+ return "$Revision: 1.107 $";
 }
 
 int xdebug_dbgp_cmdloop(xdebug_con *context TSRMLS_DC)
Received on Fri Dec 01 2006 - 20:38:26 GMT

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