]> granicus.if.org Git - php/commitdiff
- Cosmetic changes
authorFelipe Pena <felipensp@gmail.com>
Thu, 14 Nov 2013 00:29:44 +0000 (22:29 -0200)
committerFelipe Pena <felipensp@gmail.com>
Thu, 14 Nov 2013 00:29:44 +0000 (22:29 -0200)
phpdbg_bp.c
phpdbg_break.c
phpdbg_utils.c
phpdbg_utils.h

index a0b47b12224a713c25c0f92a8ce0ae50d5060f3e..5787943d147e05280db373fa3286d3467ad1c5b4 100644 (file)
@@ -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),
index 8b114abf7e63a4be5f9e51d527f5d1454ad2c455..a5346747d082e44926913543a3a1961ecc408913 100644 (file)
@@ -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;
 } /* }}} */
 
index adf280320ca2e2bc34ac514347070982b123c504..c61d38fa88f44bd4bc44379f724ee714d0ff0d7d 100644 (file)
@@ -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) /* {{{ */
index b0b121da783b08dea5a69b4376446a461a858c90..24bb09bf538b44d62a690cb0cd754ee4d3478d9c 100644 (file)
@@ -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,