mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
- Implemented "break N" where N is the line number on the current file
This commit is contained in:
parent
7f743e1fca
commit
ffad3fa211
3 changed files with 68 additions and 50 deletions
|
@ -382,22 +382,34 @@ static PHPDBG_COMMAND(break) /* {{{ */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (expr_len > 2 && expr[0] == '0' && expr[1] == 'x') {
|
if (phpdbg_is_addr(expr)) {
|
||||||
phpdbg_set_breakpoint_opline(expr TSRMLS_CC);
|
phpdbg_set_breakpoint_opline(expr TSRMLS_CC);
|
||||||
|
} else if (phpdbg_is_numeric(expr)) {
|
||||||
|
const char *filename = zend_get_executed_filename(TSRMLS_C);
|
||||||
|
long line_num = strtol(expr, NULL, 0);
|
||||||
|
|
||||||
|
if (!filename) {
|
||||||
|
printf("%sNo file context found%s\n",
|
||||||
|
PHPDBG_RED_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
|
||||||
|
return FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
|
phpdbg_set_breakpoint_file(filename, line_num TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
char name[200];
|
char name[200];
|
||||||
size_t name_len = strlen(expr);
|
size_t name_len = strlen(expr);
|
||||||
|
|
||||||
if (name_len) {
|
if (name_len) {
|
||||||
name_len = MIN(name_len, 200);
|
name_len = MIN(name_len, 200);
|
||||||
memcpy(name, expr, name_len);
|
memcpy(name, expr, name_len);
|
||||||
name[name_len] = 0;
|
name[name_len] = 0;
|
||||||
|
|
||||||
phpdbg_set_breakpoint_symbol(name TSRMLS_CC);
|
phpdbg_set_breakpoint_symbol(name TSRMLS_CC);
|
||||||
} else {
|
} else {
|
||||||
printf("%sMalformed break command found%s\n", PHPDBG_RED_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
|
printf("%sMalformed break command found%s\n",
|
||||||
return FAILURE;
|
PHPDBG_RED_LINE(TSRMLS_C), PHPDBG_END_LINE(TSRMLS_C));
|
||||||
}
|
return FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,3 +41,8 @@ int phpdbg_is_empty(const char *str) /* {{{ */
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
int phpdbg_is_addr(const char *str) /* {{{ */
|
||||||
|
{
|
||||||
|
return str[0] && str[1] && memcmp(str, "0x", 2) == 0;
|
||||||
|
} /* }}} */
|
||||||
|
|
|
@ -22,5 +22,6 @@
|
||||||
|
|
||||||
int phpdbg_is_numeric(const char*);
|
int phpdbg_is_numeric(const char*);
|
||||||
int phpdbg_is_empty(const char*);
|
int phpdbg_is_empty(const char*);
|
||||||
|
int phpdbg_is_addr(const char*);
|
||||||
|
|
||||||
#endif /* PHPDBG_UTILS_H */
|
#endif /* PHPDBG_UTILS_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue