Skip to content

Commit

Permalink
- Added xdebug.collect_params setting. If this setting is on (the def…
Browse files Browse the repository at this point in the history
…ault)

  then Xdebug collects all parameters passed to functions, otherwise they
  are not collected at all.

SVN Rev: 345
  • Loading branch information
derickr committed Oct 28, 2002
1 parent fc57992 commit f2394ea
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
? - xdebug 1.1.0

+ Added xdebug.collect_params setting. If this setting is on (the default)
then Xdebug collects all parameters passed to functions, otherwise they
are not collected at all. (Derick)
+ Implemented correct handling of include/require and eval. (Derick)


Expand Down
1 change: 1 addition & 0 deletions php_xdebug.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ ZEND_BEGIN_MODULE_GLOBALS(xdebug)
xdebug_llist *trace;
int max_nesting_level;
zend_bool default_enable;
zend_bool collect_params;
zend_bool auto_trace;
zend_bool do_trace;
char *manual_url;
Expand Down
1 change: 1 addition & 0 deletions tests/.cvsignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
*.log
*.out
*.exp
*.php
*.swp
27 changes: 27 additions & 0 deletions tests/memory_usage.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--TEST--
Test for xdebug.collect_params setting
--INI--
xdebug.enable=1
xdebug.auto_trace=1
xdebug.collect_params=0
--FILE--
<?php
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));
$param[] = array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, array (1, 2))))))))))));

function foo ($a, $b, $c, $d, $e, $f) {
}

echo "Alive!\n";
for ($i = 0; $i < 10000; $i++) {
foo ($param, $param, $param, $param, $param, $param, $param, $param, $param, $param, $param, $param, $param, $param, $param, $param);
}
echo "Alive!\n";
?>
18 changes: 10 additions & 8 deletions xdebug.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ static PHP_INI_MH(OnUpdateDebugMode)
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("xdebug.max_nesting_level", "64", PHP_INI_SYSTEM, OnUpdateInt, max_nesting_level, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_BOOLEAN("xdebug.default_enable", "1", PHP_INI_SYSTEM, OnUpdateBool, default_enable, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_BOOLEAN("xdebug.collect_params", "1", PHP_INI_SYSTEM, OnUpdateBool, collect_params, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_BOOLEAN("xdebug.auto_trace", "0", PHP_INI_SYSTEM, OnUpdateBool, auto_trace, zend_xdebug_globals, xdebug_globals)
STD_PHP_INI_ENTRY("xdebug.manual_url", "http://www.php.net", PHP_INI_SYSTEM, OnUpdateString, manual_url, zend_xdebug_globals, xdebug_globals)

Expand Down Expand Up @@ -427,16 +428,17 @@ static struct function_stack_entry *add_stack_frame(zend_execute_data *zdata, ze
} else {
cur_opcode = *EG(opline_ptr);
tmp->lineno = cur_opcode->lineno;
for (i = 0; i < arg_count; i++) {
tmp->vars[tmp->varc].name = NULL;
if (zend_ptr_stack_get_arg(tmp->varc + 1, (void**) &param TSRMLS_CC) == SUCCESS) {
tmp->vars[tmp->varc].value = get_zval_value(*param);
} else {
tmp->vars[tmp->varc].value = xdstrdup ("{missing}");
if (XG(collect_params)) {
for (i = 0; i < arg_count; i++) {
tmp->vars[tmp->varc].name = NULL;
if (zend_ptr_stack_get_arg(tmp->varc + 1, (void**) &param TSRMLS_CC) == SUCCESS) {
tmp->vars[tmp->varc].value = get_zval_value(*param);
} else {
tmp->vars[tmp->varc].value = xdstrdup ("{missing}");
}
tmp->varc++;
}
tmp->varc++;
}

}
xdebug_llist_insert_next (XG(stack), XDEBUG_LLIST_TAIL(XG(stack)), tmp);

Expand Down

0 comments on commit f2394ea

Please sign in to comment.