mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Merge branch 'master' of github.com:krakjoe/phpdbg
This commit is contained in:
commit
723c671750
5 changed files with 61 additions and 38 deletions
5
phpdbg.c
5
phpdbg.c
|
@ -601,6 +601,11 @@ phpdbg_main:
|
|||
/* print blurb */
|
||||
phpdbg_welcome((cleaning > 0) TSRMLS_CC);
|
||||
|
||||
zend_try {
|
||||
/* activate globals, they can be overwritten */
|
||||
zend_activate_auto_globals(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
/* initialize from file */
|
||||
zend_try {
|
||||
phpdbg_init(init_file, init_file_len, init_file_default TSRMLS_CC);
|
||||
|
|
2
phpdbg.h
2
phpdbg.h
|
@ -96,6 +96,8 @@
|
|||
#define PHPDBG_IN_LEAVE (1<<15)
|
||||
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
|
||||
|
||||
#define PHPDBG_IS_REGISTERED (1<<16)
|
||||
|
||||
#ifndef _WIN32
|
||||
# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED)
|
||||
#else
|
||||
|
|
20
phpdbg_cmd.c
20
phpdbg_cmd.c
|
@ -99,6 +99,7 @@ parsed:
|
|||
|
||||
void phpdbg_clear_param(phpdbg_param_t *param TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
if (param) {
|
||||
switch (param->type) {
|
||||
case FILE_PARAM:
|
||||
efree(param->file.name);
|
||||
|
@ -113,6 +114,8 @@ void phpdbg_clear_param(phpdbg_param_t *param TSRMLS_DC) /* {{{ */
|
|||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} /* }}} */
|
||||
|
||||
int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_len TSRMLS_DC) /* {{{ */
|
||||
|
@ -129,20 +132,13 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
|
|||
while (command && command->name && command->handler) {
|
||||
if ((command->name_len == expr_len && memcmp(cmd, command->name, expr_len) == 0)
|
||||
|| (expr_len == 1 && command->alias && command->alias == cmd_line[0])) {
|
||||
|
||||
phpdbg_param_t lparam,
|
||||
param;
|
||||
phpdbg_param_t param = {0};
|
||||
|
||||
phpdbg_parse_param(
|
||||
expr,
|
||||
(cmd_len - expr_len) ? (((cmd_len - expr_len) - sizeof(" "))+1) : 0,
|
||||
¶m TSRMLS_CC);
|
||||
|
||||
lparam = PHPDBG_G(lparam);
|
||||
|
||||
PHPDBG_G(lparam) = param;
|
||||
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
|
||||
|
||||
if (command->subs && param.type == STR_PARAM) {
|
||||
if (phpdbg_do_cmd(command->subs, param.str, param.len TSRMLS_CC) == SUCCESS) {
|
||||
rc = SUCCESS;
|
||||
|
@ -157,10 +153,12 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le
|
|||
phpdbg_error("This command does not expect argument!");
|
||||
rc = FAILURE;
|
||||
} else {
|
||||
rc = command->handler(¶m TSRMLS_CC);
|
||||
}
|
||||
rc = command->handler(
|
||||
¶m TSRMLS_CC);
|
||||
|
||||
phpdbg_clear_param(&lparam TSRMLS_CC);
|
||||
PHPDBG_G(lcmd) = (phpdbg_command_t*) command;
|
||||
PHPDBG_G(lparam) = param;
|
||||
}
|
||||
break;
|
||||
}
|
||||
++command;
|
||||
|
|
|
@ -52,9 +52,10 @@ PHPDBG_INFO(error) /* {{{ */
|
|||
|
||||
PHPDBG_INFO(vars) /* {{{ */
|
||||
{
|
||||
HashTable vars;
|
||||
HashPosition pos;
|
||||
char *var;
|
||||
zval **data;
|
||||
zval **data, *zdata;
|
||||
|
||||
if (!EG(active_symbol_table)) {
|
||||
zend_rebuild_symbol_table(TSRMLS_C);
|
||||
|
@ -65,23 +66,45 @@ PHPDBG_INFO(vars) /* {{{ */
|
|||
}
|
||||
}
|
||||
|
||||
phpdbg_notice("Variables");
|
||||
zend_hash_init(&vars, 8, NULL, NULL, 0);
|
||||
|
||||
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_update(
|
||||
&vars, var, strlen(var)+1, (void**)data, sizeof(zval*), NULL);
|
||||
}
|
||||
zend_hash_move_forward_ex(EG(active_symbol_table), &pos);
|
||||
}
|
||||
|
||||
phpdbg_notice("Variables: %d",
|
||||
zend_hash_num_elements(&vars));
|
||||
phpdbg_writeln("Refs\tName");
|
||||
|
||||
for (zend_hash_internal_pointer_reset_ex(&vars, &pos);
|
||||
zend_hash_get_current_data_ex(&vars, (void**) &data, &pos) == SUCCESS;
|
||||
zend_hash_move_forward_ex(&vars, &pos)) {
|
||||
char *var;
|
||||
|
||||
zend_hash_get_current_key_ex(&vars, &var, NULL, NULL, 0, &pos);
|
||||
|
||||
if (*data) {
|
||||
phpdbg_write(
|
||||
"%d\t%s$%s\t\t",
|
||||
Z_REFCOUNT_PP(data),
|
||||
Z_ISREF_PP(data) ? "&" : "", var);
|
||||
|
||||
zend_print_flat_zval_r(*data TSRMLS_CC);
|
||||
} else {
|
||||
phpdbg_write("0\t$%s", var);
|
||||
}
|
||||
phpdbg_writeln(EMPTY);
|
||||
}
|
||||
|
||||
zend_hash_destroy(&vars);
|
||||
|
||||
return SUCCESS;
|
||||
} /* }}} */
|
||||
|
||||
|
|
|
@ -464,11 +464,6 @@ static PHPDBG_COMMAND(run) /* {{{ */
|
|||
zend_rebuild_symbol_table(TSRMLS_C);
|
||||
}
|
||||
|
||||
zend_try {
|
||||
/* last chance ... */
|
||||
zend_activate_auto_globals(TSRMLS_C);
|
||||
} zend_end_try();
|
||||
|
||||
/* clean seek state */
|
||||
PHPDBG_G(flags) &= ~PHPDBG_SEEK_MASK;
|
||||
zend_hash_clean(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue