php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
phpdbg_watch.h
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Authors: Felipe Pena <felipe@php.net> |
14 | Authors: Joe Watkins <joe.watkins@live.co.uk> |
15 | Authors: Bob Weinand <bwoebi@php.net> |
16 +----------------------------------------------------------------------+
17*/
18
19#ifndef PHPDBG_WATCH_H
20#define PHPDBG_WATCH_H
21
22#include "phpdbg_cmd.h"
23
24#ifdef _WIN32
25# include "phpdbg_win.h"
26#endif
27
28#define PHPDBG_WATCH(name) PHPDBG_COMMAND(watch_##name)
29
35PHPDBG_WATCH(recursive);
36
38
39/* Watchpoint functions/typedefs */
40
41/* References are managed through their parent zval *, being a simple WATCH_ON_ZVAL and eventually WATCH_ON_REFCOUNTED */
50
51
52#define PHPDBG_WATCH_SIMPLE 0x01
53#define PHPDBG_WATCH_RECURSIVE 0x02
54#define PHPDBG_WATCH_ARRAY 0x04
55#define PHPDBG_WATCH_OBJECT 0x08
56#define PHPDBG_WATCH_NORMAL (PHPDBG_WATCH_SIMPLE | PHPDBG_WATCH_RECURSIVE)
57#define PHPDBG_WATCH_IMPLICIT 0x10
58#define PHPDBG_WATCH_RECURSIVE_ROOT 0x20
59
61
62typedef struct _phpdbg_watchpoint_t {
63 union {
67 void *ptr;
69 size_t size;
71 zend_refcounted *ref; /* key to fetch the collision on parents */
73 phpdbg_watch_collision *coll; /* only present on *children* */
74 union {
82
88
89typedef struct _phpdbg_watch_element {
90 uint32_t id;
92 char flags;
93 struct _phpdbg_watch_element *child; /* always set for implicit watches */
95 HashTable child_container; /* children of this watch element for recursive array elements */
96 HashTable *parent_container; /* container of the value */
99 union {
103 } backup; /* backup for when watchpoint gets dissociated */
105
106typedef struct {
107 /* to watch rehashes (yes, this is not *perfect*, but good enough for everything in PHP...) */
108 phpdbg_watchpoint_t hash_watch; /* must be first element */
110 HashTable watches; /* contains phpdbg_watch_element */
112
113void phpdbg_setup_watchpoints(void);
116
117#ifndef _WIN32
118int phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context);
119#else
121#endif
122
125
126int phpdbg_delete_var_watchpoint(char *input, size_t len);
127int phpdbg_create_var_watchpoint(char *input, size_t len);
128
130
131void phpdbg_list_watchpoints(void);
132
134
135
136static long phpdbg_pagesize;
137
138static zend_always_inline void *phpdbg_get_page_boundary(void *addr) {
139 return (void *) ((size_t) addr & ~(phpdbg_pagesize - 1));
140}
141
142static zend_always_inline size_t phpdbg_get_total_page_size(void *addr, size_t size) {
143 return (size_t) phpdbg_get_page_boundary((void *) ((size_t) addr + size - 1)) - (size_t) phpdbg_get_page_boundary(addr) + phpdbg_pagesize;
144}
145
146#endif
size_t len
Definition apprentice.c:174
zval * zv
Definition ffi.c:3975
new_type size
Definition ffi.c:4365
void * ptr
Definition ffi.c:3814
struct _phpdbg_command_t phpdbg_command_t
Definition phpdbg_cmd.h:88
const phpdbg_command_t phpdbg_watch_commands[]
struct _phpdbg_watchpoint_t phpdbg_watchpoint_t
int phpdbg_watchpoint_segfault_handler(siginfo_t *info, void *context)
void phpdbg_purge_watchpoint_tree(void)
int phpdbg_print_changed_zvals(void)
int phpdbg_create_var_watchpoint(char *input, size_t len)
void phpdbg_list_watchpoints(void)
phpdbg_watchtype
@ WATCH_ON_BUCKET
@ WATCH_ON_REFCOUNTED
@ WATCH_ON_HASHDATA
@ WATCH_ON_ZVAL
@ WATCH_ON_HASHTABLE
@ WATCH_ON_STR
void phpdbg_destroy_watchpoints(void)
int phpdbg_delete_var_watchpoint(char *input, size_t len)
void phpdbg_watch_efree(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
void phpdbg_create_zval_watchpoint(zval *zv, phpdbg_watchpoint_t *watch)
#define PHPDBG_WATCH(name)
struct _phpdbg_watch_collision phpdbg_watch_collision
void phpdbg_setup_watchpoints(void)
void phpdbg_create_addr_watchpoint(void *addr, size_t size, phpdbg_watchpoint_t *watch)
struct _phpdbg_watch_element phpdbg_watch_element
phpdbg_watchpoint_t ref
phpdbg_watchpoint_t reference
HashTable * parent_container
union _phpdbg_watch_element::@143130252033274031345066232267337246132126076271 backup
phpdbg_watchpoint_t * watch
zend_refcounted ref
zend_string * name_in_parent
struct _phpdbg_watch_element * parent
struct _phpdbg_watch_element * child
zend_refcounted * ref
zend_string * str
phpdbg_watchtype type
phpdbg_watch_collision * coll
union _phpdbg_watchpoint_t::@353001364072153044355140237352142031313101134215 backup
Definition dce.c:49
phpdbg_watchpoint_t hash_watch
struct _zval_struct zval
struct _zend_string zend_string
#define ZEND_FILE_LINE_DC
#define zend_always_inline
#define ZEND_FILE_LINE_ORIG_DC
struct _zend_array HashTable
Definition zend_types.h:386
struct _zend_refcounted zend_refcounted
Definition zend_types.h:95
struct _Bucket Bucket