]> granicus.if.org Git - php/commitdiff
quiet
authorkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 21:23:18 +0000 (21:23 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Sun, 10 Nov 2013 21:23:18 +0000 (21:23 +0000)
phpdbg.c
phpdbg.h
phpdbg_help.c
phpdbg_help.h
phpdbg_prompt.c

index c15c718b9d196f8ad182ca7bea95b5c2bb439bfa..e07cb4ad36b4879444a6e4880cddf47ef887e78b 100644 (file)
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -32,6 +32,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */
     pg->vmret = 0;
     pg->quitting = 0;
     pg->bp_count = 0;
+    pg->quiet = 0;
 } /* }}} */
 
 static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */
index c5f6104cefbd73378cf804d1cdf7852b9fc5fd89..c9f3e5ee3df35401d31a979e38c9d5868abd922c 100644 (file)
--- a/phpdbg.h
+++ b/phpdbg.h
@@ -57,6 +57,7 @@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
        zend_bool has_file_bp;  /* file-based breakpoint has been set */
        zend_bool has_sym_bp;   /* symbol-based breakpoint has been set */
        zend_bool quitting;     /* quitting flag */
+       int quiet;              /* quiet */
 ZEND_END_MODULE_GLOBALS(phpdbg)
 
 #endif /* PHPDBG_H */
index f1e7cc7568d6d44060ff2983d131f6eba778fad8..4b218f31d2ff4bb702675c57a9fb710d04048f49 100644 (file)
@@ -91,6 +91,18 @@ PHPDBG_HELP(break) /* {{{ */
        return SUCCESS;
 } /* }}} */
 
+PHPDBG_HELP(quiet) /* {{{ */
+{
+    printf("Setting quietness on will stop the OPLINE output during execution\n");
+    printf("For example:\n");
+    printf("\tphpdbg> quiet 1\n");
+    printf("Will silence OPLINE output, while\n");
+    printf("\tphpdbg> quiet 0\n");
+    printf("Will enable OPLINE output again\n");
+    
+    return SUCCESS;
+} /* }}} */
+
 PHPDBG_HELP(back) /* {{{ */
 {
        printf("The backtrace is gathered with the default debug_backtrace functionality.\n");
index 4b683b6893b3f0700e0e7f0590dedd71a592ef57..ed67a3fec21fa15f5094208cc44dd8ffc5bb34a3 100644 (file)
@@ -42,6 +42,7 @@ PHPDBG_HELP(eval);
 PHPDBG_HELP(print);
 PHPDBG_HELP(break);
 PHPDBG_HELP(back);
+PHPDBG_HELP(quiet);
 
 /**
  * Commands
@@ -56,7 +57,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
        PHPDBG_HELP_D(print,    "printing allows inspection of the execution environment"),
        PHPDBG_HELP_D(break,    "breakpoints allow execution interruption"),
        PHPDBG_HELP_D(back,     "show debug backtrace information during execution"),
-
+    PHPDBG_HELP_D(quiet,    "be quiet during execution"),
        {NULL, 0, 0}
 };
 
index 284f32d861919ed2d1a68c7cd26de39bacd3a70d..55bf0482ec4bad77b3308b862c3d339875ebc8ba 100644 (file)
@@ -281,6 +281,11 @@ static PHPDBG_COMMAND(help) /* {{{ */
        return SUCCESS;
 } /* }}} */
 
+static PHPDBG_COMMAND(quiet) { /* {{{ */
+    PHPDBG_G(quiet) = atoi(expr);
+    return SUCCESS;
+} /* }}} */
+
 static const phpdbg_command_t phpdbg_prompt_commands[] = {
        PHPDBG_COMMAND_D(exec,      "set execution context"),
        PHPDBG_COMMAND_D(compile,   "attempt to pre-compile execution context"),
@@ -292,6 +297,7 @@ static const phpdbg_command_t phpdbg_prompt_commands[] = {
        PHPDBG_COMMAND_D(break,     "set breakpoint"),
        PHPDBG_COMMAND_D(back,      "show backtrace"),
        PHPDBG_COMMAND_D(help,      "show help menu"),
+       PHPDBG_COMMAND_D(quiet,     "silence some output"),
        PHPDBG_COMMAND_D(quit,      "exit phpdbg"),
        {NULL, 0, 0}
 };
@@ -352,9 +358,11 @@ int phpdbg_interactive(int argc, char **argv TSRMLS_DC) /* {{{ */
 
 static void phpdbg_print_opline(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */
 {
-    zend_op *opline = execute_data->opline;
+    if (!PHPDBG_G(quiet)) {
+        zend_op *opline = execute_data->opline;
 
-    printf("[OPLINE: %p:%s]\n", opline, phpdbg_decode_opcode(opline->opcode));
+        printf("[OPLINE: %p:%s]\n", opline, phpdbg_decode_opcode(opline->opcode));
+    }
 } /* }}} */
 
 void phpdbg_execute_ex(zend_execute_data *execute_data TSRMLS_DC) /* {{{ */