]> granicus.if.org Git - php/commitdiff
output [] around phpdbg text
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 11 Nov 2013 14:03:14 +0000 (14:03 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 11 Nov 2013 14:03:14 +0000 (14:03 +0000)
phpdbg_bp.c
phpdbg_prompt.c

index c261ecc1060e5483bd3738811ed16a88b3ab4bdd..8185196bd12fa08cd0468f7d3c5009ed8041dcf3 100644 (file)
@@ -59,7 +59,7 @@ void phpdbg_set_breakpoint_file(const char *path, long line_num TSRMLS_DC) /* {{
        zend_llist_add_element(break_files_ptr, &new_break);
        
        printf(
-           "Breakpoint #%d added at %s:%ld\n", new_break.id, new_break.filename, new_break.line);
+           "[Breakpoint #%d added at %s:%ld]\n", new_break.id, new_break.filename, new_break.line);
 } /* }}} */
 
 void phpdbg_set_breakpoint_symbol(const char *name TSRMLS_DC) /* {{{ */
@@ -77,9 +77,9 @@ void phpdbg_set_breakpoint_symbol(const char *name TSRMLS_DC) /* {{{ */
                zend_hash_update(&PHPDBG_G(bp_symbols), new_break.symbol,
                        name_len, &new_break, sizeof(phpdbg_breaksymbol_t), NULL);
            
-           printf("Breakpoint #%d added at %s\n", new_break.id, new_break.symbol);
+           printf("[Breakpoint #%d added at %s]\n", new_break.id, new_break.symbol);
        } else {
-           printf("Breakpoint exists at %s\n", name);
+           printf("[Breakpoint exists at %s]\n", name);
        }
 } /* }}} */
 
@@ -98,9 +98,9 @@ void phpdbg_set_breakpoint_opline(const char *name TSRMLS_DC) /* {{{ */
         
                zend_hash_index_update(&PHPDBG_G(bp_oplines), opline, &new_break, sizeof(phpdbg_breakline_t), NULL);
            
-           printf("Breakpoint #%d added at %s\n", new_break.id, new_break.name);
+           printf("[Breakpoint #%d added at %s]\n", new_break.id, new_break.name);
        } else {
-           printf("Breakpoint exists at %s\n", name);
+           printf("[Breakpoint exists at %s]\n", name);
        }
 } /* }}} */
 
@@ -119,7 +119,7 @@ int phpdbg_find_breakpoint_file(zend_op_array *op_array TSRMLS_DC) /* {{{ */
                const phpdbg_breakfile_t *bp = (phpdbg_breakfile_t*)le->data;
 
                if (bp->line == (*EG(opline_ptr))->lineno) {
-                       printf("Breakpoint #%d at %s:%ld\n", bp->id, bp->filename, bp->line);
+                       printf("[Breakpoint #%d at %s:%ld]\n", bp->id, bp->filename, bp->line);
                        return SUCCESS;
                }
        }
