]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-7.0' into PHP-7.1
authorBob Weinand <bobwei9@hotmail.com>
Wed, 12 Oct 2016 18:19:10 +0000 (20:19 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Wed, 12 Oct 2016 18:19:10 +0000 (20:19 +0200)
1  2 
run-tests.php
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg_help.c
sapi/phpdbg/phpdbg_list.c
sapi/phpdbg/phpdbg_prompt.c
sapi/phpdbg/phpdbg_prompt.h

diff --cc run-tests.php
Simple merge
index bda5b5619f1e1c594f347408046eb0b4d850f427,45eb068e32183154b014b8b57aa07f079728249c..be50de80708c641599ec298c289d44e5f32ca5eb
@@@ -120,62 -189,8 +120,63 @@@ static void php_phpdbg_destroy_register
        destroy_zend_function(function);
  } /* }}} */
  
 +static void php_phpdbg_destroy_file_source(zval *data) /* {{{ */
 +{
 +      phpdbg_file_source *source = (phpdbg_file_source *) Z_PTR_P(data);
 +      destroy_op_array(&source->op_array);
 +      if (source->buf) {
 +              efree(source->buf);
 +      }
++      efree(source->filename);
 +      efree(source);
 +} /* }}} */
  
 -static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
 +static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
 +{
 +      pg->prompt[0] = NULL;
 +      pg->prompt[1] = NULL;
 +
 +      pg->colors[0] = NULL;
 +      pg->colors[1] = NULL;
 +      pg->colors[2] = NULL;
 +
 +      pg->lines = phpdbg_get_terminal_height();
 +      pg->exec = NULL;
 +      pg->exec_len = 0;
 +      pg->buffer = NULL;
 +      pg->last_was_newline = 1;
 +      pg->ops = NULL;
 +      pg->vmret = 0;
 +      pg->in_execution = 0;
 +      pg->bp_count = 0;
 +      pg->flags = PHPDBG_DEFAULT_FLAGS;
 +      pg->oplog = NULL;
 +      memset(pg->io, 0, sizeof(pg->io));
 +      pg->frame.num = 0;
 +      pg->sapi_name_ptr = NULL;
 +      pg->socket_fd = -1;
 +      pg->socket_server_fd = -1;
 +      pg->unclean_eval = 0;
 +
 +      pg->req_id = 0;
 +      pg->err_buf.active = 0;
 +      pg->err_buf.type = 0;
 +
 +      pg->input_buflen = 0;
 +      pg->sigsafe_mem.mem = NULL;
 +      pg->sigsegv_bailout = NULL;
 +
 +      pg->oplog_list = NULL;
 +
 +#ifdef PHP_WIN32
 +      pg->sigio_watcher_thread = INVALID_HANDLE_VALUE;
 +      memset(&pg->swd, 0, sizeof(struct win32_sigio_watcher_data));
 +#endif
 +
 +      pg->eol = PHPDBG_EOL_LF;
 +} /* }}} */
 +
 +static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
  {
        zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0);
        zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_PENDING], 8, NULL, php_phpdbg_destroy_bp_file, 0);
@@@ -1372,8 -1343,11 +1374,10 @@@ int main(int argc, char **argv) /* {{{ 
        FILE* stream = NULL;
        char *print_opline_func;
        zend_bool ext_stmt = 0;
 -      zend_bool use_mm_wrappers = 0;
        zend_bool is_exit;
        int exit_status;
+       char *read_from_stdin = NULL;
+       zend_string *backup_phpdbg_compile = NULL;
  
  #ifndef _WIN32
        struct sigaction sigio_struct;
@@@ -1482,7 -1458,16 +1486,13 @@@ phpdbg_main
  
                        /* begin phpdbg options */
  
+                       case 's': { /* read script from stdin */
+                               if (settings == NULL) {
+                                       read_from_stdin = strdup(php_optarg);
+                               }
+                       } break;
                        case 'S': { /* set SAPI name */
 -                              if (sapi_name) {
 -                                      free(sapi_name);
 -                              }
                                sapi_name = strdup(php_optarg);
                        } break;
  
@@@ -2085,22 -2113,15 +2132,27 @@@ phpdbg_out
                /* reset it... else we risk a stack overflow upon next run (when clean'ing) */
                php_stream_stdio_ops.write = PHPDBG_G(php_stdiop_write);
  #endif
 +      }
 +
 +      sapi_shutdown();
 +
 +#ifdef ZTS
 +      ts_free_id(phpdbg_globals_id);
 +#endif
  
 -              sapi_shutdown();
 +      if (sapi_name) {
 +              free(sapi_name);
        }
  
+       if (read_from_stdin) {
+               free(read_from_stdin);
+               read_from_stdin = NULL;
+       }
 +#ifdef ZTS
 +      tsrm_shutdown();
 +#endif
 +
        if ((cleaning > 0 || remote) && !quit_immediately) {
                /* reset internal php_getopt state */
                php_getopt(-1, argv, OPTIONS, NULL, &php_optind, 0, 0);
                goto phpdbg_main;
        }
  
 -#ifdef ZTS
 -      /* bugggy */
 -      /* tsrm_shutdown(); */
 -#endif
 -
