forked from xdebug/xdebug
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp_xdebug.h
More file actions
286 lines (238 loc) · 8.05 KB
/
php_xdebug.h
File metadata and controls
286 lines (238 loc) · 8.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
/*
+----------------------------------------------------------------------+
| Xdebug |
+----------------------------------------------------------------------+
| Copyright (c) 2002-2019 Derick Rethans |
+----------------------------------------------------------------------+
| This source file is subject to version 1.01 of the Xdebug license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| https://xdebug.org/license.php |
| If you did not receive a copy of the Xdebug license and are unable |
| to obtain it through the world-wide-web, please send a note to |
| derick@xdebug.org so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Derick Rethans <derick@xdebug.org> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_XDEBUG_H
#define PHP_XDEBUG_H
#define XDEBUG_NAME "Xdebug"
#define XDEBUG_VERSION "3.0.0-dev"
#define XDEBUG_AUTHOR "Derick Rethans"
#define XDEBUG_COPYRIGHT "Copyright (c) 2002-2019 by Derick Rethans"
#define XDEBUG_COPYRIGHT_SHORT "Copyright (c) 2002-2019"
#define XDEBUG_URL "https://xdebug.org"
#define XDEBUG_URL_FAQ "https://xdebug.org/docs/faq#api"
#include "php.h"
#include "coverage/branch_info.h"
#include "coverage/code_coverage.h"
#include "debugger/debugger.h"
#include "gcstats/gc_stats.h"
#include "profiler/profiler.h"
#include "tracing/tracing.h"
#include "lib/compat.h"
#include "lib/hash.h"
#include "lib/llist.h"
extern zend_module_entry xdebug_module_entry;
#define phpext_xdebug_ptr &xdebug_module_entry
#define MICRO_IN_SEC 1000000.00
#define OUTPUT_NOT_CHECKED -1
#define OUTPUT_IS_TTY 1
#define OUTPUT_NOT_TTY 0
#ifdef PHP_WIN32
#define PHP_XDEBUG_API __declspec(dllexport)
#else
#define PHP_XDEBUG_API
#endif
#ifdef ZTS
#include "TSRM.h"
#endif
#include "main/SAPI.h"
#define XDEBUG_ALLOWED_HALT_LEVELS (E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE )
PHP_MINIT_FUNCTION(xdebug);
PHP_MSHUTDOWN_FUNCTION(xdebug);
PHP_RINIT_FUNCTION(xdebug);
PHP_RSHUTDOWN_FUNCTION(xdebug);
PHP_MINFO_FUNCTION(xdebug);
ZEND_MODULE_POST_ZEND_DEACTIVATE_D(xdebug);
#ifndef PHP_WIN32
int xdebug_is_output_tty();
#endif
/* call stack functions */
PHP_FUNCTION(xdebug_get_stack_depth);
PHP_FUNCTION(xdebug_get_function_stack);
PHP_FUNCTION(xdebug_get_formatted_function_stack);
PHP_FUNCTION(xdebug_print_function_stack);
PHP_FUNCTION(xdebug_get_declared_vars);
PHP_FUNCTION(xdebug_call_class);
PHP_FUNCTION(xdebug_call_function);
PHP_FUNCTION(xdebug_call_file);
PHP_FUNCTION(xdebug_call_line);
PHP_FUNCTION(xdebug_set_time_limit);
PHP_FUNCTION(xdebug_error_reporting);
PHP_FUNCTION(xdebug_pcntl_exec);
PHP_FUNCTION(xdebug_var_dump);
PHP_FUNCTION(xdebug_debug_zval);
PHP_FUNCTION(xdebug_debug_zval_stdout);
/* activation functions */
PHP_FUNCTION(xdebug_enable);
PHP_FUNCTION(xdebug_disable);
PHP_FUNCTION(xdebug_is_enabled);
/* breaking functions */
PHP_FUNCTION(xdebug_is_debugger_active);
PHP_FUNCTION(xdebug_break);
/* tracing functions */
PHP_FUNCTION(xdebug_start_trace);
PHP_FUNCTION(xdebug_stop_trace);
PHP_FUNCTION(xdebug_get_tracefile_name);
/* error collecting functions */
PHP_FUNCTION(xdebug_start_error_collection);
PHP_FUNCTION(xdebug_stop_error_collection);
PHP_FUNCTION(xdebug_get_collected_errors);
/* function monitorin functions */
PHP_FUNCTION(xdebug_start_function_monitor);
PHP_FUNCTION(xdebug_stop_function_monitor);
PHP_FUNCTION(xdebug_get_monitored_functions);
/* profiling functions */
PHP_FUNCTION(xdebug_get_profiler_filename);
PHP_FUNCTION(xdebug_dump_aggr_profiling_data);
PHP_FUNCTION(xdebug_clear_aggr_profiling_data);
/* gc stats functions */
PHP_FUNCTION(xdebug_start_gcstats);
PHP_FUNCTION(xdebug_stop_gcstats);
PHP_FUNCTION(xdebug_get_gcstats_filename);
PHP_FUNCTION(xdebug_get_gc_run_count);
PHP_FUNCTION(xdebug_get_gc_total_collected_roots);
/* misc functions */
PHP_FUNCTION(xdebug_dump_superglobals);
PHP_FUNCTION(xdebug_get_headers);
PHP_FUNCTION(xdebug_memory_usage);
PHP_FUNCTION(xdebug_peak_memory_usage);
PHP_FUNCTION(xdebug_time_index);
/* filter functions */
PHP_FUNCTION(xdebug_set_filter);
struct xdebug_base_info {
unsigned long level;
xdebug_llist *stack;
double start_time;
unsigned int prev_memory;
zif_handler orig_var_dump_func;
zif_handler orig_set_time_limit_func;
zif_handler orig_error_reporting_func;
zif_handler orig_pcntl_exec_func;
int output_is_tty;
zend_bool in_debug_info;
char *last_exception_trace;
zend_long error_reporting_override;
zend_bool error_reporting_overridden;
unsigned int function_count;
char *last_eval_statement;
/* headers */
xdebug_llist *headers;
/* used for collection errors */
zend_bool do_collect_errors;
xdebug_llist *collected_errors;
/* used for function monitoring */
zend_bool do_monitor_functions;
xdebug_hash *functions_to_monitor;
xdebug_llist *monitored_functions_found; /* List of functions found */
/* superglobals */
zend_bool dumped;
xdebug_llist server;
xdebug_llist get;
xdebug_llist post;
xdebug_llist cookie;
xdebug_llist files;
xdebug_llist env;
xdebug_llist request;
xdebug_llist session;
/* scream */
zend_bool in_at;
/* in-execution checking */
zend_bool in_execution;
zend_bool in_var_serialisation;
/* filters */
zend_long filter_type_tracing;
zend_long filter_type_profiler;
zend_long filter_type_code_coverage;
xdebug_llist *filters_tracing;
xdebug_llist *filters_code_coverage;
struct {
zend_long max_nesting_level;
zend_long max_stack_frames;
zend_bool default_enable;
zend_bool collect_includes;
zend_long collect_params;
zend_bool collect_return;
zend_bool collect_vars;
zend_bool collect_assignments;
zend_bool show_ex_trace;
zend_bool show_error_trace;
zend_bool show_local_vars;
zend_bool show_mem_delta;
char *file_link_format;
char *filename_format;
zend_bool force_display_errors;
zend_long force_error_reporting;
zend_long halt_level;
zend_long overload_var_dump;
/* variable dumping limitation settings */
zend_long display_max_children;
zend_long display_max_data;
zend_long display_max_depth;
zend_long cli_color;
/* superglobals */
zend_bool dump_globals;
zend_bool dump_once;
zend_bool dump_undefined;
/* scream */
zend_bool do_scream;
} settings;
};
struct xdebug_library_info
{
zend_execute_data *active_execute_data;
function_stack_entry *active_fse;
HashTable *active_symbol_table;
zval *This;
};
ZEND_BEGIN_MODULE_GLOBALS(xdebug)
struct xdebug_base_info base;
struct xdebug_library_info library;
struct {
xdebug_coverage_globals_t coverage;
xdebug_debugger_globals_t debugger;
xdebug_gc_stats_globals_t gc_stats;
xdebug_profiler_globals_t profiler;
xdebug_tracing_globals_t tracing;
} globals;
struct {
xdebug_coverage_settings_t coverage;
xdebug_debugger_settings_t debugger;
xdebug_gc_stats_settings_t gc_stats;
xdebug_profiler_settings_t profiler;
xdebug_tracing_settings_t tracing;
} settings;
ZEND_END_MODULE_GLOBALS(xdebug)
#ifdef ZTS
#define XG(v) TSRMG(xdebug_globals_id, zend_xdebug_globals *, v)
#else
#define XG(v) (xdebug_globals.v)
#endif
#define XG_BASE(v) (XG(base.v))
#define XG_LIB(v ) (XG(library.v))
#define XINI_BASE(v) (XG(base.settings.v))
/* Needed for code coverage as Zend doesn't always add EXT_STMT when expected */
#define XDEBUG_SET_OPCODE_OVERRIDE_COMMON(oc) \
zend_set_user_opcode_handler(oc, xdebug_common_override_handler);
#define XDEBUG_SET_OPCODE_OVERRIDE_ASSIGN(f,oc) \
zend_set_user_opcode_handler(oc, xdebug_##f##_handler);
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* indent-tabs-mode: t
* End:
*/