@@ -144,7 +144,7 @@ int phpdbg_find_breakpoint_symbol(zend_function *fbc TSRMLS_DC) /* {{{ */
 
        if (zend_hash_find(&PHPDBG_G(bp_symbols), fname, strlen(fname),
                (void**)&bp) == SUCCESS) {
-               printf("Breakpoint #%d in %s() at %s\n", bp->id, bp->symbol,
+               printf("[Breakpoint #%d in %s() at %s]\n", bp->id, bp->symbol,
                        zend_get_executed_filename(TSRMLS_C));
                return SUCCESS;
        }
@@ -158,7 +158,7 @@ int phpdbg_find_breakpoint_opline(phpdbg_opline_ptr_t opline TSRMLS_DC) /* {{{ *
 
        if (zend_hash_index_find(&PHPDBG_G(bp_oplines), (zend_ulong) opline,
                (void**)&bp) == SUCCESS) {
-               printf("Breakpoint #%d in %s at %s\n", bp->id, bp->name,
+               printf("[Breakpoint #%d in %s at %s]\n", bp->id, bp->name,
                        zend_get_executed_filename(TSRMLS_C));
            
                return SUCCESS;
index abc2b7fc775e7e0ca79cdc6e71773bbeb80a2740..24199067c70a6705aa6726a32ac4ce6b09a42fd6 100644 (file)
@@ -33,13 +33,13 @@ ZEND_EXTERN_MODULE_GLOBALS(phpdbg);
 static PHPDBG_COMMAND(exec) /* {{{ */
 {
        if (PHPDBG_G(exec)) {
-               printf("Unsetting old execution context: %s\n", PHPDBG_G(exec));
+               printf("[Unsetting old execution context: %s]\n", PHPDBG_G(exec));
                efree(PHPDBG_G(exec));
                PHPDBG_G(exec) = NULL;
        }
 
        if (PHPDBG_G(ops)) {
-               printf("Destroying compiled opcodes\n");
+               printf("[Destroying compiled opcodes]\n");
                destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
                efree(PHPDBG_G(ops));
                PHPDBG_G(ops) = NULL;
@@ -47,7 +47,7 @@ static PHPDBG_COMMAND(exec) /* {{{ */
 
        PHPDBG_G(exec) = estrndup(expr, PHPDBG_G(exec_len) = expr_len);
 
-       printf("Set execution context: %s\n", PHPDBG_G(exec));
+       printf("[Set execution context: %s]\n", PHPDBG_G(exec));
 
        return SUCCESS;
 } /* }}} */
@@ -57,20 +57,20 @@ static inline int phpdbg_compile(TSRMLS_D) /* {{{ */
        zend_file_handle fh;
 
        if (!EG(in_execution)) {
-           printf("Attempting compilation of %s\n", PHPDBG_G(exec));
+           printf("[Attempting compilation of %s]\n", PHPDBG_G(exec));
         
            if (php_stream_open_for_zend_ex(PHPDBG_G(exec), &fh,
                        USE_PATH|STREAM_OPEN_FOR_INCLUDE TSRMLS_CC) == SUCCESS) {
                    PHPDBG_G(ops) = zend_compile_file(
                        &fh, ZEND_INCLUDE TSRMLS_CC);
                    zend_destroy_file_handle(&fh TSRMLS_CC);
-                   printf("Success\n");
+                   printf("[Success]\n");
                    return SUCCESS;
         } else {
-            printf("Could not open file %s\n", PHPDBG_G(exec));
+            printf("[Could not open file %s]\n", PHPDBG_G(exec));
         }
        } else {
-           printf("Cannot compile while in execution\n");
+           printf("[Cannot compile while in execution]\n");
        }
 
        return FAILURE;
@@ -80,7 +80,7 @@ static PHPDBG_COMMAND(compile) /* {{{ */
 {
        if (PHPDBG_G(exec)) {
                if (PHPDBG_G(ops)) {
-                       printf("Destroying previously compiled opcodes\n");
+                       printf("[Destroying previously compiled opcodes]\n");
                        destroy_op_array(PHPDBG_G(ops) TSRMLS_CC);
                        efree(PHPDBG_G(ops));
                        PHPDBG_G(ops)=NULL;
@@ -88,7 +88,7 @@ static PHPDBG_COMMAND(compile) /* {{{ */
 
                return phpdbg_compile(TSRMLS_C);
        } else {
-               printf("No execution context\n");
+               printf("[No execution context]\n");
                return FAILURE;
        }
 } /* }}} */
@@ -97,7 +97,7 @@ static PHPDBG_COMMAND(step) /* {{{ */
 {
        PHPDBG_G(stepping) = atoi(expr);
        printf(
-           "Stepping %s\n", PHPDBG_G(stepping) ? "on" : "off");
+           "[Stepping %s]\n", PHPDBG_G(stepping) ? "on" : "off");
        return SUCCESS;
 } /* }}} */
 
@@ -111,7 +111,7 @@ static PHPDBG_COMMAND(run) /* {{{ */
        if (PHPDBG_G(ops) || PHPDBG_G(exec)) {
                if (!PHPDBG_G(ops)) {
                        if (phpdbg_compile(TSRMLS_C) == FAILURE) {
-                               printf("Failed to compile %s, cannot run\n", PHPDBG_G(exec));
+                               printf("[Failed to compile %s, cannot run]\n", PHPDBG_G(exec));
                                return FAILURE;
                        }
                }
@@ -123,14 +123,14 @@ static PHPDBG_COMMAND(run) /* {{{ */
                        zend_execute(EG(active_op_array) TSRMLS_CC);
                } zend_catch {
                        if (!PHPDBG_G(quitting)) {
-                               printf("Caught excetion in VM\n");
+                               printf("[Caught excetion in VM]\n");
                                return FAILURE;
                        } else return SUCCESS;
                } zend_end_try();
 
                return SUCCESS;
        } else {
-               printf("Nothing to execute !\n");
+               printf("[Nothing to execute !]\n");
                return FAILURE;
        }
 } /* }}} */
@@ -147,7 +147,7 @@ static PHPDBG_COMMAND(eval) /* {{{ */
                        zval_dtor(&retval);
                }
        } else {
-               printf("No expression provided !\n");
+               printf("[No expression provided !]\n");
                return FAILURE;
        }
 
