From: krakjoe Date: Wed, 19 Feb 2014 20:18:49 +0000 (+0000) Subject: work on lexer to be more permissive (accept moar strings) X-Git-Tag: php-5.6.0beta2~1^2~37^2~20^2~28 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e2fcc870e34510dc4cc47ad69d77b28ae9eb21df;p=php work on lexer to be more permissive (accept moar strings) work on parameter parsing and command resolution work on error reporting for failed arguments update most commands move quiet to set quiet move set break on/off to set breaks on/off keep set break for set break update help accordingly --- diff --git a/dev/phpdbg_lexer.l b/dev/phpdbg_lexer.l index 46137d6676..e20f9dcc93 100644 --- a/dev/phpdbg_lexer.l +++ b/dev/phpdbg_lexer.l @@ -33,16 +33,16 @@ C_EVAL ?i:"eval" C_SHELL ?i:"shell" C_IF ?i:"if" -DIGITS [0-9]+ -ID [a-zA-Z_\x7f-\xff\-][a-zA-Z0-9_\x7f-\xff\-\./]* +WS [ \r\n\t]+ +DIGITS [0-9\.]+ +ID [^ \r\n\t]+ NSID [\\\\]?{ID} METHOD {NSID}+::{ID} NUMERIC_METHOD {METHOD}[#]{DIGITS} NUMERIC_FUNCTION {NSID}[#]{DIGITS} -FILE [^ :]+:[0-9]+ +FILE [^ :\r\n\t]+:[0-9]+ OPLINE 0x[a-fA-F0-9]+ LITERAL \"(\\.|[^\\"])*\" -WS [ \r\n\t]+ INPUT [^\n]+ %% @@ -129,8 +129,4 @@ INPUT [^\n]+ return T_INPUT; } {WS} { /* ignore whitespace */ } -. { - phpdbg_init_param(yylval, EMPTY_PARAM); - return T_UNEXPECTED; -} %% diff --git a/phpdbg_break.c b/phpdbg_break.c index aeaf5973f0..fdf4e198b5 100644 --- a/phpdbg_break.c +++ b/phpdbg_break.c @@ -24,22 +24,26 @@ #include "phpdbg_opcode.h" #include "phpdbg_break.h" #include "phpdbg_bp.h" +#include "phpdbg_prompt.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +#define PHPDBG_BREAK_COMMAND_D(f, h, a, m, l, s) \ + PHPDBG_COMMAND_D_EXP(f, h, a, m, l, s, &phpdbg_prompt_commands[10]) + /** * Commands */ const phpdbg_command_t phpdbg_break_commands[] = { - PHPDBG_COMMAND_D_EX(file, "specify breakpoint by file:line", 'F', break_file, NULL, "f"), - PHPDBG_COMMAND_D_EX(func, "specify breakpoint by global function name", 'f', break_func, NULL, "s"), - PHPDBG_COMMAND_D_EX(method, "specify breakpoint by class::method", 'm', break_method, NULL, "m"), - PHPDBG_COMMAND_D_EX(address, "specify breakpoint by address", 'a', break_address, NULL, "a"), - PHPDBG_COMMAND_D_EX(op, "specify breakpoint by opcode", 'O', break_op, NULL, "s"), - PHPDBG_COMMAND_D_EX(on, "specify breakpoint by condition", 'o', break_on, NULL, "c"), - PHPDBG_COMMAND_D_EX(at, "specify breakpoint by location and condition", 'A', break_at, NULL, "*c"), - PHPDBG_COMMAND_D_EX(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "n"), - PHPDBG_COMMAND_D_EX(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "n"), + PHPDBG_BREAK_COMMAND_D(file, "specify breakpoint by file:line", 'F', break_file, NULL, "f"), + PHPDBG_BREAK_COMMAND_D(func, "specify breakpoint by global function name", 'f', break_func, NULL, "s"), + PHPDBG_BREAK_COMMAND_D(method, "specify breakpoint by class::method", 'm', break_method, NULL, "m"), + PHPDBG_BREAK_COMMAND_D(address, "specify breakpoint by address", 'a', break_address, NULL, "a"), + PHPDBG_BREAK_COMMAND_D(op, "specify breakpoint by opcode", 'O', break_op, NULL, "s"), + PHPDBG_BREAK_COMMAND_D(on, "specify breakpoint by condition", 'o', break_on, NULL, "c"), + PHPDBG_BREAK_COMMAND_D(at, "specify breakpoint by location and condition", 'A', break_at, NULL, "*c"), + PHPDBG_BREAK_COMMAND_D(lineno, "specify breakpoint by line of currently executing file", 'l', break_lineno, NULL, "n"), + PHPDBG_BREAK_COMMAND_D(del, "delete breakpoint by identifier number", 'd', break_del, NULL, "n"), PHPDBG_END_COMMAND }; diff --git a/phpdbg_cmd.c b/phpdbg_cmd.c index b678d393ab..4e6ef048b8 100644 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@ -26,6 +26,23 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +static inline const char *phpdbg_command_name(const phpdbg_command_t *command, char *buffer) { + size_t pos = 0; + + if (command->parent) { + memcpy(&buffer[pos], command->parent->name, command->parent->name_len); + pos += command->parent->name_len; + memcpy(&buffer[pos], " ", sizeof(" ")-1); + pos += (sizeof(" ")-1); + } + + memcpy(&buffer[pos], command->name, command->name_len); + pos += command->name_len; + buffer[pos] = 0; + + return buffer; +} + PHPDBG_API const char *phpdbg_get_param_type(const phpdbg_param_t *param TSRMLS_DC) /* {{{ */ { switch (param->type) { @@ -493,115 +510,87 @@ PHPDBG_API void phpdbg_stack_push(phpdbg_param_t *stack, phpdbg_param_t *param) PHPDBG_API int phpdbg_stack_verify(const phpdbg_command_t *command, phpdbg_param_t **stack, char **why TSRMLS_DC) { if (command && command->args) { + char buffer[128] = {0,}; const phpdbg_param_t *top = (stack != NULL) ? *stack : NULL; const char *arg = command->args; - size_t expected = strlen(command->args), - received = 0L; + size_t least = 0L, + received = 0L, + current = 0L; zend_bool optional = 0; - if (*arg == '|') { - expected--; - optional = 1; + /* check for arg spec */ + if (!(arg) || !(*arg)) + return SUCCESS; + + least = 0L; + + /* count least amount of arguments */ + while (arg && *arg) { + if (arg[0] == '|') { + break; + } + least++; arg++; } - if (arg && !top && !optional) { - asprintf(why, - "%s expected arguments and received none", command->name); - return FAILURE; - } - - while (top && arg) { + arg = command->args; + +#define verify_arg(e, a, t) if (!(a)) { \ + if (!optional) { \ + asprintf(why, \ + "%s expected %s and got nothing at parameter %lu", \ + phpdbg_command_name(command, buffer), \ + (e), \ + current); \ + return FAILURE;\ + } \ +} else if ((a)->type != (t)) { \ + asprintf(why, \ + "%s expected %s and got %s at parameter %lu", \ + phpdbg_command_name(command, buffer), \ + (e),\ + phpdbg_get_param_type((a) TSRMLS_CC), \ + current); \ + return FAILURE; \ +} + while (arg) { + current++; + switch (*arg) { - case '|': { - expected--; + case '|': { + current--; optional = 1; arg++; } continue; - case 'i': if (top->type != STR_PARAM) { - asprintf(why, - "%s expected raw input and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 's': if (top->type != STR_PARAM) { - asprintf(why, - "%s expected string and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 'n': if (top->type != NUMERIC_PARAM) { - asprintf(why, - "%s expected number and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 'm': if (top->type != METHOD_PARAM) { - asprintf(why, - "%s expected method and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 'a': if (top->type != ADDR_PARAM) { - asprintf(why, - "%s expected address and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 'f': if (top->type != FILE_PARAM) { - asprintf(why, - "%s expected file:line and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 'c': if (top->type != COND_PARAM) { - asprintf(why, - "%s expected condition and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } break; - - case 'b': if (top->type != NUMERIC_PARAM) { - asprintf(why, - "%s expected boolean and got %s at parameter %lu", - command->name, phpdbg_get_param_type(top TSRMLS_CC), - (command->args - arg) + 1); - return FAILURE; - } else if (top->num > 1 || top->num < 0) { - asprintf(why, - "%s expected boolean and got number at parameter %lu", - command->name, - (command->args - arg) + 1); - return FAILURE; - } break; + case 'i': verify_arg("raw input", top, STR_PARAM); break; + case 's': verify_arg("string", top, STR_PARAM); break; + case 'n': verify_arg("number", top, NUMERIC_PARAM); break; + case 'm': verify_arg("method", top, METHOD_PARAM); break; + case 'a': verify_arg("address", top, ADDR_PARAM); break; + case 'f': verify_arg("file:line", top, FILE_PARAM); break; + case 'c': verify_arg("condition", top, COND_PARAM); break; + case 'b': verify_arg("boolean", top, NUMERIC_PARAM); break; case '*': { /* do nothing */ } break; } - top = top->next; + + if (top ) { + top = top->next; + } else break; + received++; arg++; } - if ((received < expected) && (arg && *arg) && !optional) { +#undef verify_arg + + if ((received < least)) { asprintf(why, - "%s expected %lu arguments (%s) and received %lu", - command->name, - expected, + "%s expected at least %lu arguments (%s) and received %lu", + phpdbg_command_name(command, buffer), + least, command->args, received); return FAILURE; @@ -627,15 +616,21 @@ PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t * matches++; } } else { + /* match full command name */ if (memcmp(command->name, name->str, name->len) == SUCCESS) { if (matches < 3) { matched[matches] = command; matches++; + + /* exact match */ + if (name->len == command->name_len) + break; } else break; } } } + command++; } @@ -655,10 +650,36 @@ PHPDBG_API const phpdbg_command_t* phpdbg_stack_resolve(const phpdbg_command_t * } break; default: { + char *list = NULL; + zend_uint it = 0; + size_t pos = 0; + + while (it < matches) { + if (!list) { + list = malloc( + matched[it]->name_len + 1 + + ((it+1) < matches ? sizeof(", ")-1 : 0)); + } else { + list = realloc(list, + (pos + matched[it]->name_len) + 1 + + ((it+1) < matches ? sizeof(", ")-1 : 0)); + } + memcpy(&list[pos], matched[it]->name, matched[it]->name_len); + pos += matched[it]->name_len; + if ((it+1) < matches) { + memcpy(&list[pos], ", ", sizeof(", ")-1); + pos += (sizeof(", ") - 1); + } + + list[pos] = 0; + it++; + } + asprintf( why, - "The command %s is ambigious, matching %lu commands", - name->str, matches); + "The command %s is ambigious, matching %lu commands (%s)", + name->str, matches, list); + free(list); } return NULL; } diff --git a/phpdbg_cmd.h b/phpdbg_cmd.h index da2a25cbbd..2c0ecb4540 100644 --- a/phpdbg_cmd.h +++ b/phpdbg_cmd.h @@ -94,7 +94,8 @@ struct _phpdbg_command_t { char alias; /* Alias */ phpdbg_command_handler_t handler; /* Command handler */ const phpdbg_command_t *subs; /* Sub Commands */ - char *args; /* Argument Spec */ + char *args; /* Argument Spec */ + const phpdbg_command_t *parent; /* Parent Command */ }; /* }}} */ @@ -158,17 +159,20 @@ PHPDBG_API void phpdbg_param_debug(const phpdbg_param_t *param, const char *msg) */ #define PHPDBG_COMMAND_HANDLER(name) phpdbg_do_##name +#define PHPDBG_COMMAND_D_EXP(name, tip, alias, handler, children, args, parent) \ + {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##handler, children, args, parent} + #define PHPDBG_COMMAND_D_EX(name, tip, alias, handler, children, args) \ - {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##handler, children, args} + {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##handler, children, args, NULL} #define PHPDBG_COMMAND_D(name, tip, alias, children, args) \ - {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##name, children, args} + {PHPDBG_STRL(#name), tip, sizeof(tip)-1, alias, phpdbg_do_##name, children, args, NULL} #define PHPDBG_COMMAND(name) int phpdbg_do_##name(const phpdbg_param_t *param TSRMLS_DC) #define PHPDBG_COMMAND_ARGS param TSRMLS_CC -#define PHPDBG_END_COMMAND {NULL, 0, NULL, 0, '\0', NULL, NULL, '\0'} +#define PHPDBG_END_COMMAND {NULL, 0, NULL, 0, '\0', NULL, NULL, '\0', NULL} /* * Default Switch Case diff --git a/phpdbg_help.c b/phpdbg_help.c index d3404f5569..c5da19b988 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -809,21 +809,6 @@ phpdbg_help_text_t phpdbg_help_text[] = { " Print the instructions for the current stack" }, -{"quiet", -"Setting quietness on will stop the OPLINE output during execution" CR CR - -"**Examples**" CR CR -" $P quiet 1" CR -" $P Q 1" CR -" Will silence OPLINE output, while" CR CR - -" $P quiet 0" CR -" $P Q 0" CR -" Will enable OPLINE output again" CR CR - -"Note: Quietness is disabled automatically while stepping" -}, - {"register", //******* Needs a general explanation of the how registered functions work "Register any global function for use as a command in phpdbg console" CR CR @@ -856,11 +841,13 @@ phpdbg_help_text_t phpdbg_help_text[] = { "are as follows:" CR CR " **Type** **Alias** **Purpose**" CR -" **prompt** **p** set the prompt " CR +" **prompt** **p** set the prompt" CR " **color** **c** set color " CR -" **colors** **C** set colors on or off" CR +" **colors** **C** set colors " CR " **oplog** **O** set oplog output" CR -" **break** **b** set break **id** " CR CR +" **break** **b** set break **id** " CR +" **breaks** **B** set breaks " CR +" **quiet** **q** set quiet " CR CR "Valid colors are **none**, **white**, **red**, **green**, **yellow**, **blue**, **purple**, " "**cyan** and **black**. All colours except **none** can be followed by an optional " diff --git a/phpdbg_info.c b/phpdbg_info.c index b559b75835..97f88bfa1e 100644 --- a/phpdbg_info.c +++ b/phpdbg_info.c @@ -23,18 +23,22 @@ #include "phpdbg_utils.h" #include "phpdbg_info.h" #include "phpdbg_bp.h" +#include "phpdbg_prompt.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +#define PHPDBG_INFO_COMMAND_D(f, h, a, m, l, s) \ + PHPDBG_COMMAND_D_EXP(f, h, a, m, l, s, &phpdbg_prompt_commands[14]) + const phpdbg_command_t phpdbg_info_commands[] = { - PHPDBG_COMMAND_D_EX(break, "show breakpoints", 'b', info_break, NULL, 0), - PHPDBG_COMMAND_D_EX(files, "show included files", 'F', info_files, NULL, 0), - PHPDBG_COMMAND_D_EX(classes, "show loaded classes", 'c', info_classes, NULL, 0), - PHPDBG_COMMAND_D_EX(funcs, "show loaded classes", 'f', info_funcs, NULL, 0), - PHPDBG_COMMAND_D_EX(error, "show last error", 'e', info_error, NULL, 0), - PHPDBG_COMMAND_D_EX(vars, "show active variables", 'v', info_vars, NULL, 0), - PHPDBG_COMMAND_D_EX(literal, "show active literal constants", 'l', info_literal, NULL, 0), - PHPDBG_COMMAND_D_EX(memory, "show memory manager stats", 'm', info_memory, NULL, 0), + PHPDBG_INFO_COMMAND_D(break, "show breakpoints", 'b', info_break, NULL, 0), + PHPDBG_INFO_COMMAND_D(files, "show included files", 'F', info_files, NULL, 0), + PHPDBG_INFO_COMMAND_D(classes, "show loaded classes", 'c', info_classes, NULL, 0), + PHPDBG_INFO_COMMAND_D(funcs, "show loaded classes", 'f', info_funcs, NULL, 0), + PHPDBG_INFO_COMMAND_D(error, "show last error", 'e', info_error, NULL, 0), + PHPDBG_INFO_COMMAND_D(vars, "show active variables", 'v', info_vars, NULL, 0), + PHPDBG_INFO_COMMAND_D(literal, "show active literal constants", 'l', info_literal, NULL, 0), + PHPDBG_INFO_COMMAND_D(memory, "show memory manager stats", 'm', info_memory, NULL, 0), PHPDBG_END_COMMAND }; diff --git a/phpdbg_lexer.c b/phpdbg_lexer.c index 9999a63978..4515b6d822 100644 --- a/phpdbg_lexer.c +++ b/phpdbg_lexer.c @@ -349,8 +349,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 17 -#define YY_END_OF_BUFFER 18 +#define YY_NUM_RULES 16 +#define YY_END_OF_BUFFER 17 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -358,19 +358,21 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[96] = +static yyconst flex_int16_t yy_accept[112] = { 0, - 0, 0, 0, 0, 18, 16, 15, 15, 15, 16, - 13, 6, 6, 16, 13, 13, 13, 13, 13, 13, - 13, 13, 13, 16, 14, 14, 15, 0, 0, 15, - 15, 0, 0, 12, 0, 0, 0, 13, 13, 0, - 0, 6, 0, 13, 13, 13, 13, 3, 5, 13, - 4, 13, 13, 13, 13, 14, 14, 10, 12, 0, - 10, 8, 0, 0, 11, 13, 13, 13, 13, 5, - 13, 13, 4, 9, 0, 0, 13, 13, 1, 13, - 13, 4, 0, 9, 13, 13, 5, 2, 7, 13, - 13, 13, 4, 5, 0 - + 0, 0, 0, 0, 17, 13, 15, 13, 6, 6, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 14, 14, 13, 13, 13, 13, 15, 13, 0, + 12, 13, 13, 13, 6, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 3, 5, 13, 4, 13, 13, + 13, 14, 14, 8, 10, 13, 12, 0, 8, 13, + 12, 13, 10, 13, 13, 13, 11, 8, 13, 13, + 13, 13, 5, 13, 13, 4, 9, 9, 9, 9, + 13, 8, 9, 9, 9, 9, 9, 13, 13, 13, + 1, 13, 13, 4, 9, 8, 9, 8, 9, 13, + + 13, 5, 2, 7, 7, 13, 13, 13, 4, 5, + 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -378,190 +380,230 @@ static yyconst flex_int32_t yy_ec[256] = 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 4, 1, 5, 6, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 7, 8, 8, 9, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 11, 1, 1, - 1, 1, 1, 1, 12, 13, 14, 15, 16, 17, - 7, 18, 19, 7, 7, 20, 7, 21, 22, 7, - 7, 23, 24, 25, 26, 27, 7, 7, 28, 7, - 1, 29, 1, 1, 7, 1, 30, 31, 14, 32, - - 33, 34, 7, 35, 36, 7, 7, 37, 7, 38, - 39, 7, 7, 40, 41, 42, 43, 44, 7, 45, - 46, 7, 1, 1, 1, 1, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7 + 1, 2, 1, 4, 5, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 6, 1, 7, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 9, 1, 1, + 1, 1, 1, 1, 10, 11, 12, 13, 14, 15, + 1, 16, 17, 1, 1, 18, 1, 19, 20, 1, + 1, 21, 22, 23, 24, 25, 1, 1, 26, 1, + 1, 27, 1, 1, 1, 1, 28, 29, 12, 30, + + 31, 32, 1, 33, 34, 1, 1, 35, 1, 36, + 37, 1, 1, 38, 39, 40, 41, 42, 1, 43, + 44, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 } ; -static yyconst flex_int32_t yy_meta[47] = +static yyconst flex_int32_t yy_meta[45] = { 0, - 1, 1, 2, 3, 1, 4, 5, 4, 4, 4, - 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 1, 5, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 5, 5, 5, 5, 5, 5 + 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1 } ; -static yyconst flex_int16_t yy_base[107] = +static yyconst flex_int16_t yy_base[121] = { 0, - 0, 0, 45, 48, 148, 133, 51, 54, 57, 59, - 88, 57, 62, 448, 117, 65, 94, 95, 113, 120, - 115, 64, 124, 160, 0, 72, 75, 105, 71, 170, - 173, 174, 116, 94, 177, 104, 181, 119, 123, 184, - 206, 187, 227, 164, 215, 234, 182, 128, 148, 213, - 185, 236, 237, 243, 212, 0, 220, 101, 448, 92, - 266, 272, 0, 295, 0, 280, 255, 289, 266, 214, - 292, 298, 258, 79, 334, 0, 302, 328, 294, 333, - 331, 322, 216, 76, 334, 340, 336, 338, 219, 359, - 362, 364, 361, 363, 448, 400, 405, 410, 415, 420, - - 425, 430, 435, 64, 440, 442 + 0, 0, 43, 45, 106, 44, 48, 52, 57, 80, + 63, 64, 119, 65, 90, 92, 157, 99, 73, 104, + 116, 0, 56, 125, 142, 132, 148, 74, 176, 56, + 155, 202, 228, 165, 189, 251, 212, 217, 240, 241, + 248, 264, 267, 279, 280, 281, 294, 291, 296, 293, + 306, 0, 100, 330, 335, 320, 628, 93, 0, 346, + 347, 373, 180, 356, 361, 193, 0, 384, 389, 392, + 397, 400, 399, 420, 409, 425, 426, 436, 441, 449, + 206, 0, 457, 460, 486, 212, 469, 234, 470, 493, + 477, 496, 498, 503, 529, 534, 324, 0, 361, 539, + + 540, 541, 542, 570, 378, 575, 577, 578, 554, 583, + 628, 610, 79, 613, 66, 616, 618, 621, 51, 624 } ; -static yyconst flex_int16_t yy_def[107] = +static yyconst flex_int16_t yy_def[121] = { 0, - 95, 1, 96, 96, 95, 97, 97, 97, 95, 98, - 99, 97, 97, 95, 99, 15, 15, 15, 15, 15, - 15, 15, 15, 100, 101, 101, 95, 97, 95, 97, - 95, 98, 102, 97, 102, 98, 97, 15, 15, 95, - 103, 97, 97, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 101, 101, 95, 95, 102, - 102, 97, 104, 105, 43, 15, 15, 15, 15, 15, - 15, 15, 15, 106, 105, 75, 15, 15, 15, 15, - 15, 15, 95, 106, 15, 15, 15, 15, 95, 15, - 15, 15, 15, 15, 0, 95, 95, 95, 95, 95, - - 95, 95, 95, 95, 95, 95 + 111, 1, 112, 112, 111, 113, 111, 114, 113, 113, + 115, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 116, 116, 113, 113, 115, 113, 111, 114, 117, + 113, 114, 118, 114, 113, 113, 115, 115, 115, 115, + 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, + 113, 116, 116, 113, 115, 119, 111, 117, 32, 118, + 115, 118, 62, 120, 118, 32, 36, 115, 113, 113, + 113, 113, 113, 113, 113, 113, 119, 119, 119, 119, + 62, 62, 120, 119, 120, 85, 120, 62, 113, 113, + 113, 113, 113, 113, 119, 119, 85, 85, 85, 113, + + 113, 113, 113, 119, 85, 113, 113, 113, 113, 113, + 0, 111, 111, 111, 111, 111, 111, 111, 111, 111 } ; -static yyconst flex_int16_t yy_nxt[495] = +static yyconst flex_int16_t yy_nxt[673] = { 0, - 6, 7, 8, 9, 10, 6, 11, 6, 12, 13, - 14, 11, 11, 11, 15, 16, 17, 11, 18, 11, - 19, 20, 11, 21, 22, 11, 11, 23, 24, 11, - 11, 15, 16, 17, 11, 18, 11, 19, 20, 11, - 21, 22, 11, 11, 11, 23, 26, 27, 26, 26, - 27, 26, 30, 30, 31, 30, 30, 31, 31, 31, - 31, 29, 33, 34, 29, 42, 42, 29, 74, 35, - 42, 42, 29, 57, 31, 57, 31, 31, 31, 58, - 58, 83, 38, 38, 83, 45, 53, 36, 28, 28, - 28, 46, 28, 37, 95, 39, 39, 39, 40, 38, - - 38, 43, 45, 53, 29, 47, 28, 33, 46, 58, - 58, 48, 38, 38, 35, 29, 41, 28, 28, 28, - 59, 28, 37, 47, 39, 39, 39, 40, 48, 38, - 38, 38, 52, 38, 49, 44, 50, 38, 38, 54, - 51, 38, 38, 29, 60, 41, 38, 95, 38, 52, - 38, 49, 44, 50, 38, 38, 54, 51, 38, 38, - 28, 28, 28, 38, 28, 28, 38, 28, 28, 28, - 29, 30, 30, 31, 31, 31, 31, 33, 34, 95, - 29, 59, 38, 38, 35, 61, 61, 66, 28, 62, - 62, 29, 58, 58, 63, 42, 42, 29, 95, 38, - - 38, 69, 36, 38, 66, 60, 28, 28, 28, 95, - 28, 28, 95, 28, 28, 28, 29, 38, 69, 95, - 38, 57, 31, 57, 89, 89, 67, 89, 89, 70, - 38, 38, 38, 38, 28, 65, 65, 29, 65, 65, - 65, 65, 65, 65, 67, 68, 70, 38, 38, 38, - 38, 71, 38, 95, 38, 38, 65, 65, 65, 65, - 65, 38, 72, 68, 95, 95, 73, 78, 71, 38, - 59, 38, 38, 38, 61, 61, 38, 95, 38, 72, - 62, 62, 29, 73, 38, 78, 95, 95, 95, 80, - 38, 77, 95, 38, 60, 28, 28, 28, 38, 28, - - 28, 38, 76, 76, 76, 40, 80, 38, 79, 77, - 38, 81, 38, 82, 85, 38, 38, 95, 95, 95, - 38, 95, 95, 41, 38, 79, 95, 38, 81, 38, - 82, 95, 85, 38, 28, 28, 28, 38, 28, 28, - 38, 76, 76, 76, 40, 95, 38, 86, 87, 38, - 88, 38, 38, 90, 38, 91, 38, 38, 38, 95, - 95, 95, 41, 38, 86, 87, 38, 88, 38, 38, - 90, 38, 91, 38, 92, 38, 93, 38, 94, 38, - 38, 38, 38, 95, 95, 95, 95, 95, 95, 95, - 95, 92, 95, 93, 38, 94, 38, 38, 38, 38, - - 25, 25, 25, 25, 25, 28, 28, 95, 28, 28, - 32, 32, 32, 32, 32, 38, 38, 95, 38, 38, - 55, 55, 95, 55, 55, 56, 95, 56, 56, 56, - 33, 33, 33, 33, 33, 64, 64, 95, 64, 64, - 75, 75, 95, 75, 75, 84, 84, 5, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95 - + 6, 7, 7, 8, 6, 9, 10, 9, 11, 6, + 6, 6, 12, 13, 14, 6, 15, 6, 16, 17, + 6, 18, 19, 6, 6, 20, 21, 6, 6, 12, + 13, 14, 6, 15, 6, 16, 17, 6, 18, 19, + 6, 6, 6, 20, 23, 7, 23, 7, 25, 28, + 28, 77, 26, 30, 30, 31, 32, 53, 28, 57, + 33, 25, 35, 35, 35, 26, 37, 38, 25, 25, + 27, 39, 26, 26, 44, 28, 28, 25, 34, 24, + 41, 26, 58, 27, 25, 35, 35, 35, 26, 40, + 27, 27, 44, 50, 25, 111, 25, 41, 26, 27, + + 26, 53, 28, 25, 45, 111, 27, 26, 25, 111, + 50, 46, 26, 111, 49, 111, 27, 51, 27, 111, + 25, 45, 36, 25, 26, 27, 111, 26, 46, 25, + 27, 49, 111, 26, 51, 111, 38, 42, 55, 55, + 56, 111, 27, 43, 111, 27, 25, 54, 54, 54, + 26, 27, 25, 111, 42, 111, 26, 111, 40, 25, + 43, 25, 111, 26, 111, 26, 30, 111, 27, 32, + 111, 47, 111, 33, 27, 48, 111, 30, 30, 31, + 32, 27, 111, 27, 33, 60, 63, 63, 47, 111, + 111, 66, 48, 25, 35, 35, 35, 26, 29, 29, + + 29, 111, 34, 30, 30, 31, 32, 59, 59, 59, + 33, 60, 60, 60, 64, 27, 38, 83, 83, 83, + 39, 38, 68, 68, 68, 39, 111, 111, 34, 30, + 30, 61, 62, 111, 63, 63, 64, 111, 40, 60, + 60, 60, 111, 40, 38, 38, 111, 111, 56, 39, + 111, 111, 25, 111, 65, 25, 26, 67, 67, 26, + 67, 67, 67, 67, 67, 67, 40, 40, 25, 69, + 111, 25, 26, 70, 27, 26, 71, 27, 67, 67, + 67, 67, 67, 25, 25, 25, 69, 26, 26, 26, + 27, 70, 111, 27, 71, 25, 72, 25, 25, 26, + + 25, 26, 26, 111, 26, 27, 27, 27, 73, 74, + 25, 111, 111, 72, 26, 111, 75, 27, 111, 27, + 27, 111, 27, 111, 78, 73, 74, 76, 79, 105, + 105, 105, 27, 75, 25, 54, 54, 54, 26, 38, + 111, 55, 55, 39, 76, 111, 80, 30, 30, 61, + 62, 38, 111, 111, 81, 39, 27, 30, 30, 84, + 85, 40, 30, 111, 86, 62, 83, 83, 83, 81, + 111, 111, 65, 40, 30, 30, 61, 62, 82, 82, + 82, 81, 87, 105, 105, 105, 111, 88, 38, 68, + 68, 68, 39, 25, 111, 111, 25, 26, 89, 65, + + 26, 25, 90, 25, 25, 26, 111, 26, 26, 111, + 40, 111, 111, 25, 91, 27, 89, 26, 27, 111, + 90, 92, 94, 27, 25, 27, 27, 111, 26, 25, + 95, 91, 111, 26, 79, 27, 111, 93, 92, 94, + 95, 96, 96, 96, 79, 95, 27, 111, 111, 79, + 111, 27, 80, 95, 93, 111, 111, 79, 30, 30, + 84, 97, 80, 111, 95, 86, 111, 80, 79, 111, + 30, 111, 111, 97, 25, 80, 111, 86, 26, 111, + 100, 25, 111, 87, 111, 26, 80, 30, 30, 84, + 97, 98, 98, 98, 86, 99, 27, 25, 100, 111, + + 25, 26, 25, 27, 26, 111, 26, 25, 111, 102, + 101, 26, 87, 111, 111, 103, 111, 111, 111, 27, + 111, 111, 27, 111, 27, 111, 102, 101, 111, 27, + 111, 111, 103, 95, 104, 104, 104, 79, 95, 96, + 96, 96, 79, 25, 25, 25, 25, 26, 26, 26, + 26, 111, 111, 107, 111, 80, 106, 111, 25, 111, + 80, 111, 26, 111, 111, 27, 27, 27, 27, 111, + 107, 111, 111, 106, 95, 104, 104, 104, 79, 25, + 27, 25, 25, 26, 111, 26, 26, 25, 108, 109, + 110, 26, 111, 111, 111, 111, 80, 111, 111, 111, + + 111, 27, 111, 27, 27, 108, 109, 110, 111, 27, + 22, 22, 22, 29, 29, 29, 52, 52, 30, 30, + 30, 60, 60, 60, 83, 83, 83, 5, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111 } ; -static yyconst flex_int16_t yy_chk[495] = +static yyconst flex_int16_t yy_chk[673] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 3, 3, 4, - 4, 4, 7, 7, 7, 8, 8, 8, 9, 9, - 9, 7, 10, 10, 8, 12, 12, 12, 104, 10, - 13, 13, 13, 26, 26, 26, 27, 27, 27, 29, - 29, 84, 22, 16, 74, 16, 22, 10, 11, 11, - 11, 16, 11, 11, 60, 11, 11, 11, 11, 22, - - 16, 12, 16, 22, 34, 17, 36, 36, 16, 58, - 58, 18, 17, 18, 36, 28, 11, 15, 15, 15, - 33, 15, 15, 17, 15, 15, 15, 15, 18, 17, - 18, 19, 21, 21, 19, 15, 20, 38, 20, 23, - 20, 39, 23, 6, 33, 15, 48, 5, 19, 21, - 21, 19, 15, 20, 38, 20, 23, 20, 39, 23, - 24, 24, 24, 48, 24, 24, 49, 24, 24, 24, - 24, 30, 30, 30, 31, 31, 31, 32, 32, 0, - 30, 35, 44, 49, 32, 35, 35, 44, 24, 37, - 37, 37, 40, 40, 40, 42, 42, 42, 0, 44, - - 47, 47, 32, 51, 44, 35, 41, 41, 41, 0, - 41, 41, 0, 41, 41, 41, 41, 47, 47, 0, - 51, 57, 57, 57, 83, 83, 45, 89, 89, 50, - 55, 50, 70, 45, 41, 43, 43, 43, 43, 43, - 43, 43, 43, 43, 45, 46, 50, 55, 50, 70, - 45, 52, 46, 0, 52, 53, 43, 43, 43, 43, - 43, 54, 53, 46, 0, 0, 54, 67, 52, 46, - 61, 52, 53, 67, 61, 61, 73, 0, 54, 53, - 62, 62, 62, 54, 69, 67, 0, 0, 0, 69, - 67, 66, 0, 73, 61, 64, 64, 64, 66, 64, - - 64, 69, 64, 64, 64, 64, 69, 68, 68, 66, - 71, 71, 79, 72, 77, 66, 72, 0, 0, 0, - 77, 0, 0, 64, 68, 68, 0, 71, 71, 79, - 72, 0, 77, 72, 75, 75, 75, 77, 75, 75, - 82, 75, 75, 75, 75, 0, 78, 78, 80, 81, - 81, 80, 85, 85, 87, 86, 88, 82, 86, 0, - 0, 0, 75, 78, 78, 80, 81, 81, 80, 85, - 85, 87, 86, 88, 90, 86, 91, 90, 92, 93, - 91, 94, 92, 0, 0, 0, 0, 0, 0, 0, - 0, 90, 0, 91, 90, 92, 93, 91, 94, 92, - - 96, 96, 96, 96, 96, 97, 97, 0, 97, 97, - 98, 98, 98, 98, 98, 99, 99, 0, 99, 99, - 100, 100, 0, 100, 100, 101, 0, 101, 101, 101, - 102, 102, 102, 102, 102, 103, 103, 0, 103, 103, - 105, 105, 0, 105, 105, 106, 106, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95 - + 1, 1, 1, 1, 3, 3, 4, 4, 6, 7, + 7, 119, 6, 8, 8, 8, 8, 23, 23, 30, + 8, 9, 9, 9, 9, 9, 115, 11, 12, 14, + 6, 11, 12, 14, 14, 28, 28, 19, 8, 113, + 12, 19, 30, 9, 10, 10, 10, 10, 10, 11, + 12, 14, 14, 19, 15, 58, 16, 12, 15, 19, + + 16, 53, 53, 18, 15, 5, 10, 18, 20, 0, + 19, 16, 20, 0, 18, 0, 15, 20, 16, 0, + 21, 15, 10, 13, 21, 18, 0, 13, 16, 24, + 20, 18, 0, 24, 20, 0, 26, 13, 26, 26, + 26, 0, 21, 13, 0, 13, 25, 25, 25, 25, + 25, 24, 27, 0, 13, 0, 27, 0, 26, 31, + 13, 17, 0, 31, 0, 17, 34, 34, 25, 34, + 0, 17, 0, 34, 27, 17, 0, 29, 29, 29, + 29, 31, 0, 17, 29, 63, 63, 63, 17, 0, + 0, 34, 17, 35, 35, 35, 35, 35, 66, 66, + + 66, 0, 29, 32, 32, 32, 32, 32, 32, 32, + 32, 81, 81, 81, 81, 35, 37, 86, 86, 86, + 37, 38, 38, 38, 38, 38, 0, 0, 32, 33, + 33, 33, 33, 0, 33, 33, 33, 0, 37, 88, + 88, 88, 0, 38, 39, 40, 0, 0, 39, 40, + 0, 0, 41, 0, 33, 36, 41, 36, 36, 36, + 36, 36, 36, 36, 36, 36, 39, 40, 42, 41, + 0, 43, 42, 42, 41, 43, 43, 36, 36, 36, + 36, 36, 36, 44, 45, 46, 41, 44, 45, 46, + 42, 42, 0, 43, 43, 48, 44, 50, 47, 48, + + 49, 50, 47, 0, 49, 44, 45, 46, 47, 49, + 51, 0, 0, 44, 51, 0, 50, 48, 0, 50, + 47, 0, 49, 0, 56, 47, 49, 51, 56, 97, + 97, 97, 51, 50, 54, 54, 54, 54, 54, 55, + 0, 55, 55, 55, 51, 0, 56, 60, 60, 60, + 60, 61, 0, 0, 60, 61, 54, 64, 64, 64, + 64, 55, 65, 65, 64, 65, 99, 99, 99, 65, + 0, 0, 60, 61, 62, 62, 62, 62, 62, 62, + 62, 62, 64, 105, 105, 105, 0, 65, 68, 68, + 68, 68, 68, 69, 0, 0, 70, 69, 69, 62, + + 70, 71, 70, 73, 72, 71, 0, 73, 72, 0, + 68, 0, 0, 75, 71, 69, 69, 75, 70, 0, + 70, 72, 75, 71, 74, 73, 72, 0, 74, 76, + 77, 71, 0, 76, 77, 75, 0, 74, 72, 75, + 78, 78, 78, 78, 78, 79, 74, 0, 0, 79, + 0, 76, 77, 80, 74, 0, 0, 80, 83, 83, + 83, 83, 78, 0, 84, 83, 0, 79, 84, 0, + 87, 87, 0, 87, 89, 80, 0, 87, 89, 0, + 89, 91, 0, 83, 0, 91, 84, 85, 85, 85, + 85, 85, 85, 85, 85, 87, 89, 90, 89, 0, + + 92, 90, 93, 91, 92, 0, 93, 94, 0, 92, + 90, 94, 85, 0, 0, 93, 0, 0, 0, 90, + 0, 0, 92, 0, 93, 0, 92, 90, 0, 94, + 0, 0, 93, 95, 95, 95, 95, 95, 96, 96, + 96, 96, 96, 100, 101, 102, 103, 100, 101, 102, + 103, 0, 0, 101, 0, 95, 100, 0, 109, 0, + 96, 0, 109, 0, 0, 100, 101, 102, 103, 0, + 101, 0, 0, 100, 104, 104, 104, 104, 104, 106, + 109, 107, 108, 106, 0, 107, 108, 110, 106, 107, + 108, 110, 0, 0, 0, 0, 104, 0, 0, 0, + + 0, 106, 0, 107, 108, 106, 107, 108, 0, 110, + 112, 112, 112, 114, 114, 114, 116, 116, 117, 117, + 117, 118, 118, 118, 120, 120, 120, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, + 111, 111 } ; /* The intent behind this definition is that it'll catch @@ -587,7 +629,7 @@ static yyconst flex_int16_t yy_chk[495] = #include #define YY_NO_UNISTD_H 1 -#line 591 "sapi/phpdbg/phpdbg_lexer.c" +#line 633 "sapi/phpdbg/phpdbg_lexer.c" #define INITIAL 0 #define RAW 1 @@ -827,7 +869,7 @@ YY_DECL #line 47 "sapi/phpdbg/dev/phpdbg_lexer.l" -#line 831 "sapi/phpdbg/phpdbg_lexer.c" +#line 873 "sapi/phpdbg/phpdbg_lexer.c" yylval = yylval_param; @@ -882,13 +924,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 96 ) + if ( yy_current_state >= 112 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_current_state != 95 ); + while ( yy_current_state != 111 ); yy_cp = yyg->yy_last_accepting_cpos; yy_current_state = yyg->yy_last_accepting_state; @@ -995,7 +1037,6 @@ YY_RULE_SETUP } YY_BREAK case 10: -/* rule 10 can match eol */ YY_RULE_SETUP #line 100 "sapi/phpdbg/dev/phpdbg_lexer.l" { @@ -1056,17 +1097,9 @@ YY_RULE_SETUP case 16: YY_RULE_SETUP #line 132 "sapi/phpdbg/dev/phpdbg_lexer.l" -{ - phpdbg_init_param(yylval, EMPTY_PARAM); - return T_UNEXPECTED; -} - YY_BREAK -case 17: -YY_RULE_SETUP -#line 136 "sapi/phpdbg/dev/phpdbg_lexer.l" YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK -#line 1070 "sapi/phpdbg/phpdbg_lexer.c" +#line 1103 "sapi/phpdbg/phpdbg_lexer.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(RAW): yyterminate(); @@ -1362,7 +1395,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 96 ) + if ( yy_current_state >= 112 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -1391,11 +1424,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 96 ) + if ( yy_current_state >= 112 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 95); + yy_is_jam = (yy_current_state == 111); return yy_is_jam ? 0 : yy_current_state; } @@ -2231,7 +2264,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 136 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 132 "sapi/phpdbg/dev/phpdbg_lexer.l" diff --git a/phpdbg_lexer.h b/phpdbg_lexer.h index 40e64e159e..f5d949a207 100644 --- a/phpdbg_lexer.h +++ b/phpdbg_lexer.h @@ -338,7 +338,7 @@ extern int yylex \ #undef YY_DECL #endif -#line 136 "sapi/phpdbg/dev/phpdbg_lexer.l" +#line 132 "sapi/phpdbg/dev/phpdbg_lexer.l" #line 345 "sapi/phpdbg/phpdbg_lexer.h" diff --git a/phpdbg_list.c b/phpdbg_list.c index a1bd8c0ff5..6037714292 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -29,14 +29,18 @@ #include "phpdbg.h" #include "phpdbg_list.h" #include "phpdbg_utils.h" +#include "phpdbg_prompt.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +#define PHPDBG_LIST_COMMAND_D(f, h, a, m, l, s) \ + PHPDBG_COMMAND_D_EXP(f, h, a, m, l, s, &phpdbg_prompt_commands[13]) + const phpdbg_command_t phpdbg_list_commands[] = { - PHPDBG_COMMAND_D_EX(lines, "lists the specified lines", 'l', list_lines, NULL, "l"), - PHPDBG_COMMAND_D_EX(class, "lists the specified class", 'c', list_class, NULL, "s"), - PHPDBG_COMMAND_D_EX(method, "lists the specified method", 'm', list_method, NULL, "m"), - PHPDBG_COMMAND_D_EX(func, "lists the specified function", 'f', list_func, NULL, "s"), + PHPDBG_LIST_COMMAND_D(lines, "lists the specified lines", 'l', list_lines, NULL, "l"), + PHPDBG_LIST_COMMAND_D(class, "lists the specified class", 'c', list_class, NULL, "s"), + PHPDBG_LIST_COMMAND_D(method, "lists the specified method", 'm', list_method, NULL, "m"), + PHPDBG_LIST_COMMAND_D(func, "lists the specified function", 'f', list_func, NULL, "s"), PHPDBG_END_COMMAND }; @@ -49,12 +53,12 @@ PHPDBG_LIST(lines) /* {{{ */ switch (param->type) { case NUMERIC_PARAM: - case EMPTY_PARAM: phpdbg_list_file(phpdbg_current_file(TSRMLS_C), - param->type == EMPTY_PARAM ? 0 : (param->num < 0 ? 1 - param->num : param->num), - (param->type != EMPTY_PARAM && param->num < 0 ? param->num : 0) + zend_get_executed_lineno(TSRMLS_C), + (param->num < 0 ? 1 - param->num : param->num), + (param->num < 0 ? param->num : 0) + zend_get_executed_lineno(TSRMLS_C), 0 TSRMLS_CC); break; + case FILE_PARAM: phpdbg_list_file(param->file.name, param->file.line, 0, 0 TSRMLS_CC); break; diff --git a/phpdbg_print.c b/phpdbg_print.c index ed630c200c..c0265d60cf 100644 --- a/phpdbg_print.c +++ b/phpdbg_print.c @@ -26,13 +26,16 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +#define PHPDBG_PRINT_COMMAND_D(f, h, a, m, l, s) \ + PHPDBG_COMMAND_D_EXP(f, h, a, m, l, s, &phpdbg_prompt_commands[9]) + const phpdbg_command_t phpdbg_print_commands[] = { - PHPDBG_COMMAND_D_EX(exec, "print out the instructions in the execution context", 'e', print_exec, NULL, 0), - PHPDBG_COMMAND_D_EX(opline, "print out the instruction in the current opline", 'o', print_opline, NULL, 0), - PHPDBG_COMMAND_D_EX(class, "print out the instructions in the specified class", 'c', print_class, NULL, "s"), - PHPDBG_COMMAND_D_EX(method, "print out the instructions in the specified method", 'm', print_method, NULL, "m"), - PHPDBG_COMMAND_D_EX(func, "print out the instructions in the specified function", 'f', print_func, NULL, "s"), - PHPDBG_COMMAND_D_EX(stack, "print out the instructions in the current stack", 's', print_stack, NULL, 0), + PHPDBG_PRINT_COMMAND_D(exec, "print out the instructions in the execution context", 'e', print_exec, NULL, 0), + PHPDBG_PRINT_COMMAND_D(opline, "print out the instruction in the current opline", 'o', print_opline, NULL, 0), + PHPDBG_PRINT_COMMAND_D(class, "print out the instructions in the specified class", 'c', print_class, NULL, "s"), + PHPDBG_PRINT_COMMAND_D(method, "print out the instructions in the specified method", 'm', print_method, NULL, "m"), + PHPDBG_PRINT_COMMAND_D(func, "print out the instructions in the specified function", 'f', print_func, NULL, "s"), + PHPDBG_PRINT_COMMAND_D(stack, "print out the instructions in the current stack", 's', print_stack, NULL, 0), PHPDBG_END_COMMAND }; diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index aed1f4a015..3830f44a64 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -55,14 +55,13 @@ const phpdbg_command_t phpdbg_prompt_commands[] = { PHPDBG_COMMAND_D(leave, "continue until the end of the stack", 'L', NULL, 0), PHPDBG_COMMAND_D(print, "print something", 'p', phpdbg_print_commands, "s"), PHPDBG_COMMAND_D(break, "set breakpoint", 'b', phpdbg_break_commands, 0), - PHPDBG_COMMAND_D(back, "show trace", 't', NULL, 0), - PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, "n"), + PHPDBG_COMMAND_D(back, "show trace", 't', NULL, "|n"), + PHPDBG_COMMAND_D(frame, "switch to a frame", 'f', NULL, "|n"), PHPDBG_COMMAND_D(list, "lists some code", 'l', phpdbg_list_commands, "*"), PHPDBG_COMMAND_D(info, "displays some informations", 'i', phpdbg_info_commands, "s"), PHPDBG_COMMAND_D(clean, "clean the execution environment", 'X', NULL, 0), PHPDBG_COMMAND_D(clear, "clear breakpoints", 'C', NULL, 0), PHPDBG_COMMAND_D(help, "show help menu", 'h', phpdbg_help_commands, "|s"), - PHPDBG_COMMAND_D(quiet, "silence some output", 'Q', NULL, "b"), PHPDBG_COMMAND_D(set, "set phpdbg configuration", 'S', phpdbg_set_commands, "s"), PHPDBG_COMMAND_D(register,"register a function", 'R', NULL, "s"), PHPDBG_COMMAND_D(source, "execute a phpdbginit", '.', NULL, "s"), @@ -376,9 +375,8 @@ PHPDBG_COMMAND(compile) /* {{{ */ PHPDBG_COMMAND(step) /* {{{ */ { switch (param->type) { - case EMPTY_PARAM: case NUMERIC_PARAM: { - if (param->type == NUMERIC_PARAM && param->num) { + if (param->num) { PHPDBG_G(flags) |= PHPDBG_IS_STEPPING; } else { PHPDBG_G(flags) &= ~PHPDBG_IS_STEPPING; @@ -495,15 +493,13 @@ PHPDBG_COMMAND(leave) /* {{{ */ PHPDBG_COMMAND(frame) /* {{{ */ { - switch (param->type) { + if (!param || param->type == EMPTY_PARAM) { + phpdbg_notice("Currently in frame #%d", PHPDBG_G(frame).num); + } else switch (param->type) { case NUMERIC_PARAM: phpdbg_switch_frame(param->num TSRMLS_CC); break; - case EMPTY_PARAM: - phpdbg_notice("Currently in frame #%d", PHPDBG_G(frame).num); - break; - phpdbg_default_switch_case(); } @@ -681,11 +677,11 @@ PHPDBG_COMMAND(back) /* {{{ */ return SUCCESS; } - switch (param->type) { - case EMPTY_PARAM: + if (!param || param->type == EMPTY_PARAM) { + phpdbg_dump_backtrace(0 TSRMLS_CC); + } else switch (param->type) { case NUMERIC_PARAM: - phpdbg_dump_backtrace( - (param->type == NUMERIC_PARAM) ? param->num : 0 TSRMLS_CC); + phpdbg_dump_backtrace(param->num TSRMLS_CC); break; phpdbg_default_switch_case(); @@ -696,46 +692,42 @@ PHPDBG_COMMAND(back) /* {{{ */ PHPDBG_COMMAND(print) /* {{{ */ { - switch (param->type) { - case EMPTY_PARAM: { - phpdbg_writeln(SEPARATE); - phpdbg_notice("Execution Context Information"); + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln(SEPARATE); + phpdbg_notice("Execution Context Information"); #ifdef HAVE_LIBREADLINE - phpdbg_writeln("Readline\tyes"); + phpdbg_writeln("Readline\tyes"); #else - phpdbg_writeln("Readline\tno"); + phpdbg_writeln("Readline\tno"); #endif - phpdbg_writeln("Exec\t\t%s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none"); - phpdbg_writeln("Compiled\t%s", PHPDBG_G(ops) ? "yes" : "no"); - phpdbg_writeln("Stepping\t%s", (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ? "on" : "off"); - phpdbg_writeln("Quietness\t%s", (PHPDBG_G(flags) & PHPDBG_IS_QUIET) ? "on" : "off"); - phpdbg_writeln("Oplog\t\t%s", PHPDBG_G(oplog) ? "on" : "off"); - - if (PHPDBG_G(ops)) { - phpdbg_writeln("Opcodes\t\t%d", PHPDBG_G(ops)->last); + phpdbg_writeln("Exec\t\t%s", PHPDBG_G(exec) ? PHPDBG_G(exec) : "none"); + phpdbg_writeln("Compiled\t%s", PHPDBG_G(ops) ? "yes" : "no"); + phpdbg_writeln("Stepping\t%s", (PHPDBG_G(flags) & PHPDBG_IS_STEPPING) ? "on" : "off"); + phpdbg_writeln("Quietness\t%s", (PHPDBG_G(flags) & PHPDBG_IS_QUIET) ? "on" : "off"); + phpdbg_writeln("Oplog\t\t%s", PHPDBG_G(oplog) ? "on" : "off"); - if (PHPDBG_G(ops)->last_var) { - phpdbg_writeln("Variables\t%d", PHPDBG_G(ops)->last_var-1); - } else { - phpdbg_writeln("Variables\tNone"); - } - } + if (PHPDBG_G(ops)) { + phpdbg_writeln("Opcodes\t\t%d", PHPDBG_G(ops)->last); - phpdbg_writeln("Executing\t%s", EG(in_execution) ? "yes" : "no"); - if (EG(in_execution)) { - phpdbg_writeln("VM Return\t%d", PHPDBG_G(vmret)); + if (PHPDBG_G(ops)->last_var) { + phpdbg_writeln("Variables\t%d", PHPDBG_G(ops)->last_var-1); + } else { + phpdbg_writeln("Variables\tNone"); } + } - phpdbg_writeln("Classes\t\t%d", zend_hash_num_elements(EG(class_table))); - phpdbg_writeln("Functions\t%d", zend_hash_num_elements(EG(function_table))); - phpdbg_writeln("Constants\t%d", zend_hash_num_elements(EG(zend_constants))); - phpdbg_writeln("Included\t%d", zend_hash_num_elements(&EG(included_files))); + phpdbg_writeln("Executing\t%s", EG(in_execution) ? "yes" : "no"); + if (EG(in_execution)) { + phpdbg_writeln("VM Return\t%d", PHPDBG_G(vmret)); + } - phpdbg_writeln(SEPARATE); - } break; + phpdbg_writeln("Classes\t\t%d", zend_hash_num_elements(EG(class_table))); + phpdbg_writeln("Functions\t%d", zend_hash_num_elements(EG(function_table))); + phpdbg_writeln("Constants\t%d", zend_hash_num_elements(EG(zend_constants))); + phpdbg_writeln("Included\t%d", zend_hash_num_elements(&EG(included_files))); - phpdbg_default_switch_case(); + phpdbg_writeln(SEPARATE); } return SUCCESS; @@ -759,12 +751,11 @@ PHPDBG_COMMAND(set) /* {{{ */ PHPDBG_COMMAND(break) /* {{{ */ { - switch (param->type) { - case EMPTY_PARAM: - phpdbg_set_breakpoint_file( + if (!param || param->type == EMPTY_PARAM) { + phpdbg_set_breakpoint_file( zend_get_executed_filename(TSRMLS_C), zend_get_executed_lineno(TSRMLS_C) TSRMLS_CC); - break; + } else switch (param->type) { case ADDR_PARAM: phpdbg_set_breakpoint_opline(param->addr TSRMLS_CC); break; @@ -926,25 +917,6 @@ PHPDBG_COMMAND(clear) /* {{{ */ return SUCCESS; } /* }}} */ -PHPDBG_COMMAND(quiet) /* {{{ */ -{ - switch (param->type) { - case NUMERIC_PARAM: { - if (param->num) { - PHPDBG_G(flags) |= PHPDBG_IS_QUIET; - } else { - PHPDBG_G(flags) &= ~PHPDBG_IS_QUIET; - } - phpdbg_notice("Quietness %s", - (PHPDBG_G(flags) & PHPDBG_IS_QUIET) ? "enabled" : "disabled"); - } break; - - phpdbg_default_switch_case(); - } - - return SUCCESS; -} /* }}} */ - PHPDBG_COMMAND(list) /* {{{ */ { if (!param || param->type == EMPTY_PARAM) { diff --git a/phpdbg_prompt.h b/phpdbg_prompt.h index e66ea16dce..d92623d409 100644 --- a/phpdbg_prompt.h +++ b/phpdbg_prompt.h @@ -47,7 +47,6 @@ PHPDBG_COMMAND(info); PHPDBG_COMMAND(clean); PHPDBG_COMMAND(clear); PHPDBG_COMMAND(help); -PHPDBG_COMMAND(quiet); PHPDBG_COMMAND(shell); PHPDBG_COMMAND(set); PHPDBG_COMMAND(source); diff --git a/phpdbg_set.c b/phpdbg_set.c index 7ce67d934d..739acd3c71 100644 --- a/phpdbg_set.c +++ b/phpdbg_set.c @@ -23,67 +23,50 @@ #include "phpdbg_set.h" #include "phpdbg_utils.h" #include "phpdbg_bp.h" +#include "phpdbg_prompt.h" ZEND_EXTERN_MODULE_GLOBALS(phpdbg); +#define PHPDBG_SET_COMMAND_D(f, h, a, m, l, s) \ + PHPDBG_COMMAND_D_EXP(f, h, a, m, l, s, &phpdbg_prompt_commands[18]) + const phpdbg_command_t phpdbg_set_commands[] = { - PHPDBG_COMMAND_D_EX(prompt, "usage: set prompt ", 'p', set_prompt, NULL, "s"), + PHPDBG_SET_COMMAND_D(prompt, "usage: set prompt []", 'p', set_prompt, NULL, "|s"), #ifndef _WIN32 - PHPDBG_COMMAND_D_EX(color, "usage: set color ", 'c', set_color, NULL, "ss"), - PHPDBG_COMMAND_D_EX(colors, "usage: set colors ", 'C', set_colors, NULL, "b"), + PHPDBG_SET_COMMAND_D(color, "usage: set color ", 'c', set_color, NULL, "ss"), + PHPDBG_SET_COMMAND_D(colors, "usage: set colors []", 'C', set_colors, NULL, "|b"), #endif - PHPDBG_COMMAND_D_EX(oplog, "usage: set oplog ", 'O', set_oplog, NULL, "s"), - PHPDBG_COMMAND_D_EX(break, "usage: set break [id] ", 'b', set_break, NULL, "lb"), + PHPDBG_SET_COMMAND_D(oplog, "usage: set oplog []", 'O', set_oplog, NULL, "|s"), + PHPDBG_SET_COMMAND_D(break, "usage: set break id []", 'b', set_break, NULL, "l|b"), + PHPDBG_SET_COMMAND_D(breaks, "usage: set breaks []", 'B', set_breaks, NULL, "|b"), + PHPDBG_SET_COMMAND_D(quiet, "usage: set quiet []", 'q', set_quiet, NULL, "|b"), PHPDBG_END_COMMAND }; PHPDBG_SET(prompt) /* {{{ */ { - switch (param->type) { - case EMPTY_PARAM: - phpdbg_writeln("%s", phpdbg_get_prompt(TSRMLS_C)); - break; - - case STR_PARAM: - phpdbg_set_prompt(param->str TSRMLS_CC); - break; - - phpdbg_default_switch_case(); - } - + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln("%s", phpdbg_get_prompt(TSRMLS_C)); + } else phpdbg_set_prompt(param->str TSRMLS_CC); + return SUCCESS; } /* }}} */ PHPDBG_SET(break) /* {{{ */ { - if (!param || param->type == EMPTY_PARAM) { - phpdbg_writeln("%s", - PHPDBG_G(flags) & PHPDBG_IS_BP_ENABLED ? "on" : "off"); - } else switch (param->type) { - case STR_PARAM: - if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) { - phpdbg_enable_breakpoints(TSRMLS_C); - } else if (strncasecmp(param->str, PHPDBG_STRL("off")) == 0) { - phpdbg_disable_breakpoints(TSRMLS_C); - } - break; - + switch (param->type) { case NUMERIC_PARAM: { if (param->next) { - /* - if (phpdbg_argv_is(2, "on")) { - phpdbg_enable_breakpoint(param->num TSRMLS_CC); - } else if (phpdbg_argv_is(2, "off")) { - phpdbg_disable_breakpoint(param->num TSRMLS_CC); - } - */ + if (param->next->num) { + phpdbg_enable_breakpoint(param->num TSRMLS_CC); + } else phpdbg_disable_breakpoint(param->num TSRMLS_CC); } else { phpdbg_breakbase_t *brake = phpdbg_find_breakbase(param->num TSRMLS_CC); if (brake) { phpdbg_writeln( "%s", brake->disabled ? "off" : "on"); } else { - phpdbg_error("Failed to find breakpoint #%lx", param->num); + phpdbg_error("Failed to find breakpoint #%ld", param->num); } } } break; @@ -96,6 +79,26 @@ PHPDBG_SET(break) /* {{{ */ return SUCCESS; } /* }}} */ +PHPDBG_SET(breaks) /* {{{ */ +{ + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln("%s", + PHPDBG_G(flags) & PHPDBG_IS_BP_ENABLED ? "on" : "off"); + } else switch (param->type) { + case NUMERIC_PARAM: { + if (param->num) { + phpdbg_enable_breakpoints(TSRMLS_C); + } else phpdbg_disable_breakpoints(TSRMLS_C); + } break; + + default: + phpdbg_error( + "set break used incorrectly: set break [id] "); + } + + return SUCCESS; +} /* }}} */ + #ifndef _WIN32 PHPDBG_SET(color) /* {{{ */ { @@ -141,58 +144,31 @@ usage: PHPDBG_SET(colors) /* {{{ */ { - switch (param->type) { - case EMPTY_PARAM: { - phpdbg_writeln( - "%s", PHPDBG_G(flags) & PHPDBG_IS_COLOURED ? "on" : "off"); - goto done; - } - - case STR_PARAM: { - if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) { + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln("%s", PHPDBG_G(flags) & PHPDBG_IS_COLOURED ? "on" : "off"); + } else switch (param->type) { + case NUMERIC_PARAM: { + if (param->num) { PHPDBG_G(flags) |= PHPDBG_IS_COLOURED; - goto done; - } else if (strncasecmp(param->str, PHPDBG_STRL("off")) == 0) { + } else { PHPDBG_G(flags) &= ~PHPDBG_IS_COLOURED; - goto done; } - } + } break; default: phpdbg_error( "set colors used incorrectly: set colors "); } -done: return SUCCESS; } /* }}} */ #endif PHPDBG_SET(oplog) /* {{{ */ { - switch (param->type) { - case EMPTY_PARAM: - phpdbg_notice( - "Oplog %s", PHPDBG_G(oplog) ? "enabled" : "disabled"); - break; - - case NUMERIC_PARAM: switch (param->num) { - case 1: - phpdbg_error( - "An output file must be provided to enable oplog"); - break; - - case 0: { - if (PHPDBG_G(oplog)) { - phpdbg_notice("Disabling oplog"); - fclose( - PHPDBG_G(oplog)); - } else { - phpdbg_error("Oplog is not enabled!"); - } - } break; - } break; - + if (!param || param->type == EMPTY_PARAM) { + phpdbg_notice("Oplog %s", PHPDBG_G(oplog) ? "enabled" : "disabled"); + } else switch (param->type) { case STR_PARAM: { /* open oplog */ FILE *old = PHPDBG_G(oplog); @@ -216,3 +192,19 @@ PHPDBG_SET(oplog) /* {{{ */ return SUCCESS; } /* }}} */ +PHPDBG_SET(quiet) /* {{{ */ +{ + if (!param || param->type == EMPTY_PARAM) { + phpdbg_writeln("Quietness %s", + PHPDBG_G(flags) & PHPDBG_IS_QUIET ? "on" : "off"); + } else switch (param->type) { + case NUMERIC_PARAM: { + if (param->num) { + PHPDBG_G(flags) |= PHPDBG_IS_QUIET; + } else PHPDBG_G(flags) &= ~PHPDBG_IS_QUIET; + } break; + } + + return SUCCESS; +} /* }}} */ + diff --git a/phpdbg_set.h b/phpdbg_set.h index ddc3876f5d..4d90aac5b2 100644 --- a/phpdbg_set.h +++ b/phpdbg_set.h @@ -32,6 +32,8 @@ PHPDBG_SET(colors); #endif PHPDBG_SET(oplog); PHPDBG_SET(break); +PHPDBG_SET(breaks); +PHPDBG_SET(quiet); extern const phpdbg_command_t phpdbg_set_commands[];