From: Felipe Pena Date: Thu, 14 Nov 2013 00:29:44 +0000 (-0200) Subject: - Cosmetic changes X-Git-Tag: php-5.6.0alpha1~110^2~348 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0eea7e45048924961a22dde9684fd29e3f13a53f;p=php - Cosmetic changes --- diff --git a/phpdbg_bp.c b/phpdbg_bp.c index a0b47b1222..5787943d14 100644 --- a/phpdbg_bp.c +++ b/phpdbg_bp.c @@ -142,7 +142,8 @@ void phpdbg_set_breakpoint_opline(zend_ulong opline TSRMLS_DC) /* {{{ */ new_break.opline = opline; new_break.id = PHPDBG_G(bp_count)++; - zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], opline, &new_break, sizeof(phpdbg_breakline_t), NULL); + zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], opline, + &new_break, sizeof(phpdbg_breakline_t), NULL); phpdbg_notice("Breakpoint #%d added at %#lx", new_break.id, new_break.opline); @@ -161,7 +162,8 @@ void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{ new_break.opline = (zend_ulong) opline; new_break.id = PHPDBG_G(bp_count)++; - zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline, &new_break, sizeof(phpdbg_breakline_t), NULL); + zend_hash_index_update(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], + (zend_ulong) opline, &new_break, sizeof(phpdbg_breakline_t), NULL); phpdbg_notice("Breakpoint #%d added at %#lx", new_break.id, new_break.opline); @@ -203,11 +205,13 @@ void phpdbg_set_breakpoint_expression(const char* expr, size_t expr_len TSRMLS_D phpdbg_breakcond_t *broken; zend_hash_index_update( - &PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, sizeof(phpdbg_breakcond_t), (void**)&broken); - phpdbg_notice( - "Conditional breakpoint #%d added %s/%p", broken->id, Z_STRVAL(broken->code), broken->ops); - PHPDBG_G(flags) |= PHPDBG_HAS_COND_BP; + &PHPDBG_G(bp)[PHPDBG_BREAK_COND], hash, &new_break, + sizeof(phpdbg_breakcond_t), (void**)&broken); + + phpdbg_notice("Conditional breakpoint #%d added %s/%p", + broken->id, Z_STRVAL(broken->code), broken->ops); + PHPDBG_G(flags) |= PHPDBG_HAS_COND_BP; } else { phpdbg_error( "Failed to compile code for expression %s", expr); @@ -227,8 +231,8 @@ int phpdbg_find_breakpoint_file(zend_op_array *op_array TSRMLS_DC) /* {{{ */ zend_llist *break_list; zend_llist_element *le; - if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], op_array->filename, name_len, - (void**)&break_list) == FAILURE) { + if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], op_array->filename, + name_len, (void**)&break_list) == FAILURE) { return FAILURE; } @@ -245,8 +249,6 @@ int phpdbg_find_breakpoint_file(zend_op_array *op_array TSRMLS_DC) /* {{{ */ return FAILURE; } /* }}} */ - - int phpdbg_find_breakpoint_symbol(zend_function *fbc TSRMLS_DC) /* {{{ */ { const char *fname; @@ -288,8 +290,8 @@ int phpdbg_find_breakpoint_method(zend_op_array *ops TSRMLS_DC) /* {{{ */ HashTable *class_table; phpdbg_breakmethod_t *bp; - if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name, ops->scope->name_length, - (void**)&class_table) == SUCCESS) { + if (zend_hash_find(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], ops->scope->name, + ops->scope->name_length, (void**)&class_table) == SUCCESS) { if (zend_hash_find( class_table, ops->function_name, @@ -310,8 +312,8 @@ int phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ * { phpdbg_breakline_t *bp; - if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], (zend_ulong) opline, - (void**)&bp) == SUCCESS) { + if (zend_hash_index_find(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], + (zend_ulong) opline, (void**)&bp) == SUCCESS) { phpdbg_notice("Breakpoint #%d in %#lx at %s:%u", bp->id, bp->opline, zend_get_executed_filename(TSRMLS_C), diff --git a/phpdbg_break.c b/phpdbg_break.c index 8b114abf7e..a5346747d0 100644 --- a/phpdbg_break.c +++ b/phpdbg_break.c @@ -91,14 +91,11 @@ PHPDBG_BREAK(address) /* {{{ */ PHPDBG_BREAK(on) /* {{{ */ { - if (expr && expr_len > 0L) { - phpdbg_set_breakpoint_expression( - expr, expr_len TSRMLS_CC); + if (expr_len == 0) { + phpdbg_error("No expression provided!"); } else { - phpdbg_error( - "No expression provided!"); + phpdbg_set_breakpoint_expression(expr, expr_len TSRMLS_CC); } - return SUCCESS; } /* }}} */ diff --git a/phpdbg_utils.c b/phpdbg_utils.c index adf280320c..c61d38fa88 100644 --- a/phpdbg_utils.c +++ b/phpdbg_utils.c @@ -89,7 +89,13 @@ char *phpdbg_resolve_path(const char *path TSRMLS_DC) /* {{{ */ const char *phpdbg_current_file(TSRMLS_D) /* {{{ */ { - return PHPDBG_G(exec) ? PHPDBG_G(exec) : zend_get_executed_filename(TSRMLS_C); + const char *file = zend_get_executed_filename(TSRMLS_C); + + if (memcmp(file, "[no active file]", sizeof("[no active file]")) == 0) { + return PHPDBG_G(exec); + } + + return file; } /* }}} */ int phpdbg_parse_param(const char *str, size_t len, phpdbg_param_t *param TSRMLS_DC) /* {{{ */ diff --git a/phpdbg_utils.h b/phpdbg_utils.h index b0b121da78..24bb09bf53 100644 --- a/phpdbg_utils.h +++ b/phpdbg_utils.h @@ -28,6 +28,9 @@ int phpdbg_is_empty(const char*); int phpdbg_is_addr(const char*); int phpdbg_is_class_method(const char*, size_t, char**, char**); +/** + * Parameter parsing stuff + */ enum { EMPTY_PARAM = 0, ADDR_PARAM,