@@ -157,7 +157,7 @@ static PHPDBG_COMMAND(eval) /* {{{ */
 static PHPDBG_COMMAND(back) /* {{{ */
 {
        if (!EG(in_execution)) {
-               printf("Not executing !\n");
+               printf("[Not executing !]\n");
                return FAILURE;
        }
        zval zbacktrace;
@@ -290,13 +290,13 @@ static PHPDBG_COMMAND(break) /* {{{ */
                    path[line_pos - expr] = 0;
 
                    if (expand_filepath(path, resolved_name TSRMLS_CC) == NULL) {
-                           printf("Failed to expand path %s\n", path);
+                           printf("[Failed to expand path %s]\n", path);
                            return FAILURE;
                    }
 
                    phpdbg_set_breakpoint_file(resolved_name, line_num TSRMLS_CC);
                } else {
-                   printf("No line specified in expression %s\n", expr);
+                   printf("[No line specified in expression %s]\n", expr);
                    return FAILURE;
                }
        } else {
@@ -343,32 +343,32 @@ static int clean_non_persistent_function_full(zend_function *function TSRMLS_DC)
 
 static PHPDBG_COMMAND(clean) /* {{{ */
 {
-    printf("Cleaning Environment:\n");
-    printf("\tClasses: %d\n", zend_hash_num_elements(EG(class_table)));
-    printf("\tFunctions: %d\n", zend_hash_num_elements(EG(function_table)));
-    printf("\tConstants: %d\n", zend_hash_num_elements(EG(zend_constants)));
-    printf("\tIncluded: %d\n", zend_hash_num_elements(&EG(included_files)));
+    printf("[Cleaning Environment:]\n");
+    printf("[\tClasses: %d]\n", zend_hash_num_elements(EG(class_table)));
+    printf("[\tFunctions: %d]\n", zend_hash_num_elements(EG(function_table)));
+    printf("[\tConstants: %d]\n", zend_hash_num_elements(EG(zend_constants)));
+    printf("[\tIncluded: %d]\n", zend_hash_num_elements(&EG(included_files)));
 
     zend_hash_reverse_apply(EG(function_table), (apply_func_t) clean_non_persistent_function_full TSRMLS_CC);
     zend_hash_reverse_apply(EG(class_table), (apply_func_t) clean_non_persistent_class_full TSRMLS_CC); 
     zend_hash_reverse_apply(EG(zend_constants), (apply_func_t) clean_non_persistent_constant_full TSRMLS_CC); 
     zend_hash_clean(&EG(included_files));
 
-    printf("Clean Environment:\n");
-    printf("\tClasses: %d\n", zend_hash_num_elements(EG(class_table)));
-    printf("\tFunctions: %d\n", zend_hash_num_elements(EG(function_table)));
-    printf("\tConstants: %d\n", zend_hash_num_elements(EG(zend_constants)));
-    printf("\tIncluded: %d\n", zend_hash_num_elements(&EG(included_files)));
+    printf("[Clean Environment:]\n");
+    printf("[\tClasses: %d]\n", zend_hash_num_elements(EG(class_table)));
+    printf("[\tFunctions: %d]\n", zend_hash_num_elements(EG(function_table)));
+    printf("[\tConstants: %d]\n", zend_hash_num_elements(EG(zend_constants)));
+    printf("[\tIncluded: %d]\n", zend_hash_num_elements(&EG(included_files)));
     
     return SUCCESS;
 } /* }}} */
 
 static PHPDBG_COMMAND(clear) /* {{{ */
 {
-    printf("Clearing Breakpoints:\n");
-    printf("\tFile\t%d\n", zend_hash_num_elements(&PHPDBG_G(bp_files)));
-    printf("\tSymbols\t%d\n", zend_hash_num_elements(&PHPDBG_G(bp_symbols)));
-    printf("\tOplines\t%d\n", zend_hash_num_elements(&PHPDBG_G(bp_oplines)));
+    printf("[Clearing Breakpoints:]\n");
+    printf("[\tFile\t%d]\n", zend_hash_num_elements(&PHPDBG_G(bp_files)));
+    printf("[\tSymbols\t%d]\n", zend_hash_num_elements(&PHPDBG_G(bp_symbols)));
+    printf("[\tOplines\t%d]\n", zend_hash_num_elements(&PHPDBG_G(bp_oplines)));
     
     zend_hash_clean(&PHPDBG_G(bp_files));
     zend_hash_clean(&PHPDBG_G(bp_symbols));
@@ -379,7 +379,7 @@ static PHPDBG_COMMAND(clear) /* {{{ */
 
 static PHPDBG_COMMAND(help) /* {{{ */
 {
-       printf("Welcome to phpdbg, the interactive PHP debugger.\n");
+       printf("[Welcome to phpdbg, the interactive PHP debugger.]\n");
 
        if (!expr_len) {
                const phpdbg_command_t *prompt_command = phpdbg_prompt_commands;
@@ -403,7 +403,7 @@ static PHPDBG_COMMAND(help) /* {{{ */
                        printf("failed to find help command: %s\n", expr);
                }
        }
-       printf("Please report bugs to <https://github.com/krakjoe/phpdbg/issues>\n");
+       printf("[Please report bugs to <https://github.com/krakjoe/phpdbg/issues>]\n");
 
        return SUCCESS;
 } /* }}} */
@@ -470,7 +470,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */
                        case FAILURE:
                            if (!PHPDBG_G(quitting)) {
                                printf(
-                                   "Failed to execute %s !\n", cmd);
+                                   "[Failed to execute %s !]\n", cmd);
                            }
                        break;