From: krakjoe Date: Tue, 19 Nov 2013 21:58:03 +0000 (+0000) Subject: Merge branch 'master' of https://github.com/krakjoe/phpdbg X-Git-Tag: php-5.6.0alpha1~110^2~191 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3709ea995c0563fdc7dd77f75185acc677a36cc5;p=php Merge branch 'master' of https://github.com/krakjoe/phpdbg --- 3709ea995c0563fdc7dd77f75185acc677a36cc5 diff --cc phpdbg_cmd.c index 13356f4a1c,fca4af34a3..6e03d5b3b2 --- a/phpdbg_cmd.c +++ b/phpdbg_cmd.c @@@ -326,39 -313,23 +313,39 @@@ int phpdbg_do_cmd_ex(const phpdbg_comma if (input->argc > 0) { while (command && command->name && command->handler) { - if (((command->name_len == input->argv[0]->length) && + if (((command->name_len == input->argv[0]->length) && (memcmp(command->name, input->argv[0]->string, command->name_len) == SUCCESS)) || (command->alias && - (input->argv[0]->length == 1) && + (input->argv[0]->length == 1) && (command->alias == *input->argv[0]->string))) { - if (command->subs && input->argc > 1) { - phpdbg_input_t sub; + + phpdbg_param_t param; + + param.type = EMPTY_PARAM; - sub.argc = input->argc-1; - sub.argv = &input->argv[1]; + if (input->argc > 1) { + if (command->subs) { + phpdbg_input_t sub; - return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC); + sub.argc = input->argc-1; + sub.argv = &input->argv[1]; + + phpdbg_debug( + "trying sub commands in \"%s\" for \"%s\" with %d arguments", + command->name, sub.argv[0]->string, sub.argc-1); + + return phpdbg_do_cmd_ex(command->subs, &sub TSRMLS_CC); + } else { + phpdbg_parse_param( + input->argv[1]->string, + input->argv[1]->length, + ¶m TSRMLS_CC); - } ++ } } + phpdbg_debug( - "found command \"%s\" for \"%s\" have %d arguments", + "found command %s for %s with %d arguments", command->name, input->argv[0]->string, input->argc-1); -#ifdef PHPDBG_DEBUG { int arg; for (arg=1; argargc; arg++) { @@@ -369,14 -340,7 +356,13 @@@ input->argv[arg]->length); } } -#endif + + PHPDBG_G(lcmd) = (phpdbg_command_t*) command; + phpdbg_clear_param( + &PHPDBG_G(lparam) TSRMLS_CC); + PHPDBG_G(lparam) = param; + + rc = command->handler(¶m TSRMLS_CC); - break; } command++; diff --cc phpdbg_prompt.c index 2fc29dd62f,2136f17b4b..468cd63a10 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@@ -978,10 -969,12 +978,10 @@@ int phpdbg_interactive(TSRMLS_D) /* {{ int ret = SUCCESS; phpdbg_input_t* input = phpdbg_read_input(TSRMLS_C); - + if (input && input->length > 0L) { do { - phpdbg_do_cmd_ex(phpdbg_prompt_commands, input TSRMLS_CC); - - switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, input->string, input->length TSRMLS_CC)) { + switch (ret = phpdbg_do_cmd_ex(phpdbg_prompt_commands, input TSRMLS_CC)) { case FAILURE: if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { if (phpdbg_call_register(input TSRMLS_CC) == FAILURE) {