+       if (backup_phpdbg_compile) {
+               zend_string_free(backup_phpdbg_compile);
+       }
  #ifndef _WIN32
        if (address) {
                free(address);
index a3bcbd10a1f11ad86001d40df053aa8dc9de1157,ce1d8d9e90acf47dd714e6633b80c7b91e286134..0943a7ea2cbce5bb5b6029ac3d2aee61e165c0a6
@@@ -329,35 -329,35 +329,36 @@@ phpdbg_help_text_t phpdbg_help_text[] 
  "It supports the following commands:" CR CR
  
  "**Information**" CR
 -"  **list**     list PHP source" CR
 -"  **info**     displays information on the debug session" CR
 -"  **print**    show opcodes" CR
 -"  **frame**    select a stack frame and print a stack frame summary" CR
 -"  **back**     shows the current backtrace" CR
 -"  **help**     provide help on a topic" CR CR
 +"  **list**      list PHP source" CR
 +"  **info**      displays information on the debug session" CR
 +"  **print**     show opcodes" CR
 +"  **frame**     select a stack frame and print a stack frame summary" CR
 +"  **generator** show active generators or select a generator frame" CR
 +"  **back**      shows the current backtrace" CR
 +"  **help**      provide help on a topic" CR CR
  
  "**Starting and Stopping Execution**" CR
 -"  **exec**     set execution context" CR
 -"  **stdin**    set executing script from stdin" CR
 -"  **run**      attempt execution" CR
 -"  **step**     continue execution until other line is reached" CR
 -"  **continue** continue execution" CR
 -"  **until**    continue execution up to the given location" CR
 -"  **next**     continue execution up to the given location and halt on the first line after it" CR
 -"  **finish**   continue up to end of the current execution frame" CR
 -"  **leave**    continue up to end of the current execution frame and halt after the calling instruction" CR
 -"  **break**    set a breakpoint at the specified target" CR
 -"  **watch**    set a watchpoint on $variable" CR
 -"  **clear**    clear one or all breakpoints" CR
 -"  **clean**    clean the execution environment" CR CR
 +"  **exec**      set execution context" CR
++"  **stdin**     set executing script from stdin" CR
 +"  **run**       attempt execution" CR
 +"  **step**      continue execution until other line is reached" CR
 +"  **continue**  continue execution" CR
 +"  **until**     continue execution up to the given location" CR
 +"  **next**      continue execution up to the given location and halt on the first line after it" CR
 +"  **finish**    continue up to end of the current execution frame" CR
 +"  **leave**     continue up to end of the current execution frame and halt after the calling instruction" CR
 +"  **break**     set a breakpoint at the specified target" CR
 +"  **watch**     set a watchpoint on $variable" CR
 +"  **clear**     clear one or all breakpoints" CR
 +"  **clean**     clean the execution environment" CR CR
  
  "**Miscellaneous**" CR
 -"  **set**      set the phpdbg configuration" CR
 -"  **source**   execute a phpdbginit script" CR
 -"  **register** register a phpdbginit function as a command alias" CR
 -"  **sh**       shell a command" CR
 -"  **ev**       evaluate some code" CR
 -"  **quit**     exit phpdbg" CR CR
 +"  **set**       set the phpdbg configuration" CR
 +"  **source**    execute a phpdbginit script" CR
 +"  **register**  register a phpdbginit function as a command alias" CR
 +"  **sh**        shell a command" CR
 +"  **ev**        evaluate some code" CR
 +"  **quit**      exit phpdbg" CR CR
  
  "Type **help <command>** or (**help alias**) to get detailed help on any of the above commands, "
  "for example **help list** or **h l**.  Note that help will also match partial commands if unique "
Simple merge
index de81450eac7b1812c3d0b3455ab558a6a80d9850,85b37b1686307265765972717e71fcc549b9f46b..367d7ef93d343c726aa711d17c514ff8ef76561c
@@@ -67,34 -69,34 +69,35 @@@ extern int phpdbg_startup_run
  
  /* {{{ command declarations */
  const phpdbg_command_t phpdbg_prompt_commands[] = {
 -      PHPDBG_COMMAND_D(exec,    "set execution context",                    'e', NULL, "s", 0),
 -      PHPDBG_COMMAND_D(stdin,   "read script from stdin",                    0 , NULL, "s", 0),
 -      PHPDBG_COMMAND_D(step,    "step through execution",                   's', NULL, 0, PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(continue,"continue execution",                       'c', NULL, 0, PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(run,     "attempt execution",                        'r', NULL, "|s", 0),
 -      PHPDBG_COMMAND_D(ev,      "evaluate some code",                        0 , NULL, "i", PHPDBG_ASYNC_SAFE), /* restricted ASYNC_SAFE */
 -      PHPDBG_COMMAND_D(until,   "continue past the current line",           'u', NULL, 0, 0),
 -      PHPDBG_COMMAND_D(finish,  "continue past the end of the stack",       'F', NULL, 0, 0),
 -      PHPDBG_COMMAND_D(leave,   "continue until the end of the stack",      'L', NULL, 0, 0),
 -      PHPDBG_COMMAND_D(print,   "print something",                          'p', phpdbg_print_commands, "|*c", 0),
 -      PHPDBG_COMMAND_D(break,   "set breakpoint",                           'b', phpdbg_break_commands, "|*c", 0),
 -      PHPDBG_COMMAND_D(back,    "show trace",                               't', NULL, "|n", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(frame,   "switch to a frame",                        'f', NULL, "|n", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(list,    "lists some code",                          'l', phpdbg_list_commands,  "*", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(info,    "displays some informations",               'i', phpdbg_info_commands, "|s", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(clean,   "clean the execution environment",          'X', NULL, 0, 0),
 -      PHPDBG_COMMAND_D(clear,   "clear breakpoints",                        'C', NULL, 0, 0),
 -      PHPDBG_COMMAND_D(help,    "show help menu",                           'h', phpdbg_help_commands, "|s", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(set,     "set phpdbg configuration",                 'S', phpdbg_set_commands,   "s", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(register,"register a function",                      'R', NULL, "s", 0),
 -      PHPDBG_COMMAND_D(source,  "execute a phpdbginit",                     '<', NULL, "s", 0),
 -      PHPDBG_COMMAND_D(export,  "export breaks to a .phpdbginit script",    '>', NULL, "s", PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(sh,      "shell a command",                           0 , NULL, "i", 0),
 -      PHPDBG_COMMAND_D(quit,    "exit phpdbg",                              'q', NULL, 0, PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(wait,    "wait for other process",                   'W', NULL, 0, 0),
 -      PHPDBG_COMMAND_D(watch,   "set watchpoint",                           'w', phpdbg_watch_commands, "|ss", 0),
 -      PHPDBG_COMMAND_D(next,    "step over next line",                      'n', NULL, 0, PHPDBG_ASYNC_SAFE),
 -      PHPDBG_COMMAND_D(eol,     "set EOL",                                  'E', NULL, "|s", 0),
 +      PHPDBG_COMMAND_D(exec,      "set execution context",                    'e', NULL, "s", 0),
++      PHPDBG_COMMAND_D(stdin,     "read script from stdin",                    0 , NULL, "s", 0),
 +      PHPDBG_COMMAND_D(step,      "step through execution",                   's', NULL, 0, PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(continue,  "continue execution",                       'c', NULL, 0, PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(run,       "attempt execution",                        'r', NULL, "|s", 0),
 +      PHPDBG_COMMAND_D(ev,        "evaluate some code",                        0 , NULL, "i", PHPDBG_ASYNC_SAFE), /* restricted ASYNC_SAFE */
 +      PHPDBG_COMMAND_D(until,     "continue past the current line",           'u', NULL, 0, 0),
 +      PHPDBG_COMMAND_D(finish,    "continue past the end of the stack",       'F', NULL, 0, 0),
 +      PHPDBG_COMMAND_D(leave,     "continue until the end of the stack",      'L', NULL, 0, 0),
 +      PHPDBG_COMMAND_D(generator, "inspect or switch to a generator",         'g', NULL, "|n", 0),
 +      PHPDBG_COMMAND_D(print,     "print something",                          'p', phpdbg_print_commands, "|*c", 0),
 +      PHPDBG_COMMAND_D(break,     "set breakpoint",                           'b', phpdbg_break_commands, "|*c", 0),
 +      PHPDBG_COMMAND_D(back,      "show trace",                               't', NULL, "|n", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(frame,     "switch to a frame",                        'f', NULL, "|n", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(list,      "lists some code",                          'l', phpdbg_list_commands,  "*", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(info,      "displays some informations",               'i', phpdbg_info_commands, "|s", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(clean,     "clean the execution environment",          'X', NULL, 0, 0),
 +      PHPDBG_COMMAND_D(clear,     "clear breakpoints",                        'C', NULL, 0, 0),
 +      PHPDBG_COMMAND_D(help,      "show help menu",                           'h', phpdbg_help_commands, "|s", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(set,       "set phpdbg configuration",                 'S', phpdbg_set_commands,   "s", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(register,  "register a function",                      'R', NULL, "s", 0),
 +      PHPDBG_COMMAND_D(source,    "execute a phpdbginit",                     '<', NULL, "s", 0),
 +      PHPDBG_COMMAND_D(export,    "export breaks to a .phpdbginit script",    '>', NULL, "s", PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(sh,        "shell a command",                           0 , NULL, "i", 0),
 +      PHPDBG_COMMAND_D(quit,      "exit phpdbg",                              'q', NULL, 0, PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(wait,      "wait for other process",                   'W', NULL, 0, 0),
 +      PHPDBG_COMMAND_D(watch,     "set watchpoint",                           'w', phpdbg_watch_commands, "|ss", 0),
 +      PHPDBG_COMMAND_D(next,      "step over next line",                      'n', NULL, 0, PHPDBG_ASYNC_SAFE),
 +      PHPDBG_COMMAND_D(eol,       "set EOL",                                  'E', NULL, "|s", 0),
        PHPDBG_END_COMMAND
  }; /* }}} */
  
Simple merge