com php-src: moar params for registered functions: dev/phpdbg _lexer.l phpdbg_prompt.c test.php

From: Date: Mon, 24 Feb 2014 22:30:46 +0000
Subject: com php-src: moar params for registered functions: dev/phpdbg _lexer.l phpdbg_prompt.c test.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-77032@lists.php.net to get a copy of this message
Commit: d8ed537cd4a32d00e1c7b7234619f2232d8df631 Author: krakjoe <joe.watkins@live.co.uk> Mon, 24 Feb 2014 22:30:46 +0000 Parents: 4bab2d2f90022839ffe1262e3e84c3526df4d664 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d8ed537cd4a32d00e1c7b7234619f2232d8df631 Log: moar params for registered functions Changed paths: M dev/phpdbg_lexer.l M phpdbg_prompt.c M test.php Diff: diff --git a/dev/phpdbg_lexer.l b/dev/phpdbg_lexer.l index 90f9f0c..d371e59 100644 --- a/dev/phpdbg_lexer.l +++ b/dev/phpdbg_lexer.l @@ -11,6 +11,10 @@ #include "phpdbg_parser.h" #include <stdio.h> #include <string.h> + +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]+ %% +<INITIAL>[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; +} + +<PARAMS>[0-9]+ { + phpdbg_init_param(yylval, NUMERIC_PARAM); + yylval->num = atoi(yytext); + return T_ID; +} + <INITIAL> { [#]{1} { return T_POUND; } diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 2cae1b6..31c5d25 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(&params); - while (next) { + while (next) { + char *buffered = NULL; + switch (next->type) { + case OP_PARAM: + case COND_PARAM: case STR_PARAM: add_next_index_stringl( &params, @@ -119,14 +123,41 @@ static inline int phpdbg_call_register(phpdbg_param_t *stack TSRMLS_DC) /* {{{ * add_next_index_long(&params, next->num); break; + case METHOD_PARAM: + spprintf(&buffered, 0, "%s::%s" + TSRMLS_CC, next->method.class, next->method.name); + add_next_index_string(&params, 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(&params, buffered, 0); + break; + + case NUMERIC_FUNCTION_PARAM: + spprintf(&buffered, 0, "%s#%ld" + TSRMLS_CC, next->str, next->num); + add_next_index_string(&params, buffered, 0); + break; + + case FILE_PARAM: + spprintf(&buffered, 0, "%s:%ld" + TSRMLS_CC, next->file.name, next->file.line); + add_next_index_string(&params, buffered, 0); + break; + + case NUMERIC_FILE_PARAM: + spprintf(&buffered, 0, "%s:#%ld" + TSRMLS_CC, next->file.name, next->file.line); + add_next_index_string(&params, 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 5fdbcbe..3618ce2 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;

« previous php.cvs (#77032) next »