]> granicus.if.org Git - php/commitdiff
Merge branch 'master' of https://github.com/krakjoe/phpdbg
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 19 Nov 2013 21:58:03 +0000 (21:58 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 19 Nov 2013 21:58:03 +0000 (21:58 +0000)
1  2 
phpdbg_cmd.c
phpdbg_prompt.c

diff --cc phpdbg_cmd.c
index 13356f4a1c92cd3e5ea8781e85ead92893f1c55f,fca4af34a373423e100cbc51504d55b404443513..6e03d5b3b24e6c49143a02cac18fdc17e21c681e
@@@ -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,
 +                                                      &param 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; arg<input->argc; arg++) {
                                                        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(&param TSRMLS_CC);
-                               
                                break;
                        }
                        command++;
diff --cc phpdbg_prompt.c
index 2fc29dd62fa9a00e2edbe91af2de3b4b18eb4b67,2136f17b4b4b9dc23204349bc681042f8435b7f6..468cd63a105db17fbf23cbcc89d1468fa3640ee5
@@@ -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) {