com php-src: - Cosmetic changes: phpdbg_bp.c phpdbg_bre ak.c phpdbg_utils.c phpdbg_utils.h
| From: | Bob Weinand | Date: | Thu, 14 Nov 2013 00:29:44 +0000 |
| Subject: | com php-src: - Cosmetic changes: phpdbg_bp.c phpdbg_bre ak.c phpdbg_utils.c phpdbg_utils.h | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-74987@lists.php.net to get a copy of this message | ||
Commit: 0eea7e45048924961a22dde9684fd29e3f13a53f
Author: Felipe Pena <felipensp@gmail.com> Wed, 13 Nov 2013 22:29:44 -0200
Parents: b91a5053f87e3c42361c503172d3a7c3af72b148
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0eea7e45048924961a22dde9684fd29e3f13a53f
Log:
- Cosmetic changes
Changed paths:
M phpdbg_bp.c
M phpdbg_break.c
M phpdbg_utils.c
M phpdbg_utils.h
Diff:
diff --git a/phpdbg_bp.c b/phpdbg_bp.c
index a0b47b1..5787943 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 8b114ab..a534674 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 adf2803..c61d38f 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 b0b121d..24bb09b 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,