From: krakjoe Date: Mon, 24 Feb 2014 22:30:46 +0000 (+0000) Subject: moar params for registered functions X-Git-Tag: php-5.6.0beta2~1^2~37^2~20^2~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d8ed537cd4a32d00e1c7b7234619f2232d8df631;p=php moar params for registered functions --- diff --git a/dev/phpdbg_lexer.l b/dev/phpdbg_lexer.l index 90f9f0c63a..d371e59c59 100644 --- a/dev/phpdbg_lexer.l +++ b/dev/phpdbg_lexer.l @@ -11,6 +11,10 @@ #include "phpdbg_parser.h" #include #include + +static inline int phpdbg_needs_params(phpdbg_param_t *param TSRMLS_DC) { + return 0; +} %} %s RAW @@ -40,6 +44,22 @@ ADDR 0x[a-fA-F0-9]+ OPCODE ?i:ZEND_([A-Za-z])+ INPUT [^\n]+ %% +[a-zA-Z]+ { + phpdbg_init_param(yylval, STR_PARAM); + yylval->str = strndup(yytext, yyleng); + yylval->len = yyleng; + if (phpdbg_needs_params(yylval TSRMLS_CC)) { + BEGIN(PARAMS); + } + return T_ID; +} + +[0-9]+ { + phpdbg_init_param(yylval, NUMERIC_PARAM); + yylval->num = atoi(yytext); + return T_ID; +} + { [#]{1} { return T_POUND; } diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 2cae1b6aa9..31c5d25122 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -106,8 +106,12 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ * array_init(¶ms); - while (next) { + while (next) { + char *buffered = NULL; + switch (next->type) { + case OP_PARAM: + case COND_PARAM: case STR_PARAM: add_next_index_stringl( ¶ms, @@ -119,14 +123,41 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ * add_next_index_long(¶ms, next->num); break; + case METHOD_PARAM: + spprintf(&buffered, 0, "%s::%s" + TSRMLS_CC, next->method.class, next->method.name); + add_next_index_string(¶ms, buffered, 0); + break; + + case NUMERIC_METHOD_PARAM: + spprintf(&buffered, 0, "%s::%s#%ld" + TSRMLS_CC, next->method.class, next->method.name, next->num); + add_next_index_string(¶ms, buffered, 0); + break; + + case NUMERIC_FUNCTION_PARAM: + spprintf(&buffered, 0, "%s#%ld" + TSRMLS_CC, next->str, next->num); + add_next_index_string(¶ms, buffered, 0); + break; + + case FILE_PARAM: + spprintf(&buffered, 0, "%s:%ld" + TSRMLS_CC, next->file.name, next->file.line); + add_next_index_string(¶ms, buffered, 0); + break; + + case NUMERIC_FILE_PARAM: + spprintf(&buffered, 0, "%s:#%ld" + TSRMLS_CC, next->file.name, next->file.line); + add_next_index_string(¶ms, buffered, 0); + break; + default: { /* not yet */ } } - phpdbg_debug( - "created param[%d] from argv[%d]: %s", - param, param+1, next->str); next = next->next; } diff --git a/test.php b/test.php index 5fdbcbe1a4..3618ce2391 100644 --- a/test.php +++ b/test.php @@ -13,6 +13,10 @@ class phpdbg { } } +function mine() { + var_dump(func_get_args()); +} + function test($x, $y = 0) { $var = $x + 1; $var += 2;