]> granicus.if.org Git - php/commitdiff
- Renamed brake to break
authorFelipe Pena <felipensp@gmail.com>
Sun, 10 Nov 2013 11:48:01 +0000 (09:48 -0200)
committerFelipe Pena <felipensp@gmail.com>
Sun, 10 Nov 2013 11:48:01 +0000 (09:48 -0200)
1  2 
phpdbg_help.c
phpdbg_help.h
phpdbg_prompt.c

diff --cc phpdbg_help.c
index 586cd68cf4f7636d40fe28973aa42de9ed247c2e,48d32a2db346da4b3b9a5cd91311eb88ef506194..38ae6c36f39161ef415e4a2dca9a8e12fb811c76
@@@ -37,9 -39,21 +39,21 @@@ PHPDBG_HELP(compile) /* {{{ *
    return SUCCESS;
  } /* }}} */
  
- PHPDBG_HELP(brake) /* {{{ */
 -PHPDBG_HELP(print) /* {{{ */ 
++PHPDBG_HELP(print) /* {{{ */
  {
-     printf("doing brake help: %s\n", expr);
-     
-     return SUCCESS;
+   printf("By default, print will show information about the current execution environment\n");
+   printf("To show specific information pass an expression to print, for example:\n");
+   printf("\tprint opcodes[0]\n");
+   printf("Will show the opline @ 0\n");
+   printf("Available print commands:\n");
+   printf("\tNone\n");
 -  
++
+   return SUCCESS;
+ } /* }}} */
 -PHPDBG_HELP(brake) /* {{{ */
++PHPDBG_HELP(break) /* {{{ */
+ {
 -  printf("doing brake help: %s\n", expr);
 -  
++  printf("doing break help: %s\n", expr);
++
+   return SUCCESS;
  } /* }}} */
diff --cc phpdbg_help.h
index b3dfb228fdfb17b780d351c721477ca1d7ff492a,87462ca1354cb51080ea4ba155c90652ac84f026..dba58d7dc486dbc6d9d97370cc2d444e3e62a454
   * Helper Forward Declarations
   */
  PHPDBG_HELP(exec);
+ PHPDBG_HELP(compile);
  PHPDBG_HELP(print);
--PHPDBG_HELP(brake);
++PHPDBG_HELP(break);
  
  /**
   * Commands
   */
  static const phpdbg_command_t phpdbg_help_commands[] = {
-   PHPDBG_HELP_D(exec,  "the execution context should be a valid phpdbg path"),
-   PHPDBG_HELP_D(print, "printing allows inspection of the execution environment"),
-   PHPDBG_HELP_D(brake, "brake points allow execution interruption"),
+   PHPDBG_HELP_D(exec,     "the execution context should be a valid phpdbg path"),
+   PHPDBG_HELP_D(compile,  "pre-compilation allows inspection of code before execution"),
+   PHPDBG_HELP_D(print,    "printing allows inspection of the execution environment"),
 -  PHPDBG_HELP_D(brake,    "brake points allow execution interruption"),
++  PHPDBG_HELP_D(break,    "breakpoints allow execution interruption"),
    {NULL, 0, 0}
  };
  
diff --cc phpdbg_prompt.c
index 9d30193cd21680354ed53e624ef357e7f4ef324b,809273886b63cdcd0f503177ccbe763ac32b0ab7..a1f9685066bd7c13fc6f5de4c91060dbca835835
@@@ -32,13 -32,52 +32,52 @@@ static PHPDBG_COMMAND(exec) { /* {{{ *
      printf(
        "Unsetting old execution context: %s\n", PHPDBG_G(exec));
      efree(PHPDBG_G(exec));
 -  
+     PHPDBG_G(exec) = NULL;
+   }
++
+   if (PHPDBG_G(ops)) {
+     printf(
+       "Destroying compiled opcodes\n");
+     destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
+     efree(PHPDBG_G(ops));
+     PHPDBG_G(ops) = NULL;
    }
 -  
 +
    PHPDBG_G(exec) = estrndup(
      expr, PHPDBG_G(exec_len)=expr_len);
 -    
 +
    printf(
      "Set execution context: %s\n", PHPDBG_G(exec));
 -    
++
+   return SUCCESS;
+ } /* }}} */
+ static PHPDBG_COMMAND(compile) { /* {{{ */
+   zend_file_handle fh;
 -  
++
+   if (PHPDBG_G(exec)) {
 -    
++
+     if (PHPDBG_G(ops)) {
+       printf("Destroying compiled opcodes\n");
+       destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
+       efree(PHPDBG_G(ops));
+     }
 -    
++
+     printf("Attempting compilation of %s\n", PHPDBG_G(exec));
+     if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh, USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC) == SUCCESS) {
+       PHPDBG_G(ops) = zend_compile_file(
+         &fh, ZEND_INCLUDE TSRMLS_CC);
+       zend_destroy_file_handle(&fh TSRMLS_CC);
+       printf("Success\n");
+       return SUCCESS;
+     } else {
+       printf("Could not open file %s\n", PHPDBG_G(exec));
+       return FAILURE;
+     }
+   } else {
+     printf("No execution context\n");
+     return FAILURE;
+   }
  } /* }}} */
  
  static PHPDBG_COMMAND(print) { /* {{{ */
@@@ -48,7 -97,7 +97,7 @@@
    return SUCCESS;
  } /* }}} */
  
--static PHPDBG_COMMAND(brake) { /* {{{ */
++static PHPDBG_COMMAND(break) { /* {{{ */
    return SUCCESS;
  } /* }}} */
  
@@@ -93,11 -142,12 +142,12 @@@ static PHPDBG_COMMAND(help) /* {{{ *
  } /* }}} */
  
  static const phpdbg_command_t phpdbg_prompt_commands[] = {
-       PHPDBG_COMMAND_D(exec,  "set execution context"),
-       PHPDBG_COMMAND_D(print, "print something"),
-       PHPDBG_COMMAND_D(brake, "set brake point"),
-       PHPDBG_COMMAND_D(help,  "show help menu"),
-       PHPDBG_COMMAND_D(quit,  "exit phpdbg"),
 -  PHPDBG_COMMAND_D(exec,      "set execution context"),
 -  PHPDBG_COMMAND_D(compile,   "attempt to pre-compile execution context"),
 -  PHPDBG_COMMAND_D(print,     "print something"),
 -      PHPDBG_COMMAND_D(brake,     "set brake point"),
++      PHPDBG_COMMAND_D(exec,      "set execution context"),
++      PHPDBG_COMMAND_D(compile,   "attempt to pre-compile execution context"),
++      PHPDBG_COMMAND_D(print,     "print something"),
++      PHPDBG_COMMAND_D(break,     "set breakpoint"),
+       PHPDBG_COMMAND_D(help,      "show help menu"),
+       PHPDBG_COMMAND_D(quit,      "exit phpdbg"),
        {NULL, 0, 0}
  };