This source file includes following definitions.
- ZEND_BEGIN_MODULE_GLOBALS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 #ifndef PHPDBG_H
22 #define PHPDBG_H
23
24 #ifdef PHP_WIN32
25 # define PHPDBG_API __declspec(dllexport)
26 #elif defined(__GNUC__) && __GNUC__ >= 4
27 # define PHPDBG_API __attribute__ ((visibility("default")))
28 #else
29 # define PHPDBG_API
30 #endif
31
32 #include "php.h"
33 #include "php_globals.h"
34 #include "php_variables.h"
35 #include "php_getopt.h"
36 #include "zend_builtin_functions.h"
37 #include "zend_extensions.h"
38 #include "zend_modules.h"
39 #include "zend_globals.h"
40 #include "zend_ini_scanner.h"
41 #include "zend_stream.h"
42 #ifndef _WIN32
43 # include "zend_signal.h"
44 #endif
45 #include "SAPI.h"
46 #include <fcntl.h>
47 #include <sys/types.h>
48 #if defined(_WIN32) && !defined(__MINGW32__)
49 # include <windows.h>
50 # include "config.w32.h"
51 # undef strcasecmp
52 # undef strncasecmp
53 # define strcasecmp _stricmp
54 # define strncasecmp _strnicmp
55 #else
56 # include "php_config.h"
57 #endif
58 #ifndef O_BINARY
59 # define O_BINARY 0
60 #endif
61 #include "php_main.h"
62
63 #ifdef ZTS
64 # include "TSRM.h"
65 #endif
66
67 #ifdef LIBREADLINE
68 # include <readline/readline.h>
69 # include <readline/history.h>
70 #endif
71 #ifdef HAVE_LIBEDIT
72 # include <editline/readline.h>
73 #endif
74
75 #include "phpdbg_lexer.h"
76 #include "phpdbg_cmd.h"
77 #include "phpdbg_utils.h"
78 #include "phpdbg_btree.h"
79 #include "phpdbg_watch.h"
80
81 int phpdbg_do_parse(phpdbg_param_t *stack, char *input TSRMLS_DC);
82
83 #ifdef ZTS
84 # define PHPDBG_G(v) TSRMG(phpdbg_globals_id, zend_phpdbg_globals *, v)
85 #else
86 # define PHPDBG_G(v) (phpdbg_globals.v)
87 #endif
88
89 #define PHPDBG_NEXT 2
90 #define PHPDBG_UNTIL 3
91 #define PHPDBG_FINISH 4
92 #define PHPDBG_LEAVE 5
93
94
95
96
97
98
99 #define PHPDBG_BREAK_FILE 0
100 #define PHPDBG_BREAK_SYM 1
101 #define PHPDBG_BREAK_OPLINE 2
102 #define PHPDBG_BREAK_METHOD 3
103 #define PHPDBG_BREAK_COND 4
104 #define PHPDBG_BREAK_OPCODE 5
105 #define PHPDBG_BREAK_FUNCTION_OPLINE 6
106 #define PHPDBG_BREAK_METHOD_OPLINE 7
107 #define PHPDBG_BREAK_FILE_OPLINE 8
108 #define PHPDBG_BREAK_MAP 9
109 #define PHPDBG_BREAK_TABLES 10
110
111
112 #define PHPDBG_HAS_FILE_BP (1<<1)
113 #define PHPDBG_HAS_SYM_BP (1<<2)
114 #define PHPDBG_HAS_OPLINE_BP (1<<3)
115 #define PHPDBG_HAS_METHOD_BP (1<<4)
116 #define PHPDBG_HAS_COND_BP (1<<5)
117 #define PHPDBG_HAS_OPCODE_BP (1<<6)
118 #define PHPDBG_HAS_FUNCTION_OPLINE_BP (1<<7)
119 #define PHPDBG_HAS_METHOD_OPLINE_BP (1<<8)
120 #define PHPDBG_HAS_FILE_OPLINE_BP (1<<9)
121
122
123
124
125
126 #define PHPDBG_IN_COND_BP (1<<10)
127 #define PHPDBG_IN_EVAL (1<<11)
128
129 #define PHPDBG_IS_STEPPING (1<<12)
130 #define PHPDBG_STEP_OPCODE (1<<13)
131 #define PHPDBG_IS_QUIET (1<<14)
132 #define PHPDBG_IS_QUITTING (1<<15)
133 #define PHPDBG_IS_COLOURED (1<<16)
134 #define PHPDBG_IS_CLEANING (1<<17)
135
136 #define PHPDBG_IN_UNTIL (1<<18)
137 #define PHPDBG_IN_FINISH (1<<19)
138 #define PHPDBG_IN_LEAVE (1<<20)
139
140 #define PHPDBG_IS_REGISTERED (1<<21)
141 #define PHPDBG_IS_STEPONEVAL (1<<22)
142 #define PHPDBG_IS_INITIALIZING (1<<23)
143 #define PHPDBG_IS_SIGNALED (1<<24)
144 #define PHPDBG_IS_INTERACTIVE (1<<25)
145 #define PHPDBG_IS_BP_ENABLED (1<<26)
146 #define PHPDBG_IS_REMOTE (1<<27)
147 #define PHPDBG_IS_DISCONNECTED (1<<28)
148
149 #define PHPDBG_SHOW_REFCOUNTS (1<<29)
150
151 #define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL|PHPDBG_IN_FINISH|PHPDBG_IN_LEAVE)
152 #define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP)
153 #define PHPDBG_BP_MASK (PHPDBG_HAS_FILE_BP|PHPDBG_HAS_SYM_BP|PHPDBG_HAS_METHOD_BP|PHPDBG_HAS_OPLINE_BP|PHPDBG_HAS_COND_BP|PHPDBG_HAS_OPCODE_BP|PHPDBG_HAS_FUNCTION_OPLINE_BP|PHPDBG_HAS_METHOD_OPLINE_BP|PHPDBG_HAS_FILE_OPLINE_BP)
154
155 #ifndef _WIN32
156 # define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_COLOURED|PHPDBG_IS_BP_ENABLED)
157 #else
158 # define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET|PHPDBG_IS_BP_ENABLED)
159 #endif
160
161
162 #define PHPDBG_NAME "phpdbg"
163 #define PHPDBG_AUTHORS "Felipe Pena, Joe Watkins and Bob Weinand"
164 #define PHPDBG_URL "http://phpdbg.com"
165 #define PHPDBG_ISSUES "http://github.com/krakjoe/phpdbg/issues"
166 #define PHPDBG_VERSION "0.4.0"
167 #define PHPDBG_INIT_FILENAME ".phpdbginit"
168
169
170
171 #define PHPDBG_STDIN 0
172 #define PHPDBG_STDOUT 1
173 #define PHPDBG_STDERR 2
174 #define PHPDBG_IO_FDS 3
175
176
177
178 ZEND_BEGIN_MODULE_GLOBALS(phpdbg)
179 HashTable bp[PHPDBG_BREAK_TABLES];
180 HashTable registered;
181 HashTable seek;
182 phpdbg_frame_t frame;
183 zend_uint last_line;
184
185 phpdbg_lexer_data lexer;
186 phpdbg_param_t *parser_stack;
187
188 #ifndef _WIN32
189 struct sigaction old_sigsegv_signal;
190 #endif
191 phpdbg_btree watchpoint_tree;
192 phpdbg_btree watch_HashTables;
193 HashTable watchpoints;
194 zend_llist watchlist_mem;
195 zend_bool watchpoint_hit;
196 void (*original_free_function)(void *);
197
198 char *exec;
199 size_t exec_len;
200 zend_op_array *ops;
201 zval *retval;
202 int bp_count;
203 int vmret;
204
205 FILE *oplog;
206 FILE *io[PHPDBG_IO_FDS];
207
208 char *prompt[2];
209 const phpdbg_color_t *colors[PHPDBG_COLORS];
210 char *buffer;
211
212 zend_ulong flags;
213 ZEND_END_MODULE_GLOBALS(phpdbg)
214
215
216
217 struct _zend_mm_heap {
218 int use_zend_alloc;
219 void *(*_malloc)(size_t);
220 void (*_free)(void *);
221 void *(*_realloc)(void *, size_t);
222 size_t free_bitmap;
223 size_t large_free_bitmap;
224 size_t block_size;
225 size_t compact_size;
226 zend_mm_segment *segments_list;
227 zend_mm_storage *storage;
228 };
229
230 #endif