diff options
Diffstat (limited to 'sapi/phpdbg/phpdbg.c')
-rw-r--r-- | sapi/phpdbg/phpdbg.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index d9d61a8a73..a1af1e0ea9 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -32,6 +32,7 @@ #include "phpdbg_io.h" #include "zend_alloc.h" #include "phpdbg_eol.h" +#include "phpdbg_print.h" #include "ext/standard/basic_functions.h" @@ -761,6 +762,7 @@ const opt_struct OPTIONS[] = { /* {{{ */ {'a', 1, "address-or-any"}, #endif {'x', 0, "xml output"}, + {'p', 2, "show opcodes"}, {'h', 0, "help"}, {'V', 0, "version"}, {'-', 0, NULL} @@ -1028,6 +1030,7 @@ int main(int argc, char **argv) /* {{{ */ int server = -1; int socket = -1; FILE* stream = NULL; + char *print_opline_func; #ifdef ZTS void ***tsrm_ls; @@ -1204,6 +1207,12 @@ phpdbg_main: break; + case 'p': { + print_opline_func = php_optarg; + show_banner = 0; + settings = (void *) 0x1; + } break; + case 'h': { sapi_startup(phpdbg); phpdbg->startup(phpdbg); @@ -1231,6 +1240,8 @@ phpdbg_main: return 0; } break; } + + php_optarg = NULL; } /* set exec if present on command line */ @@ -1306,7 +1317,7 @@ phpdbg_main: /* set flags from command line */ PHPDBG_G(flags) = flags; - if (settings) { + if (settings > (zend_phpdbg_globals *) 0x2) { #ifdef ZTS *((zend_phpdbg_globals *) (*((void ***) tsrm_ls))[TSRM_UNSHUFFLE_RSRC_ID(phpdbg_globals_id)]) = *settings; #else @@ -1509,6 +1520,15 @@ phpdbg_main: PHPDBG_G(flags) &= ~PHPDBG_DISCARD_OUTPUT; } + if (settings == (void *) 0x1) { + if (PHPDBG_G(ops)) { + phpdbg_print_opcodes(print_opline_func); + } else { + write(PHPDBG_G(io)[PHPDBG_STDERR].fd, ZEND_STRL("No opcodes could be compiled | No file specified or compilation failed?\n")); + } + goto phpdbg_out; + } + /* step from here, not through init */ if (step) { PHPDBG_G(flags) |= PHPDBG_IS_STEPPING; |