com php-src: extend userland api phpdbg_break function: phpdbg.c

From: Date: Fri, 15 Nov 2013 15:54:14 +0000
Subject: com php-src: extend userland api phpdbg_break function: phpdbg.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74938@lists.php.net to get a copy of this message
Commit: 057f11c4cae2ead7166a60de0a989789a9edd453 Author: krakjoe <joe.watkins@live.co.uk> Fri, 15 Nov 2013 15:54:14 +0000 Parents: 38ed8d89d0e7783a3b609202e30535b6c4223526 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=057f11c4cae2ead7166a60de0a989789a9edd453 Log: extend userland api phpdbg_break function Changed paths: M phpdbg.c Diff: diff --git a/phpdbg.c b/phpdbg.c index 831fc56..915fe2d 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -54,6 +54,13 @@ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ zend_execute = phpdbg_execute_ex; #endif + REGISTER_LONG_CONSTANT("PHPDBG_EMPTY", EMPTY_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_ADDR", ADDR_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_FILE", FILE_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_METHOD", METHOD_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_NUMERIC", NUMERIC_PARAM, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT("PHPDBG_FUNC", STR_PARAM, CONST_CS|CONST_PERSISTENT); + return SUCCESS; } /* }}} */ @@ -127,11 +134,44 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */ return SUCCESS; } /* }}} */ -/* {{{ proto void phpdbg_break(void) +/* {{{ proto void phpdbg_break([string expression]) instructs phpdbg to insert a breakpoint at the next opcode */ static PHP_FUNCTION(phpdbg_break) { - if (EG(current_execute_data) && EG(active_op_array)) { + if (ZEND_NUM_ARGS() > 0) { + long type; + char *expr = NULL; + zend_uint expr_len = 0; + + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &type, &expr, &expr_len) == FAILURE) { + return; + } + + switch (type) { + case METHOD_PARAM: + phpdbg_do_break_method( + expr, expr_len TSRMLS_CC); + break; + + case FILE_PARAM: + phpdbg_do_break_file( + expr, expr_len TSRMLS_CC); + break; + + case NUMERIC_PARAM: + phpdbg_do_break_lineno( + expr, expr_len TSRMLS_CC); + break; + + case STR_PARAM: + phpdbg_do_break_func( + expr, expr_len TSRMLS_CC); + break; + + default: zend_error( + E_WARNING, "unrecognized parameter type %d", type); + } + } else if (EG(current_execute_data) && EG(active_op_array)) { zend_ulong opline_num = (EG(current_execute_data)->opline - EG(active_op_array)->opcodes);

« previous php.cvs (#74938) next »