summaryrefslogtreecommitdiff
path: root/sapi/phpdbg/phpdbg.c
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2014-10-26 07:24:35 +0000
committerBob Weinand <bobwei9@hotmail.com>2014-10-27 00:00:14 +0100
commit41537cdddc71a6e499f1c7c118bf862105ff95fa (patch)
tree5d16f658461d73ec3d4d4dcb02977b6dc1e01238 /sapi/phpdbg/phpdbg.c
parent51c1cc4ff5a1ae1606d07de79db07d9d826378cf (diff)
downloadphp-git-41537cdddc71a6e499f1c7c118bf862105ff95fa.tar.gz
remove dodgy param parser, bring userland breakpoint api inline with PHP7
Diffstat (limited to 'sapi/phpdbg/phpdbg.c')
-rw-r--r--sapi/phpdbg/phpdbg.c85
1 files changed, 65 insertions, 20 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index f8879d77ab..493d8ec20c 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -301,24 +301,12 @@ static PHP_FUNCTION(phpdbg_exec)
}
} /* }}} */
-/* {{{ proto void phpdbg_break([integer type, string expression])
+/* {{{ proto void phpdbg_break_next()
instructs phpdbg to insert a breakpoint at the next opcode */
-static PHP_FUNCTION(phpdbg_break)
+static PHP_FUNCTION(phpdbg_break_next)
{
- if (ZEND_NUM_ARGS() > 0) {
- long type = 0;
- char *expr = NULL;
- int expr_len = 0;
- phpdbg_param_t param;
-
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type, &expr, &expr_len) == FAILURE) {
- return;
- }
-
- phpdbg_parse_param(expr, expr_len, &param TSRMLS_CC);
- phpdbg_do_break(&param TSRMLS_CC);
- phpdbg_clear_param(&param TSRMLS_CC);
-
+ if (zend_parse_parameters_none() != SUCCESS) {
+ return;
} else if (EG(current_execute_data) && EG(active_op_array)) {
zend_ulong opline_num = (EG(current_execute_data)->opline -
EG(active_op_array)->opcodes);
@@ -328,6 +316,48 @@ static PHP_FUNCTION(phpdbg_break)
}
} /* }}} */
+/* {{{ proto void phpdbg_break_file(string file, integer line) */
+static PHP_FUNCTION(phpdbg_break_file)
+{
+ char *file = NULL;
+ int flen = 0;
+ long line;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &file, &flen, &line) == FAILURE) {
+ return;
+ }
+
+ phpdbg_set_breakpoint_file(file, line TSRMLS_CC);
+} /* }}} */
+
+/* {{{ proto void phpdbg_break_method(string class, string method) */
+static PHP_FUNCTION(phpdbg_break_method)
+{
+ char *class = NULL,
+ *method = NULL;
+ int clen = 0,
+ mlen = 0;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss", &class, &clen, &method, &mlen) == FAILURE) {
+ return;
+ }
+
+ phpdbg_set_breakpoint_method(class, method TSRMLS_CC);
+} /* }}} */
+
+/* {{{ proto void phpdbg_break_function(string function) */
+static PHP_FUNCTION(phpdbg_break_function)
+{
+ char *function = NULL;
+ int function_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &function, &function_len) == FAILURE) {
+ return;
+ }
+
+ phpdbg_set_breakpoint_symbol(function, function_len TSRMLS_CC);
+} /* }}} */
+
/* {{{ proto void phpdbg_clear(void)
instructs phpdbg to clear breakpoints */
static PHP_FUNCTION(phpdbg_clear)
@@ -377,9 +407,21 @@ static PHP_FUNCTION(phpdbg_prompt)
phpdbg_set_prompt(prompt TSRMLS_CC);
} /* }}} */
-ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_arginfo, 0, 0, 0)
- ZEND_ARG_INFO(0, type)
- ZEND_ARG_INFO(0, expression)
+ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_next_arginfo, 0, 0, 0)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_file_arginfo, 0, 0, 2)
+ ZEND_ARG_INFO(0, file)
+ ZEND_ARG_INFO(0, line)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_method_arginfo, 0, 0, 2)
+ ZEND_ARG_INFO(0, class)
+ ZEND_ARG_INFO(0, method)
+ZEND_END_ARG_INFO()
+
+ZEND_BEGIN_ARG_INFO_EX(phpdbg_break_function_arginfo, 0, 0, 1)
+ ZEND_ARG_INFO(0, function)
ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO_EX(phpdbg_color_arginfo, 0, 0, 0)
@@ -400,7 +442,10 @@ ZEND_END_ARG_INFO()
zend_function_entry phpdbg_user_functions[] = {
PHP_FE(phpdbg_clear, phpdbg_clear_arginfo)
- PHP_FE(phpdbg_break, phpdbg_break_arginfo)
+ PHP_FE(phpdbg_break_next, phpdbg_break_next_arginfo)
+ PHP_FE(phpdbg_break_file, phpdbg_break_file_arginfo)
+ PHP_FE(phpdbg_break_method, phpdbg_break_method_arginfo)
+ PHP_FE(phpdbg_break_function, phpdbg_break_function_arginfo)
PHP_FE(phpdbg_exec, phpdbg_exec_arginfo)
PHP_FE(phpdbg_color, phpdbg_color_arginfo)
PHP_FE(phpdbg_prompt, phpdbg_prompt_arginfo)