From: krakjoe Date: Tue, 12 Nov 2013 15:51:30 +0000 (+0000) Subject: fix output from print command to show all breakpoints X-Git-Tag: php-5.6.0alpha1~110^2~418 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=803303057a4bf6353a2c760d9b42aa956b7ebb32;p=php fix output from print command to show all breakpoints --- diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index f93a344720..7ec8401420 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -271,7 +271,7 @@ static PHPDBG_COMMAND(print) /* {{{ */ zend_llist *points; printf("--------------------------------------\n"); - printf("File Break Point Information:\n"); + printf("File Breakpoints:\n"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], (void**) &points, &position) == SUCCESS; zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position)) { @@ -279,47 +279,67 @@ static PHPDBG_COMMAND(print) /* {{{ */ phpdbg_breakfile_t *brake; if ((brake = zend_llist_get_first_ex(points, &lposition))) { - printf("%s:\n", brake->filename); do { - printf("\t%lu\n", brake->line); + printf("#%d\t\t%s:%lu\n", brake->id, brake->filename, brake->line); } while ((brake = zend_llist_get_next_ex(points, &lposition))); } } } -#if 0 - if (PHPDBG_G(has_sym_bp)) { + if ((PHPDBG_G(flags) & PHPDBG_HAS_SYM_BP)) { HashPosition position; - zend_llist *points; + phpdbg_breaksymbol_t *brake; printf("--------------------------------------\n"); - printf("Symbol Break Point Information:\n"); + printf("Function Breakpoints:\n"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], &position); - zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], (void**) &points, &position) == SUCCESS; + zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], (void**) &brake, &position) == SUCCESS; zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], &position)) { - zend_llist_position lposition; - phpdbg_breaksymbol_t *brake; - - if ((brake = zend_llist_get_first_ex(points, &lposition))) { - printf("%s:\n", brake->symbol); - do { - printf("\t%d\n", brake->id); - } while ((brake = zend_llist_get_next_ex(points, &lposition))); + printf( + "#%d\t\t%s\n", brake->id, brake->symbol); + } + } + + if ((PHPDBG_G(flags) & PHPDBG_HAS_METHOD_BP)) { + HashPosition position[2]; + HashTable *class_table; + char *class_name = NULL; + zend_uint class_len = 0; + zend_ulong class_idx = 0L; + + printf("--------------------------------------\n"); + printf("Method Breakpoints:\n"); + for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], &position[0]); + zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], (void**) &class_table, &position[0]) == SUCCESS; + zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], &position[0])) { + + if (zend_hash_get_current_key_ex( + &PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], + &class_name, &class_len, &class_idx, 0, &position[0]) == HASH_KEY_IS_STRING) { + + phpdbg_breakmethod_t *brake; + + for (zend_hash_internal_pointer_reset_ex(class_table, &position[1]); + zend_hash_get_current_data_ex(class_table, (void**)&brake, &position[1]) == SUCCESS; + zend_hash_move_forward_ex(class_table, &position[1])) { + printf( + "#%d\t\t%s::%s\n", brake->id, brake->class_name, brake->func_name); + } } + } } -#endif if ((PHPDBG_G(flags) & PHPDBG_HAS_OPLINE_BP)) { HashPosition position; phpdbg_breakline_t *brake; printf("--------------------------------------\n"); - printf("Opline Break Point Information:\n"); + printf("Opline Breakpoints:\n"); for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], &position); zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (void**) &brake, &position) == SUCCESS; zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], &position)) { - printf("#%d\t%s\n", brake->id, brake->name); + printf("#%d\t\t%p\n", brake->id, brake->opline); } }