Lines Matching refs:watch
97 #define HT_WATCH_HT(watch) HT_PTR_HT((watch)->addr.ptr) argument
111 phpdbg_watchpoint_t *watch; in phpdbg_check_for_watchpoint() local
118 watch = result->ptr; in phpdbg_check_for_watchpoint()
121 …undary(watch->addr.ptr) > (char *) addr || (char *) phpdbg_get_page_boundary(watch->addr.ptr) + ph… in phpdbg_check_for_watchpoint()
126 return watch; in phpdbg_check_for_watchpoint()
129 static void phpdbg_change_watchpoint_access(phpdbg_watchpoint_t *watch, int access) { in phpdbg_change_watchpoint_access() argument
131 …mprotect(phpdbg_get_page_boundary(watch->addr.ptr), phpdbg_get_total_page_size(watch->addr.ptr, wa… in phpdbg_change_watchpoint_access()
134 static inline void phpdbg_activate_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_activate_watchpoint() argument
135 phpdbg_change_watchpoint_access(watch, PROT_READ); in phpdbg_activate_watchpoint()
138 static inline void phpdbg_deactivate_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_deactivate_watchpoint() argument
139 phpdbg_change_watchpoint_access(watch, PROT_READ | PROT_WRITE); in phpdbg_deactivate_watchpoint()
142 static inline void phpdbg_store_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_store_watchpoint() argument
143 phpdbg_btree_insert(&PHPDBG_G(watchpoint_tree), (zend_ulong) watch->addr.ptr, watch); in phpdbg_store_watchpoint()
146 static inline void phpdbg_remove_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_remove_watchpoint() argument
147 phpdbg_btree_delete(&PHPDBG_G(watchpoint_tree), (zend_ulong) watch->addr.ptr); in phpdbg_remove_watchpoint()
150 void phpdbg_create_addr_watchpoint(void *addr, size_t size, phpdbg_watchpoint_t *watch) { in phpdbg_create_addr_watchpoint() argument
151 watch->addr.ptr = addr; in phpdbg_create_addr_watchpoint()
152 watch->size = size; in phpdbg_create_addr_watchpoint()
155 void phpdbg_create_zval_watchpoint(zval *zv, phpdbg_watchpoint_t *watch) { in phpdbg_create_zval_watchpoint() argument
156 phpdbg_create_addr_watchpoint(zv, sizeof(zval), watch); in phpdbg_create_zval_watchpoint()
157 watch->type = WATCH_ON_ZVAL; in phpdbg_create_zval_watchpoint()
160 void phpdbg_create_ht_watchpoint(HashTable *ht, phpdbg_watchpoint_t *watch) { in phpdbg_create_ht_watchpoint() argument
161 …reate_addr_watchpoint(((char *) ht) + HT_WATCH_OFFSET, sizeof(HashTable) - HT_WATCH_OFFSET, watch); in phpdbg_create_ht_watchpoint()
162 watch->type = WATCH_ON_HASHTABLE; in phpdbg_create_ht_watchpoint()
163 watch->implicit_ht_count = 0; in phpdbg_create_ht_watchpoint()
166 static int phpdbg_create_recursive_ht_watch(phpdbg_watchpoint_t *watch);
167 static int phpdbg_create_recursive_zval_watch(phpdbg_watchpoint_t *watch);
171 static void phpdbg_free_watch(phpdbg_watchpoint_t *watch) { in phpdbg_free_watch() argument
172 zend_string_release(watch->str); in phpdbg_free_watch()
173 zend_string_release(watch->name_in_parent); in phpdbg_free_watch()
177 static void phpdbg_delete_ht_watchpoints_recursive(phpdbg_watchpoint_t *watch);
178 static void phpdbg_delete_zval_watchpoints_recursive(phpdbg_watchpoint_t *watch);
179 static void phpdbg_delete_watchpoints_recursive(phpdbg_watchpoint_t *watch);
183 phpdbg_watchpoint_t *watch = emalloc(sizeof(phpdbg_watchpoint_t)); in phpdbg_create_refcounted_watchpoint() local
184 watch->flags = parent->flags; in phpdbg_create_refcounted_watchpoint()
185 watch->parent = parent; in phpdbg_create_refcounted_watchpoint()
186 watch->str = parent->str; in phpdbg_create_refcounted_watchpoint()
188 phpdbg_create_addr_watchpoint(&GC_REFCOUNT(ref), sizeof(uint32_t), watch); in phpdbg_create_refcounted_watchpoint()
189 watch->type = WATCH_ON_REFCOUNTED; in phpdbg_create_refcounted_watchpoint()
191 return watch; in phpdbg_create_refcounted_watchpoint()
195 static void phpdbg_add_watch_collision(phpdbg_watchpoint_t *watch) { in phpdbg_add_watch_collision() argument
199 …ZEND_ASSERT(((watch->flags & PHPDBG_WATCH_RECURSIVE) == 0) ^ ((watch->flags & (PHPDBG_WATCH_IMPLIC… in phpdbg_add_watch_collision()
201 if ((cur = zend_hash_index_find_ptr(&PHPDBG_G(watch_collisions), (zend_ulong) watch->addr.ref))) { in phpdbg_add_watch_collision()
204 …(old = zend_hash_find_ptr(&cur->watches, watch->str)) || (old = zend_hash_find_ptr(&cur->implicit_… in phpdbg_add_watch_collision()
205 if (((old->flags ^ watch->flags) & (PHPDBG_WATCH_NORMAL|PHPDBG_WATCH_IMPLICIT)) == 0) { in phpdbg_add_watch_collision()
212 if (!(watch->flags & PHPDBG_WATCH_RECURSIVE) && !--cur->refs) { in phpdbg_add_watch_collision()
213 phpdbg_delete_watchpoints_recursive(watch); in phpdbg_add_watch_collision()
217 zend_hash_del(&cur->watches, watch->str); in phpdbg_add_watch_collision()
219 cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->watches, NULL)); in phpdbg_add_watch_collision()
221 cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->implicit_watches, NULL)); in phpdbg_add_watch_collision()
225 zend_hash_del(&cur->implicit_watches, watch->str); in phpdbg_add_watch_collision()
228 old->flags = watch->flags; in phpdbg_add_watch_collision()
229 phpdbg_free_watch(watch); in phpdbg_add_watch_collision()
230 efree(watch); in phpdbg_add_watch_collision()
231 watch = old; in phpdbg_add_watch_collision()
233 if (watch->flags & PHPDBG_WATCH_RECURSIVE) { in phpdbg_add_watch_collision()
235 phpdbg_create_recursive_zval_watch(watch->parent); in phpdbg_add_watch_collision()
240 coll.refs = (watch->flags & PHPDBG_WATCH_RECURSIVE) != 0; in phpdbg_add_watch_collision()
241 coll.watch = watch; in phpdbg_add_watch_collision()
244 …cur = zend_hash_index_add_mem(&PHPDBG_G(watch_collisions), (zend_ulong) watch->addr.ref, &coll, si… in phpdbg_add_watch_collision()
245 phpdbg_store_watchpoint(cur->watch); in phpdbg_add_watch_collision()
246 phpdbg_activate_watchpoint(cur->watch); in phpdbg_add_watch_collision()
248 phpdbg_create_recursive_zval_watch(watch->parent); in phpdbg_add_watch_collision()
252 if (watch->flags & PHPDBG_WATCH_NORMAL) { in phpdbg_add_watch_collision()
253 cur->watch = watch; in phpdbg_add_watch_collision()
254 zend_hash_add_ptr(&cur->watches, watch->str, watch->parent); in phpdbg_add_watch_collision()
256 if (watch->flags & PHPDBG_WATCH_IMPLICIT) { in phpdbg_add_watch_collision()
257 zend_hash_add_ptr(&cur->implicit_watches, watch->str, watch->parent); in phpdbg_add_watch_collision()
261 static void phpdbg_remove_watch_collision(phpdbg_watchpoint_t *watch) { in phpdbg_remove_watch_collision() argument
263 …if ((cur = zend_hash_index_find_ptr(&PHPDBG_G(watch_collisions), (zend_ulong) Z_COUNTED_P(watch->a… in phpdbg_remove_watch_collision()
265 phpdbg_delete_watchpoints_recursive(watch); in phpdbg_remove_watch_collision()
268 zend_hash_del(&cur->watches, watch->str); in phpdbg_remove_watch_collision()
269 zend_hash_del(&cur->implicit_watches, watch->str); in phpdbg_remove_watch_collision()
272 cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->watches, NULL)); in phpdbg_remove_watch_collision()
274 cur->watch = Z_PTR_P(zend_hash_get_current_data_ex(&cur->implicit_watches, NULL)); in phpdbg_remove_watch_collision()
276 phpdbg_deactivate_watchpoint(cur->watch); in phpdbg_remove_watch_collision()
277 phpdbg_remove_watchpoint(cur->watch); in phpdbg_remove_watch_collision()
279 zend_hash_index_del(&PHPDBG_G(watch_collisions), (zend_ulong) Z_COUNTED_P(watch->addr.zv)); in phpdbg_remove_watch_collision()
284 static phpdbg_watchpoint_t *phpdbg_create_watchpoint(phpdbg_watchpoint_t *watch);
286 static phpdbg_watchpoint_t *phpdbg_create_reference_watch(phpdbg_watchpoint_t *watch) { in phpdbg_create_reference_watch() argument
288 watch->reference = ref; in phpdbg_create_reference_watch()
289 ref->flags = watch->flags; in phpdbg_create_reference_watch()
290 ref->str = watch->str; in phpdbg_create_reference_watch()
292 ref->parent = watch; in phpdbg_create_reference_watch()
294 phpdbg_create_zval_watchpoint(Z_REFVAL_P(watch->addr.zv), ref); in phpdbg_create_reference_watch()
322 static phpdbg_watchpoint_t *phpdbg_create_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_create_watchpoint() argument
323 phpdbg_watchpoint_t *ret = watch; in phpdbg_create_watchpoint()
325 if (watch->type == WATCH_ON_ZVAL) { in phpdbg_create_watchpoint()
326 switch (Z_TYPE_P(watch->addr.zv)) { in phpdbg_create_watchpoint()
331 memset(watch->addr.zv, 0, sizeof(zend_value)); in phpdbg_create_watchpoint()
336 if (!watch->parent || watch->parent->type != WATCH_ON_ZVAL || watch->type == WATCH_ON_HASHTABLE) { in phpdbg_create_watchpoint()
337 phpdbg_watchpoint_t *old_watch = zend_hash_find_ptr(&PHPDBG_G(watchpoints), watch->str); in phpdbg_create_watchpoint()
345 if (watch != old_watch) { \ in phpdbg_create_watchpoint()
346 phpdbg_free_watch(watch); \ in phpdbg_create_watchpoint()
347 efree(watch); \ in phpdbg_create_watchpoint()
351 if (watch->flags & PHPDBG_WATCH_RECURSIVE) { in phpdbg_create_watchpoint()
361 old_watch->flags |= watch->flags & (PHPDBG_WATCH_IMPLICIT | PHPDBG_WATCH_SIMPLE); in phpdbg_create_watchpoint()
366 if (watch->parent && watch->parent->type == WATCH_ON_HASHTABLE) { in phpdbg_create_watchpoint()
367 watch->parent->implicit_ht_count++; in phpdbg_create_watchpoint()
369 zend_hash_add_ptr(&PHPDBG_G(watchpoints), watch->str, watch); in phpdbg_create_watchpoint()
373 phpdbg_store_watchpoint(watch); in phpdbg_create_watchpoint()
375 …if (watch->parent && watch->parent->type == WATCH_ON_ZVAL && Z_REFCOUNTED_P(watch->parent->addr.zv… in phpdbg_create_watchpoint()
376 …phpdbg_add_watch_collision(phpdbg_create_refcounted_watchpoint(watch, Z_COUNTED_P(watch->parent->a… in phpdbg_create_watchpoint()
379 if (watch->type == WATCH_ON_ZVAL) { in phpdbg_create_watchpoint()
380 if (watch->parent_container) { in phpdbg_create_watchpoint()
383 …if (!(find = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) watch->parent_container))… in phpdbg_create_watchpoint()
385 hti->dtor = watch->parent_container->pDestructor; in phpdbg_create_watchpoint()
388 phpdbg_btree_insert(&PHPDBG_G(watch_HashTables), (zend_ulong) watch->parent_container, hti); in phpdbg_create_watchpoint()
389 watch->parent_container->pDestructor = (dtor_func_t) phpdbg_watch_HashTable_dtor; in phpdbg_create_watchpoint()
393 zend_hash_add_ptr(ht_watches, watch->name_in_parent, watch); in phpdbg_create_watchpoint()
396 if (Z_ISREF_P(watch->addr.zv)) { in phpdbg_create_watchpoint()
397 ret = phpdbg_create_reference_watch(watch); in phpdbg_create_watchpoint()
401 phpdbg_activate_watchpoint(watch); in phpdbg_create_watchpoint()
406 static int phpdbg_create_simple_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_create_simple_watchpoint() argument
407 watch->flags |= PHPDBG_WATCH_SIMPLE; in phpdbg_create_simple_watchpoint()
409 phpdbg_create_watchpoint(watch); in phpdbg_create_simple_watchpoint()
416 phpdbg_watchpoint_t *watch = emalloc(sizeof(phpdbg_watchpoint_t)); in phpdbg_create_array_watchpoint() local
419 watch->parent = zv_watch; in phpdbg_create_array_watchpoint()
425 phpdbg_create_ht_watchpoint(ht, watch); in phpdbg_create_array_watchpoint()
427 if (phpdbg_create_watchpoint(watch) == NULL) { in phpdbg_create_array_watchpoint()
432 watch->flags |= PHPDBG_WATCH_ARRAY; in phpdbg_create_array_watchpoint()
434 watch->flags |= PHPDBG_WATCH_OBJECT; in phpdbg_create_array_watchpoint()
437 phpdbg_add_watch_collision(phpdbg_create_refcounted_watchpoint(watch, Z_COUNTED_P(zv))); in phpdbg_create_array_watchpoint()
442 static int phpdbg_create_recursive_watchpoint(phpdbg_watchpoint_t *watch) { in phpdbg_create_recursive_watchpoint() argument
443 if (watch->type != WATCH_ON_ZVAL) { in phpdbg_create_recursive_watchpoint()
447 watch->flags |= PHPDBG_WATCH_RECURSIVE; in phpdbg_create_recursive_watchpoint()
448 watch = phpdbg_create_watchpoint(watch); in phpdbg_create_recursive_watchpoint()
453 static int phpdbg_create_recursive_ht_watch(phpdbg_watchpoint_t *watch) { in phpdbg_create_recursive_ht_watch() argument
458 ZEND_ASSERT(watch->type == WATCH_ON_HASHTABLE); in phpdbg_create_recursive_ht_watch()
460 ZEND_HASH_FOREACH_KEY_VAL(HT_WATCH_HT(watch), h, key, zv) { in phpdbg_create_recursive_ht_watch()
464 new_watch->parent = watch; in phpdbg_create_recursive_ht_watch()
465 new_watch->parent_container = HT_WATCH_HT(watch); in phpdbg_create_recursive_ht_watch()
474 …watch->str) - 2, ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpdbg_ge… in phpdbg_create_recursive_ht_watch()
488 static int phpdbg_create_recursive_zval_watch(phpdbg_watchpoint_t *watch) { in phpdbg_create_recursive_zval_watch() argument
492 ZEND_ASSERT(watch->type == WATCH_ON_ZVAL); in phpdbg_create_recursive_zval_watch()
494 zvp = watch->addr.zv; in phpdbg_create_recursive_zval_watch()
501 new_watch->parent = watch; in phpdbg_create_recursive_zval_watch()
502 new_watch->parent_container = watch->parent_container; in phpdbg_create_recursive_zval_watch()
503 new_watch->name_in_parent = watch->name_in_parent; in phpdbg_create_recursive_zval_watch()
505 new_watch->str = strpprintf(0, "%.*s[]", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str)); in phpdbg_create_recursive_zval_watch()
523 static void phpdbg_delete_implicit_parents(phpdbg_watchpoint_t *watch) { in phpdbg_delete_implicit_parents() argument
524 phpdbg_watchpoint_t *parent = watch->parent; in phpdbg_delete_implicit_parents()
538 if (parent->type == WATCH_ON_ZVAL && Z_REFCOUNTED_P(watch->addr.zv)) { in phpdbg_delete_implicit_parents()
546 static int phpdbg_delete_watchpoint_recursive(phpdbg_watchpoint_t *watch, zend_bool user_request) { in phpdbg_delete_watchpoint_recursive() argument
547 if (watch->type == WATCH_ON_HASHTABLE) { in phpdbg_delete_watchpoint_recursive()
549 phpdbg_delete_ht_watchpoints_recursive(watch); in phpdbg_delete_watchpoint_recursive()
554 ht = HT_FROM_ZVP(watch->addr.zv); in phpdbg_delete_watchpoint_recursive()
560 } else if (watch->type == WATCH_ON_ZVAL) { in phpdbg_delete_watchpoint_recursive()
561 phpdbg_delete_zval_watchpoints_recursive(watch); in phpdbg_delete_watchpoint_recursive()
564 return zend_hash_del(&PHPDBG_G(watchpoints), watch->str); in phpdbg_delete_watchpoint_recursive()
567 static void phpdbg_delete_ht_watchpoints_recursive(phpdbg_watchpoint_t *watch) { in phpdbg_delete_ht_watchpoints_recursive() argument
572 ZEND_HASH_FOREACH_KEY(HT_WATCH_HT(watch), numkey, strkey) { in phpdbg_delete_ht_watchpoints_recursive()
574 …ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) ? "[" : "->", phpd… in phpdbg_delete_ht_watchpoints_recursive()
576 …G_FMT "%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch->flags & PHPDBG_WATCH_ARRAY) … in phpdbg_delete_ht_watchpoints_recursive()
587 static void phpdbg_delete_zval_watchpoints_recursive(phpdbg_watchpoint_t *watch) { in phpdbg_delete_zval_watchpoints_recursive() argument
588 if (Z_REFCOUNTED_P(watch->addr.zv)) { in phpdbg_delete_zval_watchpoints_recursive()
589 phpdbg_remove_watch_collision(watch); in phpdbg_delete_zval_watchpoints_recursive()
594 static void phpdbg_delete_watchpoints_recursive(phpdbg_watchpoint_t *watch) { in phpdbg_delete_watchpoints_recursive() argument
595 if (watch->type == WATCH_ON_ZVAL) { in phpdbg_delete_watchpoints_recursive()
596 phpdbg_delete_zval_watchpoints_recursive(watch); in phpdbg_delete_watchpoints_recursive()
597 } else if (watch->type == WATCH_ON_HASHTABLE) { in phpdbg_delete_watchpoints_recursive()
598 phpdbg_delete_ht_watchpoints_recursive(watch); in phpdbg_delete_watchpoints_recursive()
604 phpdbg_watchpoint_t *watch; in phpdbg_delete_watchpoint() local
611 watch = result->ptr; in phpdbg_delete_watchpoint()
613 …if (!(watch->flags & PHPDBG_WATCH_NORMAL) || (watch->parent && (watch->parent->flags & PHPDBG_WATC… in phpdbg_delete_watchpoint()
617 if (watch->flags & PHPDBG_WATCH_RECURSIVE) { in phpdbg_delete_watchpoint()
618 ret = phpdbg_delete_watchpoint_recursive(watch, 1); in phpdbg_delete_watchpoint()
620 ret = zend_hash_del(&PHPDBG_G(watchpoints), watch->str); in phpdbg_delete_watchpoint()
631 phpdbg_watchpoint_t *watch = ecalloc(1, sizeof(phpdbg_watchpoint_t)); in phpdbg_watchpoint_parse_wrapper() local
632 watch->str = zend_string_init(name, namelen, 0); in phpdbg_watchpoint_parse_wrapper()
633 watch->name_in_parent = zend_string_init(key, keylen, 0); in phpdbg_watchpoint_parse_wrapper()
634 watch->parent_container = parent; in phpdbg_watchpoint_parse_wrapper()
635 phpdbg_create_zval_watchpoint(zv, watch); in phpdbg_watchpoint_parse_wrapper()
637 ret = callback(watch); in phpdbg_watchpoint_parse_wrapper()
643 phpdbg_free_watch(watch); in phpdbg_watchpoint_parse_wrapper()
644 efree(watch); in phpdbg_watchpoint_parse_wrapper()
657 phpdbg_watchpoint_t *watch; in phpdbg_watchpoint_parse_step() local
659 if ((watch = zend_hash_str_find_ptr(&PHPDBG_G(watchpoints), name, namelen))) { in phpdbg_watchpoint_parse_step()
660 watch->flags |= PHPDBG_WATCH_IMPLICIT; in phpdbg_watchpoint_parse_step()
661 PHPDBG_G(watch_tmp) = watch; in phpdbg_watchpoint_parse_step()
665 watch = ecalloc(1, sizeof(phpdbg_watchpoint_t)); in phpdbg_watchpoint_parse_step()
666 watch->flags = PHPDBG_WATCH_IMPLICIT; in phpdbg_watchpoint_parse_step()
667 watch->str = zend_string_init(name, namelen, 0); in phpdbg_watchpoint_parse_step()
668 watch->name_in_parent = zend_string_init(key, keylen, 0); in phpdbg_watchpoint_parse_step()
669 watch->parent_container = parent; in phpdbg_watchpoint_parse_step()
670 watch->parent = PHPDBG_G(watch_tmp); in phpdbg_watchpoint_parse_step()
671 phpdbg_create_zval_watchpoint(zv, watch); in phpdbg_watchpoint_parse_step()
673 phpdbg_create_watchpoint(watch); in phpdbg_watchpoint_parse_step()
678 PHPDBG_G(watch_tmp) = watch; in phpdbg_watchpoint_parse_step()
758 phpdbg_watchpoint_t *watch = result->ptr; in phpdbg_watch_HashTable_dtor() local
760 if (watch->flags & PHPDBG_WATCH_NORMAL) { in phpdbg_watch_HashTable_dtor()
763 ….*s was removed, removing watchpoint%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch-… in phpdbg_watch_HashTable_dtor()
766 …if ((result = phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) watch->parent_container)… in phpdbg_watch_HashTable_dtor()
769 zend_hash_del(&hti->watches, watch->name_in_parent); in phpdbg_watch_HashTable_dtor()
771 watch->parent_container->pDestructor = hti->dtor; in phpdbg_watch_HashTable_dtor()
773 phpdbg_btree_delete(&PHPDBG_G(watch_HashTables), (zend_ulong) watch->parent_container); in phpdbg_watch_HashTable_dtor()
780 if (watch->flags & PHPDBG_WATCH_RECURSIVE) { in phpdbg_watch_HashTable_dtor()
781 phpdbg_delete_watchpoint_recursive(watch, 0); in phpdbg_watch_HashTable_dtor()
783 zend_hash_del(&PHPDBG_G(watchpoints), watch->str); in phpdbg_watch_HashTable_dtor()
811 phpdbg_watchpoint_t *watch; local
814 watch = phpdbg_check_for_watchpoint(
822 if (watch == NULL) {
826 page = phpdbg_get_page_boundary(watch->addr.ptr);
827 size = phpdbg_get_total_page_size(watch->addr.ptr, watch->size);
850 phpdbg_watchpoint_t *watch = (phpdbg_watchpoint_t *) Z_PTR_P(pDest); local
852 if (watch->flags & PHPDBG_WATCH_IMPLICIT) {
853 watch->flags = PHPDBG_WATCH_SIMPLE; // tiny hack for delete_implicit_parents
855 if (watch->type == WATCH_ON_ZVAL) {
856 phpdbg_delete_zval_watchpoints_recursive(watch);
857 } else if (watch->type == WATCH_ON_HASHTABLE) {
860 watch->implicit_ht_count++;
862 …) phpdbg_btree_find(&PHPDBG_G(watch_HashTables), (zend_ulong) HT_WATCH_HT(watch))->ptr)->watches, …
868 phpdbg_delete_implicit_parents(watch);
870 phpdbg_deactivate_watchpoint(watch);
871 phpdbg_remove_watchpoint(watch);
873 phpdbg_free_watch(watch);
874 efree(watch);
920 phpdbg_watchpoint_t *watch = result->ptr; local
921 void *oldPtr = (char *) &dump->data + ((size_t) watch->addr.ptr - (size_t) dump->page);
925 …if ((size_t) watch->addr.ptr < (size_t) dump->page || (size_t) watch->addr.ptr + watch->size > (si…
930 …if ((watch->type == WATCH_ON_HASHTABLE || watch->type == WATCH_ON_ZVAL) && watch->parent_container…
931 if ((curTest = zend_symtable_find(watch->parent_container, watch->name_in_parent))) {
936 if (watch->type == WATCH_ON_HASHTABLE) {
947 if (curTest != watch->addr.ptr) {
948 phpdbg_deactivate_watchpoint(watch);
949 phpdbg_remove_watchpoint(watch);
950 watch->addr.ptr = curTest;
951 phpdbg_store_watchpoint(watch);
952 phpdbg_activate_watchpoint(watch);
965 switch (watch->type) {
967 …do_break = memcmp(oldPtr, watch->addr.zv, sizeof(zend_value) + sizeof(uint32_t) /* value + typeinf…
973 …do_break = zend_hash_num_elements(HT_PTR_HT(oldPtr)) != zend_hash_num_elements(HT_WATCH_HT(watch));
979 …do_break = memcmp(oldPtr, watch->addr.ref, sizeof(uint32_t) /* no zend_refcounted metadata info */…
989 if (!(watch->flags & PHPDBG_WATCH_NORMAL)) {
996 …variable=\"%s\"", "Breaking on watchpoint %.*s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str));
1000 switch (watch->type) {
1002 …zend_bool show_value = memcmp(oldPtr, watch->addr.zv, sizeof(zend_value) + sizeof(uint32_t) /* no …
1004 if ((watch->flags & PHPDBG_WATCH_NORMAL) && (removed || show_value)) {
1019 if (watch->flags & PHPDBG_WATCH_NORMAL) {
1020 …Watchpoint %.*s was unset, removing watchpoint", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str));
1022 zend_hash_del(&PHPDBG_G(watchpoints), watch->str);
1027 phpdbg_remove_watch_collision(watch);
1032 if ((watch->flags & PHPDBG_WATCH_NORMAL) && show_value) {
1033 phpdbg_out("New value%s: ", Z_ISREF_P(watch->addr.zv) ? " (reference)" : "");
1034 …phpdbg_xml("<watchvalue %r%s type=\"new\">", Z_ISREF_P(watch->addr.zv) ? " reference=\"reference\"…
1035 zend_print_flat_zval_r(watch->addr.zv);
1041 …if (Z_PTR_P(watch->addr.zv) != Z_PTR_P((zval *) oldPtr) || Z_TYPE_P(watch->addr.zv) != Z_TYPE_P((z…
1043 zval *new_zv = watch->addr.zv;
1044 watch->addr.ptr = oldPtr;
1045 phpdbg_remove_watch_collision(watch);
1046 watch->addr.zv = new_zv;
1048 if (Z_REFCOUNTED_P(watch->addr.zv)) {
1049 if ((watch->flags & PHPDBG_WATCH_NORMAL) && (PHPDBG_G(flags) & PHPDBG_SHOW_REFCOUNTS)) {
1050 …"watchrefcount", "type=\"new\" refcount=\"%d\"", "New refcount: %d", Z_REFCOUNT_P(watch->addr.zv));
1052 if (watch->flags & PHPDBG_WATCH_RECURSIVE) {
1053 phpdbg_create_recursive_watchpoint(watch);
1054 } else if (Z_ISREF_P(watch->addr.zv)) {
1055 phpdbg_create_reference_watch(watch);
1064 …ementDiff = zend_hash_num_elements(HT_PTR_HT(oldPtr)) - zend_hash_num_elements(HT_WATCH_HT(watch));
1065 if ((watch->flags & PHPDBG_WATCH_NORMAL) && elementDiff) {
1073 if (watch->flags & PHPDBG_WATCH_RECURSIVE) {
1074 phpdbg_create_recursive_ht_watch(watch);
1076 …if ((watch->flags & PHPDBG_WATCH_NORMAL) && HT_WATCH_HT(watch)->nInternalPointer != HT_PTR_HT(oldP…
1081 if ((watch->flags & PHPDBG_WATCH_NORMAL) && (PHPDBG_G(flags) & PHPDBG_SHOW_REFCOUNTS)) {
1083 …"watchrefcount", "type=\"new\" refcount=\"%d\"", "New refcount: %d", GC_REFCOUNT(watch->addr.ref));
1122 phpdbg_watchpoint_t *watch; local
1126 ZEND_HASH_FOREACH_PTR(&PHPDBG_G(watchpoints), watch) {
1127 if (watch->flags & PHPDBG_WATCH_NORMAL) {
1128 …N(watch->str), ZSTR_VAL(watch->str), watch->type == WATCH_ON_HASHTABLE ? "array" : watch->type == …
1141 phpdbg_watchpoint_t *watch = result->ptr; local
1143 if ((size_t) watch->addr.ptr + watch->size > (size_t) ptr) {
1144 if (watch->type == WATCH_ON_REFCOUNTED) {
1146 phpdbg_deactivate_watchpoint(watch);
1147 phpdbg_remove_watchpoint(watch);
1149 if (watch->type == WATCH_ON_ZVAL) {
1150 phpdbg_remove_watch_collision(watch);
1152 if (watch->type == WATCH_ON_HASHTABLE && (watch->flags & PHPDBG_WATCH_SIMPLE)) {
1154 ….*s was removed, removing watchpoint%s", (int) ZSTR_LEN(watch->str), ZSTR_VAL(watch->str), (watch-…
1156 …if (watch->type == WATCH_ON_HASHTABLE || watch->parent == NULL || watch->parent->type != WATCH_ON_…
1157 zend_hash_del(&PHPDBG_G(watchpoints), watch->str);