fix symbol breakpoints

This commit is contained in:
krakjoe 2013-11-10 18:56:19 +00:00
parent fa63ecbba9
commit 663a13635a
3 changed files with 30 additions and 12 deletions

View file

@ -135,7 +135,7 @@ int phpdbg_breakpoint_symbol(zend_function *fbc TSRMLS_DC) /* {{{ */
if (!fname) { if (!fname) {
fname = "main"; fname = "main";
} }
if (zend_hash_find(&PHPDBG_G(bp_symbols), fname, strlen(fname), if (zend_hash_find(&PHPDBG_G(bp_symbols), fname, strlen(fname),
(void**)&break_list) == SUCCESS) { (void**)&break_list) == SUCCESS) {
printf("breakpoint reached!\n"); printf("breakpoint reached!\n");

View file

@ -82,10 +82,12 @@ PHPDBG_HELP(break) /* {{{ */
{ {
printf("Setting a breakpoint stops execution at a specific stage, the syntax is:\n"); printf("Setting a breakpoint stops execution at a specific stage, the syntax is:\n");
printf("\tfile:line\n"); printf("\tfile:line\n");
printf("[more to come]\n"); printf("\tfunction\n");
printf("For example:\n"); printf("For example:\n");
printf("\tphpdbg> break test.php:1\n"); printf("\tphpdbg> break test.php:1\n");
printf("Will break execution on line 1 of test.php\n"); printf("Will break execution on line 1 of test.php\n");
printf("\tphpdbg> break my_function\n");
printf("Will break execution on entry to my_function\n");
return SUCCESS; return SUCCESS;
} /* }}} */ } /* }}} */

View file

@ -531,8 +531,6 @@ zend_vm_enter:
} }
#endif #endif
phpdbg_print_opline(execute_data TSRMLS_CC);
if (PHPDBG_G(has_file_bp) if (PHPDBG_G(has_file_bp)
&& phpdbg_breakpoint_file(execute_data->op_array TSRMLS_CC) == SUCCESS) { && phpdbg_breakpoint_file(execute_data->op_array TSRMLS_CC) == SUCCESS) {
while (phpdbg_interactive(0, NULL TSRMLS_CC) != PHPDBG_NEXT) { while (phpdbg_interactive(0, NULL TSRMLS_CC) != PHPDBG_NEXT) {
@ -540,15 +538,33 @@ zend_vm_enter:
} }
} }
if (PHPDBG_G(has_sym_bp) if (PHPDBG_G(has_sym_bp)) {
&& (execute_data->opline->opcode == ZEND_DO_FCALL || execute_data->opline->opcode == ZEND_DO_FCALL_BY_NAME) zend_execute_data *previous = execute_data->prev_execute_data;
&& phpdbg_breakpoint_symbol(execute_data->function_state.function TSRMLS_CC) == SUCCESS) { if (previous && (previous != execute_data)) {
while (phpdbg_interactive(0, NULL TSRMLS_CC) != PHPDBG_NEXT) { if (previous->opline) {
continue; if (previous->opline->opcode == ZEND_DO_FCALL || previous->opline->opcode == ZEND_DO_FCALL_BY_NAME) {
} if (phpdbg_breakpoint_symbol(previous->function_state.function TSRMLS_CC) == SUCCESS) {
} while (phpdbg_interactive(0, NULL TSRMLS_CC) != PHPDBG_NEXT) {
continue;
}
}
}
}
} else {
if (execute_data->opline->opcode == ZEND_DO_FCALL || execute_data->opline->opcode == ZEND_DO_FCALL_BY_NAME) {
if (phpdbg_breakpoint_symbol(execute_data->function_state.function TSRMLS_CC) == SUCCESS) {
while (phpdbg_interactive(0, NULL TSRMLS_CC) != PHPDBG_NEXT) {
continue;
}
}
}
}
}
PHPDBG_G(vmret) = execute_data->opline->handler(execute_data TSRMLS_CC); PHPDBG_G(vmret) = execute_data->opline->handler(execute_data TSRMLS_CC);
phpdbg_print_opline(
execute_data TSRMLS_CC);
if (PHPDBG_G(stepping)) { if (PHPDBG_G(stepping)) {
while (phpdbg_interactive( while (phpdbg_interactive(