]> granicus.if.org Git - php/commitdiff
Fix breakpoints and listing
authorBob Weinand <bobwei9@hotmail.com>
Mon, 22 Sep 2014 21:28:07 +0000 (23:28 +0200)
committerBob Weinand <bobwei9@hotmail.com>
Mon, 22 Sep 2014 21:28:07 +0000 (23:28 +0200)
phpdbg_bp.c
phpdbg_cmd.c
phpdbg_list.c
phpdbg_utils.c

index dbe1da63ddcf9b732338de75c89b9fa973f36f7c..eddcbcb3589f049fbd35092b7a3cbab6b2d77559 100644 (file)
@@ -1357,8 +1357,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        uint32_t class_len = 0;
                        zend_ulong class_idx = 0L;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("Method Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("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])) {
@@ -1383,8 +1383,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        HashPosition position[2];
                        HashTable *points;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("File Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("File Breakpoints:\n");
                        for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position[0]);
                             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], (void**) &points, &position[0]) == SUCCESS;
                             zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position[0])) {
@@ -1405,8 +1405,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        HashPosition position;
                        phpdbg_breakline_t *brake;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("Opline Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("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)) {
@@ -1436,8 +1436,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        uint32_t class_len = 0, method_len = 0;
                        zend_ulong class_idx = 0L, method_idx = 0L;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("Method opline Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("Method opline Breakpoints:\n");
                        for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD_OPLINE], &position[0]);
                             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD_OPLINE], (void**) &class_table, &position[0]) == SUCCESS;
                             zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD_OPLINE], &position[0])) {
@@ -1475,8 +1475,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        uint32_t function_len = 0;
                        zend_ulong function_idx = 0L;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("Function opline Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("Function opline Breakpoints:\n");
                        for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FUNCTION_OPLINE], &position[0]);
                             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FUNCTION_OPLINE], (void**) &function_table, &position[0]) == SUCCESS;
                             zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FUNCTION_OPLINE], &position[0])) {
@@ -1505,8 +1505,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        uint32_t file_len = 0;
                        zend_ulong file_idx = 0L;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("File opline Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("File opline Breakpoints:\n");
                        for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE], &position[0]);
                             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE], (void**) &file_table, &position[0]) == SUCCESS;
                             zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE_OPLINE], &position[0])) {
@@ -1531,8 +1531,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        HashPosition position;
                        phpdbg_breakcond_t *brake;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("Conditional Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("Conditional Breakpoints:\n");
                        for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], &position);
                             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], (void**) &brake, &position) == SUCCESS;
                             zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], &position)) {
@@ -1607,8 +1607,8 @@ PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC) /* {{{ */
                        HashPosition position;
                        phpdbg_breakop_t *brake;
 
-                       phpdbg_out(SEPARATE);
-                       phpdbg_out("Opcode Breakpoints:");
+                       phpdbg_out(SEPARATE "\n");
+                       phpdbg_out("Opcode Breakpoints:\n");
                        for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], &position);
                             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], (void**) &brake, &position) == SUCCESS;
                             zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_OPCODE], &position)) {
index 5c6ac072ea95b56c52f5e7dc8fe8400572a0b4ed..2e91304d7ea2ba5bff989e760c6ff4b5808c08c6 100644 (file)
@@ -750,12 +750,18 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack TSRMLS_DC) {
 
        switch (top->type) {
                case EVAL_PARAM:
+                       phpdbg_activate_err_buf(0 TSRMLS_CC);
+                       phpdbg_free_err_buf(TSRMLS_C);
                        return PHPDBG_COMMAND_HANDLER(ev)(top TSRMLS_CC);
 
                case RUN_PARAM:
+                       phpdbg_activate_err_buf(0 TSRMLS_CC);
+                       phpdbg_free_err_buf(TSRMLS_C);
                        return PHPDBG_COMMAND_HANDLER(run)(top TSRMLS_CC);
 
                case SHELL_PARAM:
+                       phpdbg_activate_err_buf(0 TSRMLS_CC);
+                       phpdbg_free_err_buf(TSRMLS_C);
                        return PHPDBG_COMMAND_HANDLER(sh)(top TSRMLS_CC);
 
                case STR_PARAM: {
@@ -765,7 +771,6 @@ PHPDBG_API int phpdbg_stack_execute(phpdbg_param_t *stack TSRMLS_DC) {
                                if (phpdbg_stack_verify(handler, &top TSRMLS_CC) == SUCCESS) {
                                        phpdbg_activate_err_buf(0 TSRMLS_CC);
                                        phpdbg_free_err_buf(TSRMLS_C);
-
                                        return handler->handler(top TSRMLS_CC);
                                }
                        }
index 64e0d8465b9883c1c96056a35cd1f4ddb3d0a929..748461908cfc284b57ae846705b97c03e7a9ee89 100644 (file)
@@ -159,12 +159,12 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig
 
                if (offset <= line) {
                        if (!highlight) {
-                               phpdbg_write("line", "num=\"%d\" code=\"%s\"", "%05ld: %s", line, buffer);
+                               phpdbg_write("line", "num=\"%d\" code=\"%s\"", " %05ld: %s", line, buffer);
                        } else {
                                if (highlight != line) {
-                                       phpdbg_write("line", "num=\"%d\" code=\"%s\"", "%05ld: %s", " %05ld: %s", line, buffer);
+                                       phpdbg_write("line", "num=\"%ld\" code=\"%s\"", " %05ld: %s", line, buffer);
                                } else {
-                                       phpdbg_write("line", "num=\"%d\" code=\"%s\" current=\"current\"", "%05ld: %s", ">%05ld: %s", line, buffer);
+                                       phpdbg_write("line", "num=\"%ld\" code=\"%s\" current=\"current\"", ">%05ld: %s", line, buffer);
                                }
                        }
 
index b68a0b6d2dc8db5adebe54c8af171f934badae3f..6ff905c7369a429c0ad008ef0678549e0872c3f7 100644 (file)
@@ -1090,7 +1090,8 @@ static int phpdbg_process_print(FILE *fp, int type, const char *tag, const char
                case P_WRITE:
                        severity = "normal";
                        if (msg) {
-                               msgoutlen = asprintf(&msgout, "%.*s\n", msglen, msg);
+                               msgout = strndup(msg, msglen);
+                               msgoutlen = msglen;
                        } else {
                                msgoutlen = 0;
                                msgout = strdup("");