1
0
mirror of https://github.com/php/php-src.git synced 2026-03-31 12:42:29 +02:00

backtrace

This commit is contained in:
krakjoe
2013-11-10 15:49:35 +00:00
parent 48f9db90dd
commit 940f4e27de

View File

@@ -142,12 +142,28 @@ static PHPDBG_COMMAND(eval) { /* {{{ */
static PHPDBG_COMMAND(back) { /* {{{ */
if (EG(in_execution)) {
const zend_execute_data *current = EG(current_execute_data);
if (current) {
do {
printf("%d\n", current->opline->opcode);
} while ((current = current->prev_execute_data));
zval zbacktrace;
zval **tmp;
HashPosition position;
int i = 0;
int limit = (expr != NULL) ? atoi(expr) : 0;
zend_fetch_debug_backtrace(
&zbacktrace, 0, 0, limit TSRMLS_CC);
for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL(zbacktrace), &position);
zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), (void**)&tmp, &position) == SUCCESS;
zend_hash_move_forward_ex(Z_ARRVAL(zbacktrace), &position)) {
if (i++) {
printf(",\n");
}
zend_print_flat_zval_r(*tmp TSRMLS_CC);
}
printf("\n");
zval_dtor(&zbacktrace);
return SUCCESS;
} else {
printf("Not executing !\n");