zend_activate_modules(TSRMLS_C);
} zend_end_try();
- zend_try {
- do {
- phpdbg_interactive(argc, argv TSRMLS_CC);
- } while(!PHPDBG_G(quitting));
- } zend_end_try();
-
+ do {
+ zend_try {
+ phpdbg_interactive(argc, argv TSRMLS_CC);
+ } zend_catch {
+
+ } zend_end_try();
+ } while(!PHPDBG_G(quitting));
+
if (ini_entries) {
free(ini_entries);
}
return SUCCESS;
} /* }}} */
+PHPDBG_HELP(clean) /* {{{ */
+{
+ printf("While debugging you may experience errors because of attempts to redeclare classes, constants or functions.\n");
+ printf("Cleaning the environment cleans these tables, so that files can be recompiled without exiting phpdbg.\n");
+ return SUCCESS;
+} /* }}} */
+
PHPDBG_HELP(quiet) /* {{{ */
{
printf("Setting quietness on will stop the OPLINE output during execution\n");
PHPDBG_HELP(eval);
PHPDBG_HELP(print);
PHPDBG_HELP(break);
+PHPDBG_HELP(clean);
PHPDBG_HELP(back);
PHPDBG_HELP(quiet);
PHPDBG_HELP_D(eval, "access to eval() allows you to affect the environment during execution"),
PHPDBG_HELP_D(print, "printing allows inspection of the execution environment"),
PHPDBG_HELP_D(break, "breakpoints allow execution interruption"),
+ PHPDBG_HELP_D(clean, "resetting the environment is useful while debugging and recompiling"),
PHPDBG_HELP_D(back, "show debug backtrace information during execution"),
PHPDBG_HELP_D(quiet, "be quiet during execution"),
{NULL, 0, 0}
return SUCCESS;
} /* }}} */
+static int clean_non_persistent_constant_full(const zend_constant *c TSRMLS_DC) /* {{{ */
+{
+ return (c->flags & CONST_PERSISTENT) ? 0 : 1;
+} /* }}} */
+
+static int clean_non_persistent_class_full(zend_class_entry **ce TSRMLS_DC) /* {{{ */
+{
+ return ((*ce)->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
+} /* }}} */
+
+static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC) /* {{{ */
+{
+ return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE;
+} /* }}} */
+
+static PHPDBG_COMMAND(clean) /* {{{ */
+{
+ zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
+ zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class_full TSRMLS_CC);
+ zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant_full TSRMLS_CC);
+ zend_hash_destroy(&EG(included_files));
+ return SUCCESS;
+} /* }}} */
+
static PHPDBG_COMMAND(help) /* {{{ */
{
printf("Welcome to phpdbg, the interactive PHP debugger.\n");
PHPDBG_COMMAND_D(print, "print something"),
PHPDBG_COMMAND_D(break, "set breakpoint"),
PHPDBG_COMMAND_D(back, "show backtrace"),
+ PHPDBG_COMMAND_D(clean, "clean the execution environment"),
PHPDBG_COMMAND_D(help, "show help menu"),
PHPDBG_COMMAND_D(quiet, "silence some output"),
PHPDBG_COMMAND_D(quit, "exit phpdbg"),