Lines Matching refs:element
497 void phpdbg_recurse_watch_element(phpdbg_watch_element *element);
498 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element);
499 void phpdbg_free_watch_element(phpdbg_watch_element *element);
501 void phpdbg_watch_parent_ht(phpdbg_watch_element *element);
503 …atch_element *phpdbg_add_watch_element(phpdbg_watchpoint_t *watch, phpdbg_watch_element *element) { argument
518 if ((old_element = zend_hash_find_ptr(&watch->elements, element->str))) {
519 if (element != old_element) {
520 phpdbg_free_watch_element(element);
526 element->watch = watch;
527 zend_hash_add_ptr(&watch->elements, element->str, element);
529 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
530 phpdbg_recurse_watch_element(element);
533 return element;
536 phpdbg_watch_element *phpdbg_add_bucket_watch_element(Bucket *bucket, phpdbg_watch_element *element… argument
539 element = phpdbg_add_watch_element(&watch, element);
540 phpdbg_watch_parent_ht(element);
541 return element;
544 phpdbg_watch_element *phpdbg_add_ht_watch_element(zval *zv, phpdbg_watch_element *element) { argument
552 element->flags |= Z_TYPE_P(zv) == IS_ARRAY ? PHPDBG_WATCH_ARRAY : PHPDBG_WATCH_OBJECT;
554 return phpdbg_add_watch_element(&watch, element);
557 bool phpdbg_is_recursively_watched(void *ptr, phpdbg_watch_element *element) { argument
558 phpdbg_watch_element *next = element;
560 element = next;
561 if (element->watch->addr.ptr == ptr) {
564 next = element->parent;
565 } while (!(element->flags & PHPDBG_WATCH_RECURSIVE_ROOT));
570 void phpdbg_add_recursive_watch_from_ht(phpdbg_watch_element *element, zend_long idx, zend_string *… argument
572 if (phpdbg_is_recursively_watched(zv, element)) {
579 …r = strpprintf(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[%s]" : "%.*s->%s", (int) ZSTR_LEN(…
581 …f(0, (element->flags & PHPDBG_WATCH_ARRAY) ? "%.*s[" ZEND_LONG_FMT "]" : "%.*s->" ZEND_LONG_FMT, (…
587 child->parent = element;
589 child->parent_container = HT_WATCH_HT(element->watch);
590 zend_hash_add_ptr(&element->child_container, child->str, child);
594 void phpdbg_recurse_watch_element(phpdbg_watch_element *element) { argument
598 if (element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET) {
599 zv = element->watch->addr.zv;
605 if (element->child) {
606 phpdbg_remove_watch_element_recursively(element->child);
610 || phpdbg_is_recursively_watched(HT_WATCH_OFFSET + (char *) HT_FROM_ZVP(zv), element)) {
611 if (element->child) {
612 phpdbg_free_watch_element(element->child);
613 element->child = NULL;
618 if (element->child) {
619 child = element->child;
623 child->str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
625 child->parent = element;
627 element->child = child;
631 } else if (zend_hash_num_elements(&element->child_container) == 0) {
635 ZEND_ASSERT(element->watch->type == WATCH_ON_HASHTABLE);
636 ZEND_HASH_FOREACH_KEY_VAL(HT_WATCH_HT(element->watch), idx, str, zv) {
637 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
642 void phpdbg_watch_parent_ht(phpdbg_watch_element *element) { argument
643 if (element->watch->type == WATCH_ON_BUCKET) {
647 ZEND_ASSERT(element->parent_container);
648 …if (!(res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->parent_container)…
650 hti->ht = element->parent_container;
668 zend_hash_add_ptr(&hti->watches, element->name_in_parent, element);
672 void phpdbg_unwatch_parent_ht(phpdbg_watch_element *element) { argument
673 if (element->watch && element->watch->type == WATCH_ON_BUCKET) {
674 …phpdbg_btree_result *res = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) element->pa…
675 ZEND_ASSERT(element->parent_container);
686 zend_hash_del(&hti->watches, element->name_in_parent);
695 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until);
696 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element);
698 void phpdbg_queue_element_for_recreation(phpdbg_watch_element *element) { argument
702 if ((prev = zend_hash_find_ptr(&PHPDBG_G(watch_recreation), element->str))) {
705 if (child == element) {
711 zend_hash_update_ptr(&PHPDBG_G(watch_recreation), element->str, element);
714 phpdbg_dissociate_watch_element(element, prev);
716 if (!element->parent) {
718 zend_hash_index_add_empty_element(&PHPDBG_G(watch_free), (zend_ulong) element->parent_container);
722 bool phpdbg_try_re_adding_watch_element(zval *parent, phpdbg_watch_element *element) { argument
728 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
730 char *oldPtr = ((char *) &element->backup.ht) + HT_WATCH_OFFSET;
732 phpdbg_print_watch_diff(WATCH_ON_HASHTABLE, element->str, oldPtr, htPtr);
735 phpdbg_add_ht_watch_element(parent, element);
736 } else if ((zv = zend_symtable_find(ht, element->name_in_parent))) {
737 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
747 if (!phpdbg_try_re_adding_watch_element(next, element->child)) {
750 } else if (phpdbg_check_watch_diff(WATCH_ON_ZVAL, &element->backup.zv, zv)) {
751 phpdbg_print_watch_diff(WATCH_ON_ZVAL, element->str, &element->backup.zv, zv);
754 element->parent_container = ht;
755 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
756 phpdbg_watch_parent_ht(element);
764 void phpdbg_automatic_dequeue_free(phpdbg_watch_element *element) { argument
765 phpdbg_watch_element *child = element;
773 phpdbg_free_watch_element_tree(element);
777 phpdbg_watch_element *element; local
779 ZEND_HASH_MAP_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
780 …ZEND_ASSERT(element->flags & (PHPDBG_WATCH_IMPLICIT | PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_S…
781 …if (element->parent || zend_hash_index_find(&PHPDBG_G(watch_free), (zend_ulong) element->parent_co…
783 if (element->parent) {
784 …ZEND_ASSERT(element->parent->watch->type == WATCH_ON_ZVAL || element->parent->watch->type == WATCH…
785 zv = element->parent->watch->addr.zv;
791 ZVAL_ARR(zv, element->parent_container);
793 if (!phpdbg_try_re_adding_watch_element(zv, element)) {
794 phpdbg_automatic_dequeue_free(element);
797 phpdbg_automatic_dequeue_free(element);
806 void phpdbg_clean_watch_element(phpdbg_watch_element *element);
808 void phpdbg_free_watch_element(phpdbg_watch_element *element) { argument
809 zend_string_release(element->str);
810 if (element->name_in_parent) {
811 zend_string_release(element->name_in_parent);
813 efree(element);
817 void phpdbg_remove_watch_element_recursively(phpdbg_watch_element *element) { argument
818 if (element->child) {
819 phpdbg_remove_watch_element_recursively(element->child);
820 phpdbg_free_watch_element(element->child);
821 element->child = NULL;
822 } else if (element->flags & (PHPDBG_WATCH_ARRAY | PHPDBG_WATCH_OBJECT)) {
824 ZEND_HASH_MAP_FOREACH_PTR(&element->child_container, child) {
828 zend_hash_destroy(&element->child_container);
831 phpdbg_clean_watch_element(element);
835 void phpdbg_remove_watch_element(phpdbg_watch_element *element) { argument
836 phpdbg_watch_element *parent = element->parent, *child = element->child;
854 if (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) {
855 phpdbg_remove_watch_element_recursively(element);
857 phpdbg_clean_watch_element(element);
859 zend_hash_index_del(&PHPDBG_G(watch_elements), element->id);
860 phpdbg_free_watch_element(element);
863 void phpdbg_backup_watch_element(phpdbg_watch_element *element) { argument
864 …memcpy(&element->backup, &element->watch->backup, /* element->watch->size */ sizeof(element->backu…
868 void phpdbg_dissociate_watch_element(phpdbg_watch_element *element, phpdbg_watch_element *until) { argument
869 phpdbg_watch_element *child = element;
870 …ZEND_ASSERT((element->flags & (PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_RECURSIVE)) != PHPDBG_WA…
872 if (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) {
873 phpdbg_backup_watch_element(element);
874 phpdbg_remove_watch_element_recursively(element);
892 if (element->child == NULL) {
893 phpdbg_backup_watch_element(element);
895 phpdbg_clean_watch_element(element);
899 void phpdbg_free_watch_element_tree(phpdbg_watch_element *element) { argument
900 phpdbg_watch_element *parent = element->parent, *child = element->child;
912 phpdbg_free_watch_element(element);
915 void phpdbg_update_watch_element_watch(phpdbg_watch_element *element) { argument
916 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
917 phpdbg_watch_element *child = element->child;
922 ZEND_ASSERT(element->watch->type == WATCH_ON_ZVAL || element->watch->type == WATCH_ON_BUCKET);
923 phpdbg_queue_element_for_recreation(element);
924 } else if (element->flags & (PHPDBG_WATCH_RECURSIVE_ROOT | PHPDBG_WATCH_SIMPLE)) {
925 phpdbg_queue_element_for_recreation(element);
926 } else if (element->flags & PHPDBG_WATCH_RECURSIVE) {
927 phpdbg_remove_watch_element_recursively(element);
928 if (element->parent->flags & (PHPDBG_WATCH_OBJECT | PHPDBG_WATCH_ARRAY)) {
929 zend_hash_del(&element->parent->child_container, element->str);
931 element->parent->child = NULL;
933 phpdbg_free_watch_element(element);
939 phpdbg_watch_element *element; local
945 ZEND_HASH_MAP_FOREACH_PTR(&parent->elements, element) {
946 phpdbg_update_watch_element_watch(element);
953 phpdbg_watch_element *element; local
965 ZEND_HASH_MAP_FOREACH_PTR(&watch->elements, element) {
966 phpdbg_update_watch_element_watch(element);
973 void phpdbg_clean_watch_element(phpdbg_watch_element *element) { argument
974 phpdbg_unwatch_parent_ht(element);
976 if (element->watch) {
977 HashTable *elements = &element->watch->elements;
978 zend_hash_del(elements, element->str);
980 phpdbg_remove_watchpoint(element->watch);
988 phpdbg_watch_element *element; local
999 ZEND_HASH_MAP_FOREACH_PTR(&watch->elements, element) {
1000 if (element->flags & PHPDBG_WATCH_IMPLICIT) {
1002 phpdbg_update_watch_element_watch(element->child);
1006 name = element->str;
1019 phpdbg_watch_element *element; local
1023 ZEND_HASH_MAP_FOREACH_PTR(&watch->elements, element) {
1024 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
1038 ZEND_HASH_MAP_FOREACH_PTR(&watch->elements, element) {
1039 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
1040 phpdbg_add_recursive_watch_from_ht(element, idx, str, zv);
1075 phpdbg_watch_element *element = NULL; local
1078 ZEND_HASH_MAP_FOREACH_PTR(&watch->elements, element) {
1082 ZEND_ASSERT(element); /* elements must be non-empty */
1083 new = zend_symtable_find(element->parent_container, element->name_in_parent);
1116 phpdbg_watch_element *element; local
1118 ZEND_HASH_MAP_FOREACH_PTR(&watch->elements, element) {
1119 if (element->flags & PHPDBG_WATCH_RECURSIVE) {
1120 phpdbg_recurse_watch_element(element);
1218 phpdbg_watch_element *element; local
1221 ZEND_HASH_MAP_FOREACH_PTR(&hti->watches, element) {
1223 phpdbg_remove_watchpoint(element->watch);
1249 phpdbg_watch_element *element; local
1251 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watch_elements), element) {
1252 …) ZSTR_LEN(element->str), ZSTR_VAL(element->str), (element->flags & (PHPDBG_WATCH_ARRAY|PHPDBG_WAT…
1256 static int phpdbg_create_simple_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1257 element->flags = PHPDBG_WATCH_SIMPLE;
1258 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1262 static int phpdbg_create_array_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1274 str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(element->str), ZSTR_VAL(element->str));
1275 zend_string_release(element->str);
1276 element->str = str;
1277 element->flags = PHPDBG_WATCH_IMPLICIT;
1278 phpdbg_add_bucket_watch_element((Bucket *) orig_zv, element);
1279 element->child = new;
1283 new->parent = element;
1288 static int phpdbg_create_recursive_watchpoint(zval *zv, phpdbg_watch_element *element) { argument
1289 element->flags = PHPDBG_WATCH_RECURSIVE | PHPDBG_WATCH_RECURSIVE_ROOT;
1290 element->child = NULL;
1291 phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1299 phpdbg_watch_element *element = ecalloc(1, sizeof(phpdbg_watch_element)); local
1300 element->str = zend_string_init(name, namelen, 0);
1301 element->name_in_parent = zend_string_init(key, keylen, 0);
1302 element->parent_container = parent;
1303 element->parent = PHPDBG_G(watch_tmp);
1304 element->child = NULL;
1306 ret = info->callback(zv, element);
1312 phpdbg_remove_watch_element(element);
1315 PHPDBG_G(watch_tmp)->child = element;
1318 if (element->child) {
1319 element = element->child;
1323 zend_hash_next_index_insert_ptr(&PHPDBG_G(watch_elements), element);
1324 element->id = PHPDBG_G(watch_elements).nNextFreeElement - 1;
1326 … for %.*s", (element->flags & PHPDBG_WATCH_RECURSIVE_ROOT) ? " recursive" : "", element->id, (int)…
1339 phpdbg_watch_element *element; local
1348 element = ecalloc(1, sizeof(phpdbg_watch_element));
1349 element->flags = PHPDBG_WATCH_IMPLICIT;
1350 element->str = zend_string_copy(info->str);
1351 element->name_in_parent = zend_string_init(key, keylen, 0);
1352 element->parent_container = parent;
1353 element->parent = PHPDBG_G(watch_tmp);
1354 element = phpdbg_add_bucket_watch_element((Bucket *) zv, element);
1360 PHPDBG_G(watch_tmp)->child = element;
1362 PHPDBG_G(watch_tmp) = element;
1396 phpdbg_watch_element *element; local
1399 if ((element = zend_hash_index_find_ptr(&PHPDBG_G(watch_elements), param->num))) {
1400 phpdbg_remove_watch_element(element);
1503 phpdbg_watch_element *element; local
1506 ZEND_HASH_MAP_FOREACH_PTR(&PHPDBG_G(watch_recreation), element) {
1507 phpdbg_automatic_dequeue_free(element);