diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2013-11-25 20:33:52 +0100 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2013-11-25 20:33:52 +0100 |
commit | 2be5a1e3da05caee88bc92f2abec223cc999c1f0 (patch) | |
tree | 80ef72becc6d224f3334c3e08182351e77e24d1a | |
parent | 6932eb76e3631e5e8e12e1545d152a3b8567297c (diff) | |
download | php-git-2be5a1e3da05caee88bc92f2abec223cc999c1f0.tar.gz |
Enable backwards reading in list command
-rw-r--r-- | phpdbg_list.c | 5 | ||||
-rw-r--r-- | phpdbg_prompt.c | 4 | ||||
-rw-r--r-- | phpdbg_utils.c | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/phpdbg_list.c b/phpdbg_list.c index 14ca56c1c3..05231bcf97 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -42,8 +42,9 @@ PHPDBG_LIST(lines) /* {{{ */ case NUMERIC_PARAM: case EMPTY_PARAM: phpdbg_list_file(phpdbg_current_file(TSRMLS_C), - param->type == EMPTY_PARAM ? 0 : param->num, - zend_get_executed_lineno(TSRMLS_C), 0 TSRMLS_CC); + param->type == EMPTY_PARAM ? 0 : (param->num < 0 ? 1 - param->num : param->num), + (param->type != EMPTY_PARAM && param->num < 0 ? param->num : 0) + zend_get_executed_lineno(TSRMLS_C), + 0 TSRMLS_CC); break; case FILE_PARAM: phpdbg_list_file(param->file.name, param->file.line, 0, 0 TSRMLS_CC); diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 679f52f95b..eff36f4253 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -668,6 +668,10 @@ PHPDBG_COMMAND(back) /* {{{ */ zval **file, **line, **funcname, **class, **type, **args; char is_class; + if (limit < 0) { + phpdbg_error("Invalid backtrace size %d", limit); + } + zend_fetch_debug_backtrace( &zbacktrace, 0, 0, limit TSRMLS_CC); diff --git a/phpdbg_utils.c b/phpdbg_utils.c index 2c73f9b55b..5a922e8e53 100644 --- a/phpdbg_utils.c +++ b/phpdbg_utils.c @@ -69,7 +69,7 @@ PHPDBG_API int phpdbg_is_numeric(const char *str) /* {{{ */ return 0; for (; *str; str++) { - if (isspace(*str)) { + if (isspace(*str) || *str == '-') { continue; } return isdigit(*str); |