Lines Matching refs:element
434 void phpdbg_recurse_watch_element(phpdbg_watch_element *element);
435 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element);
436 void phpdbg_free_watch_element(phpdbg_watch_element *element);
438 void phpdbg_watch_parent_ht(phpdbg_watch_element *element);
440 …atch_element *phpdbg_add_watch_element(phpdbg_watchpoint_t *watch, phpdbg_watch_element *element) { argument
455 if ((old_element = zend_hash_find_ptr(&watch->elements, element->str))) {
456 phpdbg_free_watch_element(element);
461 element->watch = watch;
462 zend_hash_add_ptr(&watch->elements, element->str, element);
464 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
465 phpdbg_recurse_watch_element(element);
468 return element;
471 phpdbg_watch_element *phpdbg_add_bucket_watch_element(Bucket *bucket, phpdbg_watch_element *element… argument
474 element = phpdbg_add_watch_element(&watch, element);
475 phpdbg_watch_parent_ht(element);
476 return element;
479 phpdbg_watch_element *phpdbg_add_ht_watch_element(zval *zv, phpdbg_watch_element *element) { argument
487 element->flags |= Z_TYPE_P(zv) == IS_ARRAY ? PHPDBG_WATCH_ARRAY : PHPDBG_WATCH_OBJECT;
489 return phpdbg_add_watch_element(&watch, element);
492 bool phpdbg_is_recursively_watched(void *ptr, phpdbg_watch_element *element) { argument
493 phpdbg_watch_element *next = element;
495 element = next;
496 if (element->watch->addr.ptr == ptr) {
499 next = element->parent;
500 } while (!(element->flags & PHPDBG_WATCH_RECURSIVE_ROOT));
505 void phpdbg_add_recursive_watch_from_ht(phpdbg_watch_element *element, zend_long idx, zend_string *… argument
507 if (phpdbg_is_recursively_watched(zv, element)) {
514 …r = strpprintf(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[%s]" : "%.*s->%s", (int) ZSTR_LEN(…
516 …f(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[" ZEND_LONG_FMT "]" : "%.*s->" ZEND_LONG_FMT, (…
522 child->parent = element;
524 child->parent_container = HT_WATCH_HT(element->watch);
525 zend_hash_add_ptr(&element->child_container, child->str, child);
529 void phpdbg_recurse_watch_element(phpdbg_watch_element *element) { argument
533 if (element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET) {
534 zv = element->watch->addr.zv;
540 if (element->child) {
541 phpdbg_remove_watch_element_recursively(element->child);
545 || phpdbg_is_recursively_watched(HT_WATCH_OFFSET + (char *) HT_FROM_ZVP(zv), element)) {
546 if (element->child) {
547 phpdbg_free_watch_element(element->child);
548 element->child = NULL;
553 if (element->child) {
554 child = element->child;
558 child->str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
560 child->parent = element;
562 element->child = child;
566 } else if (zend_hash_num_elements(&element->child_container) == 0) {
570 ZEND_ASSERT(element->watch->type == WATCH_ON_HASHTABLE);
571 ZEND_HASH_FOREACH_KEY_VAL(HT_WATCH_HT(element->watch), idx, str, zv) {
572 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
577 void phpdbg_watch_parent_ht(phpdbg_watch_element *element) { argument
578 if (element->watch->type == WATCH_ON_BUCKET) {
582 ZEND_ASSERT(element->parent_container);
583 …if (!(res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->parent_container)…
585 hti->ht = element->parent_container;
603 zend_hash_add_ptr(&hti->watches, element->name_in_parent, element);
607 void phpdbg_unwatch_parent_ht(phpdbg_watch_element *element) { argument
608 if (element->watch->type == WATCH_ON_BUCKET) {
609 …phpdbg_btree_result *res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->pa…
610 ZEND_ASSERT(element->parent_container);
621 zend_hash_del(&hti->watches, element->name_in_parent);
630 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until);
631 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element);
633 void phpdbg_queue_element_for_recreation(phpdbg_watch_element *element) { argument
637 if ((prev = zend_hash_find_ptr(&PHPDBG_G(watch_recreation), element->str))) {
640 if (child == element) {
646 zend_hash_update_ptr(&PHPDBG_G(watch_recreation), element->str, element);
649 phpdbg_dissociate_watch_element(element, prev);
651 if (!element->parent) {
653 zend_hash_index_add_empty_element(&PHPDBG_G(watch_free), (zend_ulong) element->parent_container);
657 bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *element) { argument
663 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
665 char *oldPtr = ((char *) &element->backup.ht) + HT_WATCH_OFFSET;
667 phpdbg_print_watch_diff(WATCH_ON_HASHTABLE, element->str, oldPtr, htPtr);
670 phpdbg_add_ht_watch_element(parent, element);
671 } else if ((zv = zend_symtable_find(ht, element->name_in_parent))) {
672 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
682 if (!phpdbg_try_re_adding_watch_element(next, element->child)) {
685 } else if (phpdbg_check_watch_diff(WATCH_ON_ZVAL, &element->backup.zv, zv)) {
686 phpdbg_print_watch_diff(WATCH_ON_ZVAL, element->str, &element->backup.zv, zv);
689 element->parent_container = ht;
690 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
691 phpdbg_watch_parent_ht(element);
699 void phpdbg_automatic_dequeue_free(phpdbg_watch_element *element) { argument
700 phpdbg_watch_element *child = element;
708 phpdbg_free_watch_element_tree(element);
712 phpdbg_watch_element *element; local
714 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
715 …ZEND_ASSERT(element->flags & (PHPDBG_WATCH_IMPLICIT | PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_S…
716 …if (element->parent || zend_hash_index_find(&PHPDBG_G(watch_free), (zend_ulong) element->parent_co…
718 if (element->parent) {
719 …ZEND_ASSERT(element->parent->watch->type == WATCH_ON_ZVAL || element->parent->watch->type == WATCH…
720 zv = element->parent->watch->addr.zv;
726 ZVAL_ARR(zv, element->parent_container);
728 if (!phpdbg_try_re_adding_watch_element(zv, element)) {
729 phpdbg_automatic_dequeue_free(element);
732 phpdbg_automatic_dequeue_free(element);
741 void phpdbg_clean_watch_element(phpdbg_watch_element *element);
743 void phpdbg_free_watch_element(phpdbg_watch_element *element) { argument
744 zend_string_release(element->str);
745 if (element->name_in_parent) {
746 zend_string_release(element->name_in_parent);
748 efree(element);
752 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element) { argument
753 if (element->child) {
754 phpdbg_remove_watch_element_recursively(element->child);
755 phpdbg_free_watch_element(element->child);
756 element->child = NULL;
757 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
759 ZEND_HASH_FOREACH_PTR(&element->child_container, child) {
763 zend_hash_destroy(&element->child_container);
766 phpdbg_clean_watch_element(element);
770 void phpdbg_remove_watch_element(phpdbg_watch_element *element) { argument
771 phpdbg_watch_element *parent = element->parent, *child = element->child;
789 if (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) {
790 phpdbg_remove_watch_element_recursively(element);
792 phpdbg_clean_watch_element(element);
794 zend_hash_index_del(&PHPDBG_G(watch_elements), element->id);
795 phpdbg_free_watch_element(element);
798 void phpdbg_backup_watch_element(phpdbg_watch_element *element) { argument
799 …memcpy(&element->backup, &element->watch->backup, /* element->watch->size */ sizeof(element->backu…
803 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until) { argument
804 phpdbg_watch_element *child = element;
805 …ZEND_ASSERT((element->flags & (PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_RECURSIVE)) != PHPDBG_WA…
807 if (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) {
808 phpdbg_backup_watch_element(element);
809 phpdbg_remove_watch_element_recursively(element);
827 if (element->child == NULL) {
828 phpdbg_backup_watch_element(element);
830 phpdbg_clean_watch_element(element);
834 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element) { argument
835 phpdbg_watch_element *parent = element->parent, *child = element->child;
847 phpdbg_free_watch_element(element);
850 void phpdbg_update_watch_element_watch(phpdbg_watch_element *element) { argument
851 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
852 phpdbg_watch_element *child = element->child;
857 ZEND_ASSERT(element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET);
858 phpdbg_queue_element_for_recreation(element);
859 } else if (element->flags & (PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_SIMPLE)) {
860 phpdbg_queue_element_for_recreation(element);
861 } else if (element->flags & PHPDBG_WATCH_RECURSIVE) {
862 phpdbg_remove_watch_element_recursively(element);
863 if (element->parent->flags & (PHPDBG_WATCH_OBJECT | PHPDBG_WATCH_ARRAY)) {
864 zend_hash_del(&element->parent->child_container, element->str);
866 element->parent->child = NULL;
868 phpdbg_free_watch_element(element);
874 phpdbg_watch_element *element; local
880 ZEND_HASH_FOREACH_PTR(&parent->elements, element) {
881 phpdbg_update_watch_element_watch(element);
888 phpdbg_watch_element *element; local
900 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
901 phpdbg_update_watch_element_watch(element);
908 void phpdbg_clean_watch_element(phpdbg_watch_element *element) { argument
909 HashTable *elements = &element->watch->elements;
910 phpdbg_unwatch_parent_ht(element);
911 zend_hash_del(elements, element->str);
913 phpdbg_remove_watchpoint(element->watch);
920 phpdbg_watch_element *element; local
931 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
932 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
934 phpdbg_update_watch_element_watch(element->child);
938 name = element->str;
951 phpdbg_watch_element *element; local
955 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
956 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
970 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
971 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
972 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
1007 phpdbg_watch_element *element = NULL; local
1010 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
1014 ZEND_ASSERT(element); /* elements must be non-empty */
1015 new = zend_symtable_find(element->parent_container, element->name_in_parent);
1048 phpdbg_watch_element *element; local
1050 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
1051 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
1052 phpdbg_recurse_watch_element(element);
1136 phpdbg_watch_element *element; local
1139 ZEND_HASH_FOREACH_PTR(&hti->watches, element) {
1141 phpdbg_remove_watchpoint(element->watch);
1167 phpdbg_watch_element *element; local
1169 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_elements), element) {
1170 …) ZSTR_LEN(element->str), ZSTR_VAL(element->str), (element->flags & (PHPDBG_WATCH_ARRAY|PHPDBG_WAT…
1174 static int phpdbg_create_simple_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1175 element->flags = PHPDBG_WATCH_SIMPLE;
1176 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1180 static int phpdbg_create_array_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1192 str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
1193 zend_string_release(element->str);
1194 element->str = str;
1195 element->flags = PHPDBG_WATCH_IMPLICIT;
1196 phpdbg_add_bucket_watch_element((Bucket *) orig_zv, element);
1197 element->child = new;
1201 new->parent = element;
1206 static int phpdbg_create_recursive_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1207 element->flags = PHPDBG_WATCH_RECURSIVE | PHPDBG_WATCH_RECURSIVE_ROOT;
1208 element->child = NULL;
1209 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1217 phpdbg_watch_element *element = ecalloc(1, sizeof(phpdbg_watch_element)); local
1218 element->str = zend_string_init(name, namelen, 0);
1219 element->name_in_parent = zend_string_init(key, keylen, 0);
1220 element->parent_container = parent;
1221 element->parent = PHPDBG_G(watch_tmp);
1222 element->child = NULL;
1224 ret = info->callback(zv, element);
1230 phpdbg_remove_watch_element(element);
1233 PHPDBG_G(watch_tmp)->child = element;
1236 if (element->child) {
1237 element = element->child;
1241 zend_hash_next_index_insert_ptr(&PHPDBG_G(watch_elements), element);
1242 element->id = PHPDBG_G(watch_elements).nNextFreeElement - 1;
1244 … for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int)…
1257 phpdbg_watch_element *element; local
1266 element = ecalloc(1, sizeof(phpdbg_watch_element));
1267 element->flags = PHPDBG_WATCH_IMPLICIT;
1268 element->str = zend_string_copy(info->str);
1269 element->name_in_parent = zend_string_init(key, keylen, 0);
1270 element->parent_container = parent;
1271 element->parent = PHPDBG_G(watch_tmp);
1272 element = phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1278 PHPDBG_G(watch_tmp)->child = element;
1280 PHPDBG_G(watch_tmp) = element;
1314 phpdbg_watch_element *element; local
1317 if ((element = zend_hash_index_find_ptr(&PHPDBG_G(watch_elements), param->num))) {
1318 phpdbg_remove_watch_element(element);
1402 phpdbg_watch_element *element; local
1407 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
1408 phpdbg_automatic_dequeue_free(element);