Skip to content

Commit 5f35e57

Browse files
committed
show opcode count
1 parent 1a249bd commit 5f35e57

File tree

4 files changed

+15
-25
lines changed

4 files changed

+15
-25
lines changed

sapi/phpdbg/phpdbg.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,6 @@ const opt_struct OPTIONS[] = { /* {{{ */
763763
#endif
764764
{'x', 0, "xml output"},
765765
{'p', 2, "show opcodes"},
766-
{'o', 0, "display opline addresses"},
767766
{'h', 0, "help"},
768767
{'V', 0, "version"},
769768
{'-', 0, NULL}
@@ -1214,10 +1213,6 @@ int main(int argc, char **argv) /* {{{ */
12141213
settings = (void *) 0x1;
12151214
} break;
12161215

1217-
case 'o':
1218-
flags |= PHPDBG_PRINT_OPLINE_ADDR;
1219-
break;
1220-
12211216
case 'h': {
12221217
sapi_startup(phpdbg);
12231218
phpdbg->startup(phpdbg);

sapi/phpdbg/phpdbg.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,11 +187,10 @@ int phpdbg_do_parse(phpdbg_param_t *stack, char *input);
187187
#define PHPDBG_WRITE_XML (1ULL<<31)
188188

189189
#define PHPDBG_SHOW_REFCOUNTS (1ULL<<32)
190-
#define PHPDBG_PRINT_OPLINE_ADDR (1ULL<<33)
191190

192-
#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<34)
191+
#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<33)
193192

194-
#define PHPDBG_DISCARD_OUTPUT (1ULL<<35)
193+
#define PHPDBG_DISCARD_OUTPUT (1ULL<<34)
195194

196195
#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL | PHPDBG_IN_FINISH | PHPDBG_IN_LEAVE)
197196
#define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP | PHPDBG_HAS_METHOD_OPLINE_BP | PHPDBG_HAS_FILE_OPLINE_BP)

sapi/phpdbg/phpdbg_help.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ phpdbg_help_text_t phpdbg_help_text[] = {
390390
" **-a** **-a**192.168.0.3 Setup remote console bind address" CR
391391
" **-x** Enable xml output (instead of normal text output)" CR
392392
" **-p** **-p**, **-p=func**, **-p* ** Output opcodes and quit" CR
393-
" **-o** Display opline addresses in opline dumps" CR
394393
" **-h** Print the help overview" CR
395394
" **-V** Print version number" CR
396395
" **--** **--** arg1 arg2 Use to delimit phpdbg arguments and php $argv; append any $argv "

sapi/phpdbg/phpdbg_print.c

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,33 @@ static inline void phpdbg_print_function_helper(zend_function *method) /* {{{ */
6363
end = op_array->last-1;
6464

6565
if (method->common.scope) {
66-
phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" method=\"%s::%s\" file=\"%s\"", "L%d-%d %s::%s() %s",
66+
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",
6767
op_array->line_start,
6868
op_array->line_end,
6969
method->common.scope->name->val,
7070
method->common.function_name->val,
71-
op_array->filename ? op_array->filename->val : "unknown");
71+
op_array->filename ? op_array->filename->val : "unknown",
72+
opline,
73+
op_array->last);
7274
} else {
73-
phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" function=\"%s\" file=\"%s\"", "L%d-%d %s() %s",
75+
phpdbg_writeln("printoplineinfo", "type=\"User\" startline=\"%d\" endline=\"%d\" function=\"%s\" file=\"%s\" opline=\"%p\"", "L%d-%d %s() %s - %p + %d ops",
7476
method->common.function_name ? op_array->line_start : 0,
7577
method->common.function_name ? op_array->line_end : 0,
7678
method->common.function_name ? method->common.function_name->val : "{main}",
77-
op_array->filename ? op_array->filename->val : "unknown");
79+
op_array->filename ? op_array->filename->val : "unknown",
80+
opline,
81+
op_array->last);
7882
}
7983

8084
zend_hash_init(&vars, op_array->last, NULL, NULL, 0);
8185
do {
8286
char *decode = phpdbg_decode_opline(op_array, opline, &vars);
8387
if (decode != NULL) {
84-
if (PHPDBG_G(flags) & PHPDBG_PRINT_OPLINE_ADDR) {
85-
phpdbg_writeln("print", "line=\"%u\" opline=\"%p\" opcode=\"%s\" op=\"%s\"", " L%-5u %p %-36s %s",
86-
opline->lineno,
87-
opline,
88-
phpdbg_decode_opcode(opline->opcode),
89-
decode);
90-
} else {
91-
phpdbg_writeln("print", "line=\"%u\" opcode=\"%s\" op=\"%s\"", " L%-5u %-36s %s",
92-
opline->lineno,
93-
phpdbg_decode_opcode(opline->opcode),
94-
decode);
95-
}
88+
phpdbg_writeln("print", "line=\"%u\" opnum=\"%u\" opcode=\"%s\" op=\"%s\"", " L%-5u #%-5u %-36s %s",
89+
opline->lineno,
90+
opcode,
91+
phpdbg_decode_opcode(opline->opcode),
92+
decode);
9693
free(decode);
9794
} else {
9895
phpdbg_error("print", "type=\"decodefailure\" opline=\"%16p\"", "Failed to decode opline %16p", opline);

0 commit comments

Comments
 (0)