com php-src: Enable backwards reading in list command: phpdbg_list.c phpdbg_prompt.c phpdbg_utils.c
| From: | Bob Weinand | Date: | Mon, 25 Nov 2013 19:33:52 +0000 |
| Subject: | com php-src: Enable backwards reading in list command: phpdbg_list.c phpdbg_prompt.c phpdbg_utils.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74588@lists.php.net to get a copy of this message | ||
Commit: 2be5a1e3da05caee88bc92f2abec223cc999c1f0
Author: Bob Weinand <bobwei9@hotmail.com> Mon, 25 Nov 2013 20:33:52 +0100
Parents: 6932eb76e3631e5e8e12e1545d152a3b8567297c
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2be5a1e3da05caee88bc92f2abec223cc999c1f0
Log:
Enable backwards reading in list command
Changed paths:
M phpdbg_list.c
M phpdbg_prompt.c
M phpdbg_utils.c
Diff:
diff --git a/phpdbg_list.c b/phpdbg_list.c
index 14ca56c..05231bc 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 679f52f..eff36f4 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 2c73f9b..5a922e8 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);