From: Bob Weinand Date: Mon, 20 Apr 2015 11:04:56 +0000 (+0200) Subject: show opcode count X-Git-Tag: PRE_PHP7_NSAPI_REMOVAL~209 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5f35e571fa3b73714d917564ed1a11184853cc6a;p=php show opcode count --- diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index a93a062d2e..eb8369b86f 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -763,7 +763,6 @@ const opt_struct OPTIONS[] = { /* {{{ */ #endif {'x', 0, "xml output"}, {'p', 2, "show opcodes"}, - {'o', 0, "display opline addresses"}, {'h', 0, "help"}, {'V', 0, "version"}, {'-', 0, NULL} @@ -1214,10 +1213,6 @@ phpdbg_main: settings = (void *) 0x1; } break; - case 'o': - flags |= PHPDBG_PRINT_OPLINE_ADDR; - break; - case 'h': { sapi_startup(phpdbg); phpdbg->startup(phpdbg); diff --git a/sapi/phpdbg/phpdbg.h b/sapi/phpdbg/phpdbg.h index c76e460495..c636a7c791 100644 --- a/sapi/phpdbg/phpdbg.h +++ b/sapi/phpdbg/phpdbg.h @@ -187,11 +187,10 @@ int phpdbg_do_parse(phpdbg_param_t *stack, char *input); #define PHPDBG_WRITE_XML (1ULL<<31) #define PHPDBG_SHOW_REFCOUNTS (1ULL<<32) -#define PHPDBG_PRINT_OPLINE_ADDR (1ULL<<33) -#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<34) +#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<33) -#define PHPDBG_DISCARD_OUTPUT (1ULL<<35) +#define PHPDBG_DISCARD_OUTPUT (1ULL<<34) #define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL | PHPDBG_IN_FINISH | PHPDBG_IN_LEAVE) #define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP | PHPDBG_HAS_METHOD_OPLINE_BP | PHPDBG_HAS_FILE_OPLINE_BP) diff --git a/sapi/phpdbg/phpdbg_help.c b/sapi/phpdbg/phpdbg_help.c index 022a919f52..6b10551192 100644 --- a/sapi/phpdbg/phpdbg_help.c +++ b/sapi/phpdbg/phpdbg_help.c @@ -390,7 +390,6 @@ phpdbg_help_text_t phpdbg_help_text[] = { " **-a** **-a**192.168.0.3 Setup remote console bind address" CR " **-x** Enable xml output (instead of normal text output)" CR " **-p** **-p**, **-p=func**, **-p* ** Output opcodes and quit" CR -" **-o** Display opline addresses in opline dumps" CR " **-h** Print the help overview" CR " **-V** Print version number" CR " **--** **--** arg1 arg2 Use to delimit phpdbg arguments and php $argv; append any $argv " diff --git a/sapi/phpdbg/phpdbg_print.c b/sapi/phpdbg/phpdbg_print.c index ffdf325b5b..ffd22859af 100644 --- a/sapi/phpdbg/phpdbg_print.c +++ b/sapi/phpdbg/phpdbg_print.c @@ -63,36 +63,33 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */ end = op_array->last-1; if (method->common.scope) { - phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" method=\"%s::%s\" file=\"%s\"", "L%d-%d %s::%s() %s", + phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" method=\"%s::%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s::%s() %s - %p + %d ops", op_array->line_start, op_array->line_end, method->common.scope->name->val, method->common.function_name->val, - op_array->filename ? op_array->filename->val : "unknown"); + op_array->filename ? op_array->filename->val : "unknown", + opline, + op_array->last); } else { - phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" function=\"%s\" file=\"%s\"", "L%d-%d %s() %s", + phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" function=\"%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s() %s - %p + %d ops", method->common.function_name ? op_array->line_start : 0, method->common.function_name ? op_array->line_end : 0, method->common.function_name ? method->common.function_name->val : "{main}", - op_array->filename ? op_array->filename->val : "unknown"); + op_array->filename ? op_array->filename->val : "unknown", + opline, + op_array->last); } zend_hash_init(&vars, op_array->last, NULL, NULL, 0); do { char *decode = phpdbg_decode_opline(op_array, opline, &vars); if (decode != NULL) { - if (PHPDBG_G(flags) & PHPDBG_PRINT_OPLINE_ADDR) { - phpdbg_writeln("print", "line=\"%u\" opline=\"%p\" opcode=\"%s\" op=\"%s\"", " L%-5u %p %-36s %s", - opline->lineno, - opline, - phpdbg_decode_opcode(opline->opcode), - decode); - } else { - phpdbg_writeln("print", "line=\"%u\" opcode=\"%s\" op=\"%s\"", " L%-5u %-36s %s", - opline->lineno, - phpdbg_decode_opcode(opline->opcode), - decode); - } + phpdbg_writeln("print", "line=\"%u\" opnum=\"%u\" opcode=\"%s\" op=\"%s\"", " L%-5u #%-5u %-36s %s", + opline->lineno, + opcode, + phpdbg_decode_opcode(opline->opcode), + decode); free(decode); } else { phpdbg_error("print", "type=\"decodefailure\" opline=\"%16p\"", "Failed to decode opline %16p", opline);