]> granicus.if.org Git - php/commitdiff
fix output from print command to show all breakpoints
authorkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 15:51:30 +0000 (15:51 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Tue, 12 Nov 2013 15:51:30 +0000 (15:51 +0000)
phpdbg_prompt.c

index f93a34472040c64231880000a91426a6f41c6f40..7ec8401420f46577df9f5ac320c7eacf99dea75f 100644 (file)
@@ -271,7 +271,7 @@ static PHPDBG_COMMAND(print) /* {{{ */
         zend_llist *points;
 
         printf("--------------------------------------\n");
-        printf("File Break Point Information:\n");
+        printf("File Breakpoints:\n");
         for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position);
              zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], (void**) &points, &position) == SUCCESS;
              zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], &position)) {
@@ -279,47 +279,67 @@ static PHPDBG_COMMAND(print) /* {{{ */
              phpdbg_breakfile_t *brake;
 
              if ((brake = zend_llist_get_first_ex(points, &lposition))) {
-                printf("%s:\n", brake->filename);
                 do {
-                    printf("\t%lu\n", brake->line);
+                    printf("#%d\t\t%s:%lu\n", brake->id, brake->filename, brake->line);
                 } while ((brake = zend_llist_get_next_ex(points, &lposition)));
              }
         }
     }
 
-#if 0
-    if (PHPDBG_G(has_sym_bp)) {
+    if ((PHPDBG_G(flags) & PHPDBG_HAS_SYM_BP)) {
         HashPosition position;
-        zend_llist *points;
+        phpdbg_breaksymbol_t *brake;
 
         printf("--------------------------------------\n");
-        printf("Symbol Break Point Information:\n");
+        printf("Function Breakpoints:\n");
         for (zend_hash_internal_pointer_reset_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], &position);
-             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], (void**) &points, &position) == SUCCESS;
+             zend_hash_get_current_data_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], (void**) &brake, &position) == SUCCESS;
              zend_hash_move_forward_ex(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], &position)) {
-             zend_llist_position lposition;
-             phpdbg_breaksymbol_t *brake;
-
-             if ((brake = zend_llist_get_first_ex(points, &lposition))) {
-                printf("%s:\n", brake->symbol);
-                do {
-                    printf("\t%d\n", brake->id);
-                } while ((brake = zend_llist_get_next_ex(points, &lposition)));
+             printf(
+                "#%d\t\t%s\n", brake->id, brake->symbol);
+        }
+    }
+    
+    if ((PHPDBG_G(flags) & PHPDBG_HAS_METHOD_BP)) {
+        HashPosition position[2];
+        HashTable *class_table;
+        char *class_name = NULL;
+        zend_uint class_len = 0;
+        zend_ulong class_idx = 0L;
+        
+        printf("--------------------------------------\n");
+        printf("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])) {
+             
+             if (zend_hash_get_current_key_ex(
+                &PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 
+                &class_name, &class_len, &class_idx, 0, &position[0]) == HASH_KEY_IS_STRING) {
+                
+                 phpdbg_breakmethod_t *brake;
+                
+                 for (zend_hash_internal_pointer_reset_ex(class_table, &position[1]);
+                      zend_hash_get_current_data_ex(class_table, (void**)&brake, &position[1]) == SUCCESS;
+                      zend_hash_move_forward_ex(class_table, &position[1])) {
+                      printf(
+                        "#%d\t\t%s::%s\n", brake->id, brake->class_name, brake->func_name);
+                 }
              }
+             
         }
     }
-#endif
 
     if ((PHPDBG_G(flags) & PHPDBG_HAS_OPLINE_BP)) {
         HashPosition position;
         phpdbg_breakline_t *brake;
 
         printf("--------------------------------------\n");
-        printf("Opline Break Point Information:\n");
+        printf("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)) {
-             printf("#%d\t%s\n", brake->id, brake->name);
+             printf("#%d\t\t%p\n", brake->id, brake->opline);
         }
     }