com php-src: - Added "info vars" to show active variables: phpdbg_info.c phpdbg_info.h
| From: | Bob Weinand | Date: | Sun, 17 Nov 2013 18:43:37 +0000 |
| Subject: | com php-src: - Added "info vars" to show active variables: phpdbg_info.c phpdbg_info.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74883@lists.php.net to get a copy of this message | ||
Commit: 31f45d54578d6dd314124d68e24ae7561cf62398
Author: Felipe Pena <felipensp@gmail.com> Sun, 17 Nov 2013 16:43:37 -0200
Parents: 33098232dc27c4f22dd38d17268fd59a64b1d000
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=31f45d54578d6dd314124d68e24ae7561cf62398
Log:
- Added "info vars" to show active variables
Changed paths:
M phpdbg_info.c
M phpdbg_info.h
Diff:
diff --git a/phpdbg_info.c b/phpdbg_info.c
index c396f15..fbe4f2b 100644
--- a/phpdbg_info.c
+++ b/phpdbg_info.c
@@ -38,3 +38,44 @@ PHPDBG_INFO(files) /* {{{ */
return SUCCESS;
} /* }}} */
+
+PHPDBG_INFO(error) /* {{{ */
+{
+ return SUCCESS;
+} /* }}} */
+
+PHPDBG_INFO(vars) /* {{{ */
+{
+ HashPosition pos;
+ char *var;
+ zval **data;
+
+ if (!EG(active_symbol_table)) {
+ zend_rebuild_symbol_table(TSRMLS_C);
+
+ if (!EG(active_symbol_table)) {
+ phpdbg_error("No active symbol table!");
+ return SUCCESS;
+ }
+ }
+
+ phpdbg_notice("Variables: %d",
+ zend_hash_num_elements(EG(active_symbol_table)));
+
+ zend_hash_internal_pointer_reset_ex(EG(active_symbol_table), &pos);
+ while (zend_hash_get_current_key_ex(EG(active_symbol_table), &var,
+ NULL, NULL, 0, &pos) == HASH_KEY_IS_STRING) {
+ zend_hash_get_current_data_ex(EG(active_symbol_table), (void **)&data, &pos);
+
+ if (*var != '_') {
+ phpdbg_write("Var: %s = ", var, *data == NULL ? "NULL" : "");
+ if (data) {
+ zend_print_flat_zval_r(*data TSRMLS_CC);
+ phpdbg_writeln(EMPTY);
+ }
+ }
+ zend_hash_move_forward_ex(EG(active_symbol_table), &pos);
+ }
+
+ return SUCCESS;
+} /* }}} */
diff --git a/phpdbg_info.h b/phpdbg_info.h
index 1e967b0..1309a1c 100644
--- a/phpdbg_info.h
+++ b/phpdbg_info.h
@@ -37,9 +37,13 @@
int PHPDBG_INFO_HANDLER(name)(phpdbg_param_t *param TSRMLS_DC)
PHPDBG_INFO(files);
+PHPDBG_INFO(error);
+PHPDBG_INFO(vars);
static const phpdbg_command_t phpdbg_info_commands[] = {
- PHPDBG_INFO_EX_D(files, "lists included files", 'f'),
+ PHPDBG_INFO_EX_D(files, "lists included files", 'f'),
+ PHPDBG_INFO_EX_D(error, "show the last error", 'e'),
+ PHPDBG_INFO_EX_D(vars, "show active variables", 'v'),
PHPDBG_END_COMAND
};