From: krakjoe Date: Tue, 12 Nov 2013 02:35:07 +0000 (+0000) Subject: Merge branch 'master' of https://github.com/krakjoe/phpdbg X-Git-Tag: php-5.6.0alpha1~110^2~456 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c91727484c6ed6af80fbe13f9076958450fe19b;p=php Merge branch 'master' of https://github.com/krakjoe/phpdbg --- 8c91727484c6ed6af80fbe13f9076958450fe19b diff --cc phpdbg_list.c index f4209e1219,d5e07d49df..3bfa214162 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@@ -74,3 -73,17 +74,17 @@@ void phpdbg_list_file(const char *filen out: close(fd); } /* }}} */ + -void phpdbg_list_function(const zend_function *fbc) /* {{{ */ ++void phpdbg_list_function(const zend_function *fbc TSRMLS_DC) /* {{{ */ + { + const zend_op_array *ops; + + if (fbc->type != ZEND_USER_FUNCTION) { + return; + } + + ops = (zend_op_array*)fbc; + + phpdbg_list_file(ops->filename, - ops->line_end - ops->line_start + 1, ops->line_start); ++ ops->line_end - ops->line_start + 1, ops->line_start TSRMLS_CC); + } /* }}} */ diff --cc phpdbg_list.h index 883f9917f1,95cc06e93a..2a2587504a --- a/phpdbg_list.h +++ b/phpdbg_list.h @@@ -20,6 -20,9 +20,7 @@@ #ifndef PHPDBG_LIST_H #define PHPDBG_LIST_H -#include "zend_compile.h" - -void phpdbg_list_file(const char*, long, long); -void phpdbg_list_function(const zend_function*); ++void phpdbg_list_function(const zend_function* TSRMLS_DC); +void phpdbg_list_file(const char*, long, long TSRMLS_DC); #endif /* PHPDBG_LIST_H */ diff --cc phpdbg_prompt.c index c30d15589b,f7ec9419b8..11cc9146dc --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@@ -497,18 -498,32 +498,32 @@@ static PHPDBG_COMMAND(quiet) { /* {{{ * static PHPDBG_COMMAND(list) /* {{{ */ { - long offset = 0, count = strtol(expr, NULL, 0); - const char *filename = PHPDBG_G(exec); - - if (zend_is_executing(TSRMLS_C)) { - filename = zend_get_executed_filename(TSRMLS_C); - offset = zend_get_executed_lineno(TSRMLS_C); - } else if (!filename) { - printf("[No file to list]\n"); - return SUCCESS; - } + if (phpdbg_is_numeric(expr)) { + long offset = 0, count = strtol(expr, NULL, 0); + const char *filename = PHPDBG_G(exec); + + if (zend_is_executing(TSRMLS_C)) { + filename = zend_get_executed_filename(TSRMLS_C); + offset = zend_get_executed_lineno(TSRMLS_C); + } else if (!filename) { + printf("[No file to list]\n"); + return SUCCESS; + } - phpdbg_list_file(filename, count, offset TSRMLS_CC); - phpdbg_list_file(filename, count, offset); ++ phpdbg_list_file(filename, count, offset TSRMLS_CC); + } else { + zend_function* fbc; + + if (!EG(function_table)) { + printf("[No function table loaded]\n"); + return SUCCESS; + } + + if (zend_hash_find(EG(function_table), expr, strlen(expr)+1, + (void**)&fbc) == SUCCESS) { - phpdbg_list_function(fbc); ++ phpdbg_list_function(fbc TSRMLS_CC); + } + } return SUCCESS; } /* }}} */