Lines Matching refs:element

443 void phpdbg_recurse_watch_element(phpdbg_watch_element *element);
444 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element);
445 void phpdbg_free_watch_element(phpdbg_watch_element *element);
447 void phpdbg_watch_parent_ht(phpdbg_watch_element *element);
449 …atch_element *phpdbg_add_watch_element(phpdbg_watchpoint_t *watch, phpdbg_watch_element *element) { argument
464 if ((old_element = zend_hash_find_ptr(&watch->elements, element->str))) {
465 phpdbg_free_watch_element(element);
470 element->watch = watch;
471 zend_hash_add_ptr(&watch->elements, element->str, element);
473 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
474 phpdbg_recurse_watch_element(element);
477 return element;
480 phpdbg_watch_element *phpdbg_add_bucket_watch_element(Bucket *bucket, phpdbg_watch_element *element argument
483 element = phpdbg_add_watch_element(&watch, element);
484 phpdbg_watch_parent_ht(element);
485 return element;
488 phpdbg_watch_element *phpdbg_add_ht_watch_element(zval *zv, phpdbg_watch_element *element) { argument
496 element->flags |= Z_TYPE_P(zv) == IS_ARRAY ? PHPDBG_WATCH_ARRAY : PHPDBG_WATCH_OBJECT;
498 return phpdbg_add_watch_element(&watch, element);
501 zend_bool phpdbg_is_recursively_watched(void *ptr, phpdbg_watch_element *element) { argument
502 phpdbg_watch_element *next = element;
504 element = next;
505 if (element->watch->addr.ptr == ptr) {
508 next = element->parent;
509 } while (!(element->flags & PHPDBG_WATCH_RECURSIVE_ROOT));
514 void phpdbg_add_recursive_watch_from_ht(phpdbg_watch_element *element, zend_long idx, zend_string *… argument
516 if (phpdbg_is_recursively_watched(zv, element)) {
523 …r = strpprintf(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[%s]" : "%.*s->%s", (int) ZSTR_LEN(
525 …f(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[" ZEND_LONG_FMT "]" : "%.*s->" ZEND_LONG_FMT, (…
531 child->parent = element;
533 child->parent_container = HT_WATCH_HT(element->watch);
534 zend_hash_add_ptr(&element->child_container, child->str, child);
538 void phpdbg_recurse_watch_element(phpdbg_watch_element *element) { argument
542 if (element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET) {
543 zv = element->watch->addr.zv;
549 if (element->child) {
550 phpdbg_remove_watch_element_recursively(element->child);
554 || phpdbg_is_recursively_watched(HT_WATCH_OFFSET + (char *) HT_FROM_ZVP(zv), element)) {
555 if (element->child) {
556 phpdbg_free_watch_element(element->child);
557 element->child = NULL;
562 if (element->child) {
563 child = element->child;
567 child->str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
569 child->parent = element;
571 element->child = child;
575 } else if (zend_hash_num_elements(&element->child_container) == 0) {
579 ZEND_ASSERT(element->watch->type == WATCH_ON_HASHTABLE);
580 ZEND_HASH_FOREACH_KEY_VAL(HT_WATCH_HT(element->watch), idx, str, zv) {
581 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
586 void phpdbg_watch_parent_ht(phpdbg_watch_element *element) { argument
587 if (element->watch->type == WATCH_ON_BUCKET) {
591 ZEND_ASSERT(element->parent_container);
592 …if (!(res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->parent_container)…
594 hti->ht = element->parent_container;
612 zend_hash_add_ptr(&hti->watches, element->name_in_parent, element);
616 void phpdbg_unwatch_parent_ht(phpdbg_watch_element *element) { argument
617 if (element->watch->type == WATCH_ON_BUCKET) {
618 …phpdbg_btree_result *res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->pa…
619 ZEND_ASSERT(element->parent_container);
630 zend_hash_del(&hti->watches, element->name_in_parent);
639 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until);
640 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element);
642 void phpdbg_queue_element_for_recreation(phpdbg_watch_element *element) { argument
646 if ((prev = zend_hash_find_ptr(&PHPDBG_G(watch_recreation), element->str))) {
649 if (child == element) {
655 zend_hash_update_ptr(&PHPDBG_G(watch_recreation), element->str, element);
658 phpdbg_dissociate_watch_element(element, prev);
660 if (!element->parent) {
662 zend_hash_index_add_empty_element(&PHPDBG_G(watch_free), (zend_ulong) element->parent_container);
666 zend_bool phpdbg_try_readding_watch_element(zval *parent, phpdbg_watch_element *element) { argument
672 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
674 char *oldPtr = ((char *) &element->backup.ht) + HT_WATCH_OFFSET;
676 phpdbg_print_watch_diff(WATCH_ON_HASHTABLE, element->str, oldPtr, htPtr);
679 phpdbg_add_ht_watch_element(parent, element);
680 } else if ((zv = zend_symtable_find(ht, element->name_in_parent))) {
681 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
691 if (!phpdbg_try_readding_watch_element(next, element->child)) {
694 } else if (phpdbg_check_watch_diff(WATCH_ON_ZVAL, &element->backup.zv, zv)) {
695 phpdbg_print_watch_diff(WATCH_ON_ZVAL, element->str, &element->backup.zv, zv);
698 element->parent_container = ht;
699 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
700 phpdbg_watch_parent_ht(element);
708 void phpdbg_automatic_dequeue_free(phpdbg_watch_element *element) { argument
709 phpdbg_watch_element *child = element;
717 phpdbg_free_watch_element_tree(element);
721 phpdbg_watch_element *element; local
723 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
724 …ZEND_ASSERT(element->flags & (PHPDBG_WATCH_IMPLICIT | PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_S…
725 …if (element->parent || zend_hash_index_find(&PHPDBG_G(watch_free), (zend_ulong) element->parent_co…
727 if (element->parent) {
728 …ZEND_ASSERT(element->parent->watch->type == WATCH_ON_ZVAL || element->parent->watch->type == WATCH…
729 zv = element->parent->watch->addr.zv;
735 ZVAL_ARR(zv, element->parent_container);
737 if (!phpdbg_try_readding_watch_element(zv, element)) {
738 phpdbg_automatic_dequeue_free(element);
741 phpdbg_automatic_dequeue_free(element);
750 void phpdbg_clean_watch_element(phpdbg_watch_element *element);
752 void phpdbg_free_watch_element(phpdbg_watch_element *element) { argument
753 zend_string_release(element->str);
754 if (element->name_in_parent) {
755 zend_string_release(element->name_in_parent);
757 efree(element);
761 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element) { argument
762 if (element->child) {
763 phpdbg_remove_watch_element_recursively(element->child);
764 phpdbg_free_watch_element(element->child);
765 element->child = NULL;
766 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
768 ZEND_HASH_FOREACH_PTR(&element->child_container, child) {
772 zend_hash_destroy(&element->child_container);
775 phpdbg_clean_watch_element(element);
779 void phpdbg_remove_watch_element(phpdbg_watch_element *element) { argument
780 phpdbg_watch_element *parent = element->parent, *child = element->child;
798 if (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) {
799 phpdbg_remove_watch_element_recursively(element);
801 phpdbg_clean_watch_element(element);
803 zend_hash_index_del(&PHPDBG_G(watch_elements), element->id);
804 phpdbg_free_watch_element(element);
807 void phpdbg_backup_watch_element(phpdbg_watch_element *element) { argument
808 …memcpy(&element->backup, &element->watch->backup, /* element->watch->size */ sizeof(element->backu…
812 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until) { argument
813 phpdbg_watch_element *child = element;
814 …ZEND_ASSERT((element->flags & (PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_RECURSIVE)) != PHPDBG_WA…
816 if (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) {
817 phpdbg_backup_watch_element(element);
818 phpdbg_remove_watch_element_recursively(element);
836 if (element->child == NULL) {
837 phpdbg_backup_watch_element(element);
839 phpdbg_clean_watch_element(element);
843 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element) { argument
844 phpdbg_watch_element *parent = element->parent, *child = element->child;
856 phpdbg_free_watch_element(element);
859 void phpdbg_update_watch_element_watch(phpdbg_watch_element *element) { argument
860 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
861 phpdbg_watch_element *child = element->child;
866 ZEND_ASSERT(element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET);
867 phpdbg_queue_element_for_recreation(element);
868 } else if (element->flags & (PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_SIMPLE)) {
869 phpdbg_queue_element_for_recreation(element);
870 } else if (element->flags & PHPDBG_WATCH_RECURSIVE) {
871 phpdbg_remove_watch_element_recursively(element);
872 if (element->parent->flags & (PHPDBG_WATCH_OBJECT | PHPDBG_WATCH_ARRAY)) {
873 zend_hash_del(&element->parent->child_container, element->str);
875 element->parent->child = NULL;
877 phpdbg_free_watch_element(element);
883 phpdbg_watch_element *element; local
889 ZEND_HASH_FOREACH_PTR(&parent->elements, element) {
890 phpdbg_update_watch_element_watch(element);
897 phpdbg_watch_element *element; local
909 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
910 phpdbg_update_watch_element_watch(element);
917 void phpdbg_clean_watch_element(phpdbg_watch_element *element) { argument
918 HashTable *elements = &element->watch->elements;
919 phpdbg_unwatch_parent_ht(element);
920 zend_hash_del(elements, element->str);
922 phpdbg_remove_watchpoint(element->watch);
929 phpdbg_watch_element *element; local
940 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
941 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
943 phpdbg_update_watch_element_watch(element->child);
947 name = element->str;
960 phpdbg_watch_element *element; local
964 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
965 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
979 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
980 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
981 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
1016 phpdbg_watch_element *element = NULL; local
1019 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
1023 ZEND_ASSERT(element); /* elements must be non-empty */
1024 new = zend_symtable_find(element->parent_container, element->name_in_parent);
1057 phpdbg_watch_element *element; local
1059 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
1060 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
1061 phpdbg_recurse_watch_element(element);
1145 phpdbg_watch_element *element; local
1148 ZEND_HASH_FOREACH_PTR(&hti->watches, element) {
1150 phpdbg_remove_watchpoint(element->watch);
1176 phpdbg_watch_element *element; local
1180 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_elements), element) {
1181 …) ZSTR_LEN(element->str), ZSTR_VAL(element->str), (element->flags & (PHPDBG_WATCH_ARRAY|PHPDBG_WAT…
1187 static int phpdbg_create_simple_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1188 element->flags = PHPDBG_WATCH_SIMPLE;
1189 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1193 static int phpdbg_create_array_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1205 str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
1206 zend_string_release(element->str);
1207 element->str = str;
1208 element->flags = PHPDBG_WATCH_IMPLICIT;
1209 phpdbg_add_bucket_watch_element((Bucket *) orig_zv, element);
1210 element->child = new;
1214 new->parent = element;
1219 static int phpdbg_create_recursive_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1220 element->flags = PHPDBG_WATCH_RECURSIVE | PHPDBG_WATCH_RECURSIVE_ROOT;
1221 element->child = NULL;
1222 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1230 phpdbg_watch_element *element = ecalloc(1, sizeof(phpdbg_watch_element)); local
1231 element->str = zend_string_init(name, namelen, 0);
1232 element->name_in_parent = zend_string_init(key, keylen, 0);
1233 element->parent_container = parent;
1234 element->parent = PHPDBG_G(watch_tmp);
1235 element->child = NULL;
1237 ret = info->callback(zv, element);
1243 phpdbg_remove_watch_element(element);
1246 PHPDBG_G(watch_tmp)->child = element;
1249 if (element->child) {
1250 element = element->child;
1254 zend_hash_next_index_insert_ptr(&PHPDBG_G(watch_elements), element);
1255 element->id = PHPDBG_G(watch_elements).nNextFreeElement - 1;
1257 … for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int)…
1270 phpdbg_watch_element *element; local
1279 element = ecalloc(1, sizeof(phpdbg_watch_element));
1280 element->flags = PHPDBG_WATCH_IMPLICIT;
1281 element->str = zend_string_copy(info->str);
1282 element->name_in_parent = zend_string_init(key, keylen, 0);
1283 element->parent_container = parent;
1284 element->parent = PHPDBG_G(watch_tmp);
1285 element = phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1291 PHPDBG_G(watch_tmp)->child = element;
1293 PHPDBG_G(watch_tmp) = element;
1327 phpdbg_watch_element *element; local
1330 if ((element = zend_hash_index_find_ptr(&PHPDBG_G(watch_elements), param->num))) {
1331 phpdbg_remove_watch_element(element);
1415 phpdbg_watch_element *element; local
1420 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
1421 phpdbg_automatic_dequeue_free(element);