Lines Matching refs:element

444 void phpdbg_recurse_watch_element(phpdbg_watch_element *element);
445 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element);
446 void phpdbg_free_watch_element(phpdbg_watch_element *element);
448 void phpdbg_watch_parent_ht(phpdbg_watch_element *element);
450 …atch_element *phpdbg_add_watch_element(phpdbg_watchpoint_t *watch, phpdbg_watch_element *element) { argument
465 if ((old_element = zend_hash_find_ptr(&watch->elements, element->str))) {
466 phpdbg_free_watch_element(element);
471 element->watch = watch;
472 zend_hash_add_ptr(&watch->elements, element->str, element);
474 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
475 phpdbg_recurse_watch_element(element);
478 return element;
481 phpdbg_watch_element *phpdbg_add_bucket_watch_element(Bucket *bucket, phpdbg_watch_element *element argument
484 element = phpdbg_add_watch_element(&watch, element);
485 phpdbg_watch_parent_ht(element);
486 return element;
489 phpdbg_watch_element *phpdbg_add_ht_watch_element(zval *zv, phpdbg_watch_element *element) { argument
497 element->flags |= Z_TYPE_P(zv) == IS_ARRAY ? PHPDBG_WATCH_ARRAY : PHPDBG_WATCH_OBJECT;
499 return phpdbg_add_watch_element(&watch, element);
502 zend_bool phpdbg_is_recursively_watched(void *ptr, phpdbg_watch_element *element) { argument
503 phpdbg_watch_element *next = element;
505 element = next;
506 if (element->watch->addr.ptr == ptr) {
509 next = element->parent;
510 } while (!(element->flags & PHPDBG_WATCH_RECURSIVE_ROOT));
515 void phpdbg_add_recursive_watch_from_ht(phpdbg_watch_element *element, zend_long idx, zend_string *… argument
517 if (phpdbg_is_recursively_watched(zv, element)) {
524 …r = strpprintf(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[%s]" : "%.*s->%s", (int) ZSTR_LEN(
526 …f(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[" ZEND_LONG_FMT "]" : "%.*s->" ZEND_LONG_FMT, (…
532 child->parent = element;
534 child->parent_container = HT_WATCH_HT(element->watch);
535 zend_hash_add_ptr(&element->child_container, child->str, child);
539 void phpdbg_recurse_watch_element(phpdbg_watch_element *element) { argument
543 if (element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET) {
544 zv = element->watch->addr.zv;
550 if (element->child) {
551 phpdbg_remove_watch_element_recursively(element->child);
555 || phpdbg_is_recursively_watched(HT_WATCH_OFFSET + (char *) HT_FROM_ZVP(zv), element)) {
556 if (element->child) {
557 phpdbg_free_watch_element(element->child);
558 element->child = NULL;
563 if (element->child) {
564 child = element->child;
568 child->str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
570 child->parent = element;
572 element->child = child;
576 } else if (zend_hash_num_elements(&element->child_container) == 0) {
580 ZEND_ASSERT(element->watch->type == WATCH_ON_HASHTABLE);
581 ZEND_HASH_FOREACH_KEY_VAL(HT_WATCH_HT(element->watch), idx, str, zv) {
582 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
587 void phpdbg_watch_parent_ht(phpdbg_watch_element *element) { argument
588 if (element->watch->type == WATCH_ON_BUCKET) {
592 ZEND_ASSERT(element->parent_container);
593 …if (!(res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->parent_container)…
595 hti->ht = element->parent_container;
613 zend_hash_add_ptr(&hti->watches, element->name_in_parent, element);
617 void phpdbg_unwatch_parent_ht(phpdbg_watch_element *element) { argument
618 if (element->watch->type == WATCH_ON_BUCKET) {
619 …phpdbg_btree_result *res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->pa…
620 ZEND_ASSERT(element->parent_container);
631 zend_hash_del(&hti->watches, element->name_in_parent);
640 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until);
641 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element);
643 void phpdbg_queue_element_for_recreation(phpdbg_watch_element *element) { argument
647 if ((prev = zend_hash_find_ptr(&PHPDBG_G(watch_recreation), element->str))) {
650 if (child == element) {
656 zend_hash_update_ptr(&PHPDBG_G(watch_recreation), element->str, element);
659 phpdbg_dissociate_watch_element(element, prev);
661 if (!element->parent) {
663 zend_hash_index_add_empty_element(&PHPDBG_G(watch_free), (zend_ulong) element->parent_container);
667 zend_bool phpdbg_try_readding_watch_element(zval *parent, phpdbg_watch_element *element) { argument
673 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
675 char *oldPtr = ((char *) &element->backup.ht) + HT_WATCH_OFFSET;
677 phpdbg_print_watch_diff(WATCH_ON_HASHTABLE, element->str, oldPtr, htPtr);
680 phpdbg_add_ht_watch_element(parent, element);
681 } else if ((zv = zend_symtable_find(ht, element->name_in_parent))) {
682 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
692 if (!phpdbg_try_readding_watch_element(next, element->child)) {
695 } else if (phpdbg_check_watch_diff(WATCH_ON_ZVAL, &element->backup.zv, zv)) {
696 phpdbg_print_watch_diff(WATCH_ON_ZVAL, element->str, &element->backup.zv, zv);
699 element->parent_container = ht;
700 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
701 phpdbg_watch_parent_ht(element);
709 void phpdbg_automatic_dequeue_free(phpdbg_watch_element *element) { argument
710 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; local
1019 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
1023 new = zend_symtable_find(element->parent_container, element->name_in_parent);
1056 phpdbg_watch_element *element; local
1058 ZEND_HASH_FOREACH_PTR(&watch->elements, element) {
1059 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
1060 phpdbg_recurse_watch_element(element);
1144 phpdbg_watch_element *element; local
1147 ZEND_HASH_FOREACH_PTR(&hti->watches, element) {
1149 phpdbg_remove_watchpoint(element->watch);
1175 phpdbg_watch_element *element; local
1179 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_elements), element) {
1180 …) ZSTR_LEN(element->str), ZSTR_VAL(element->str), (element->flags & (PHPDBG_WATCH_ARRAY|PHPDBG_WAT…
1186 static int phpdbg_create_simple_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1187 element->flags = PHPDBG_WATCH_SIMPLE;
1188 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1192 static int phpdbg_create_array_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1204 str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
1205 zend_string_release(element->str);
1206 element->str = str;
1207 element->flags = PHPDBG_WATCH_IMPLICIT;
1208 phpdbg_add_bucket_watch_element((Bucket *) orig_zv, element);
1209 element->child = new;
1213 new->parent = element;
1218 static int phpdbg_create_recursive_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1219 element->flags = PHPDBG_WATCH_RECURSIVE | PHPDBG_WATCH_RECURSIVE_ROOT;
1220 element->child = NULL;
1221 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1229 phpdbg_watch_element *element = ecalloc(1, sizeof(phpdbg_watch_element)); local
1230 element->str = zend_string_init(name, namelen, 0);
1231 element->name_in_parent = zend_string_init(key, keylen, 0);
1232 element->parent_container = parent;
1233 element->parent = PHPDBG_G(watch_tmp);
1234 element->child = NULL;
1236 ret = info->callback(zv, element);
1242 phpdbg_remove_watch_element(element);
1245 PHPDBG_G(watch_tmp)->child = element;
1248 if (element->child) {
1249 element = element->child;
1251 element->id = PHPDBG_G(watch_elements).nNextFreeElement;
1252 zend_hash_index_add_ptr(&PHPDBG_G(watch_elements), element->id, element);
1254 … for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int)…
1267 phpdbg_watch_element *element; local
1276 element = ecalloc(1, sizeof(phpdbg_watch_element));
1277 element->flags = PHPDBG_WATCH_IMPLICIT;
1278 element->str = zend_string_copy(info->str);
1279 element->name_in_parent = zend_string_init(key, keylen, 0);
1280 element->parent_container = parent;
1281 element->parent = PHPDBG_G(watch_tmp);
1282 element = phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1288 PHPDBG_G(watch_tmp)->child = element;
1290 PHPDBG_G(watch_tmp) = element;
1324 phpdbg_watch_element *element; local
1327 if ((element = zend_hash_index_find_ptr(&PHPDBG_G(watch_elements), param->num))) {
1328 phpdbg_remove_watch_element(element);
1410 phpdbg_watch_element *element; local
1415 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
1416 phpdbg_automatic_dequeue_free(element);