1 /*
2    +----------------------------------------------------------------------+
3    | Xdebug                                                               |
4    +----------------------------------------------------------------------+
5    | Copyright (c) 2002-2021 Derick Rethans                               |
6    +----------------------------------------------------------------------+
7    | This source file is subject to version 1.01 of the Xdebug license,   |
8    | that is bundled with this package in the file LICENSE, and is        |
9    | available at through the world-wide-web at                           |
10    | https://xdebug.org/license.php                                       |
11    | If you did not receive a copy of the Xdebug license and are unable   |
12    | to obtain it through the world-wide-web, please send a note to       |
13    | derick@xdebug.org so we can mail you a copy immediately.             |
14    +----------------------------------------------------------------------+
15  */
16 
17 #ifndef PHP_XDEBUG_H
18 #define PHP_XDEBUG_H
19 
20 #define XDEBUG_NAME       "Xdebug"
21 #define XDEBUG_VERSION    "3.1.2"
22 #define XDEBUG_AUTHOR     "Derick Rethans"
23 #define XDEBUG_COPYRIGHT  "Copyright (c) 2002-2021 by Derick Rethans"
24 #define XDEBUG_COPYRIGHT_SHORT "Copyright (c) 2002-2021"
25 #define XDEBUG_URL        "https://xdebug.org"
26 #define XDEBUG_URL_FAQ    "https://xdebug.org/docs/faq#api"
27 
28 #include "php.h"
29 
30 #ifdef HAVE_CONFIG_H
31 # include "config.h"
32 #endif
33 
34 #include "base/base_globals.h"
35 #include "coverage/branch_info.h"
36 #include "coverage/code_coverage.h"
37 #include "debugger/debugger.h"
38 #include "develop/develop.h"
39 #include "lib/lib.h"
40 #include "gcstats/gc_stats.h"
41 #include "profiler/profiler.h"
42 #include "tracing/tracing.h"
43 #include "lib/compat.h"
44 #include "lib/hash.h"
45 #include "lib/llist.h"
46 #include "lib/vector.h"
47 #include "lib/timing.h"
48 
49 extern zend_module_entry xdebug_module_entry;
50 #define phpext_xdebug_ptr &xdebug_module_entry
51 
52 #define OUTPUT_NOT_CHECKED -1
53 #define OUTPUT_IS_TTY       1
54 #define OUTPUT_NOT_TTY      0
55 
56 #ifdef PHP_WIN32
57 #define PHP_XDEBUG_API __declspec(dllexport)
58 #else
59 #define PHP_XDEBUG_API
60 #endif
61 
62 #ifdef ZTS
63 #include "TSRM.h"
64 #endif
65 
66 #include "main/SAPI.h"
67 
68 #define XDEBUG_ALLOWED_HALT_LEVELS (E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE )
69 
70 PHP_MINIT_FUNCTION(xdebug);
71 PHP_MSHUTDOWN_FUNCTION(xdebug);
72 PHP_RINIT_FUNCTION(xdebug);
73 PHP_RSHUTDOWN_FUNCTION(xdebug);
74 PHP_MINFO_FUNCTION(xdebug);
75 ZEND_MODULE_POST_ZEND_DEACTIVATE_D(xdebug);
76 
77 int xdebug_is_output_tty();
78 
TraceFoldLevel(ln)79 ZEND_BEGIN_MODULE_GLOBALS(xdebug)
80 	struct {
81 		xdebug_base_globals_t     base;
82 		xdebug_coverage_globals_t coverage;
83 		xdebug_debugger_globals_t debugger;
84 		xdebug_develop_globals_t  develop;
85 		xdebug_gc_stats_globals_t gc_stats;
86 		xdebug_library_globals_t  library;
87 		xdebug_profiler_globals_t profiler;
88 		xdebug_tracing_globals_t  tracing;
89 	} globals;
90 	struct {
91 		xdebug_base_settings_t     base;
92 		xdebug_coverage_settings_t coverage;
93 		xdebug_debugger_settings_t debugger;
94 		xdebug_develop_settings_t  develop;
95 		xdebug_gc_stats_settings_t gc_stats;
96 		xdebug_library_settings_t  library;
97 		xdebug_profiler_settings_t profiler;
98 		xdebug_tracing_settings_t  tracing;
99 	} settings;
100 ZEND_END_MODULE_GLOBALS(xdebug)
101 
102 #ifdef ZTS
103 #define XG(v) TSRMG(xdebug_globals_id, zend_xdebug_globals *, v)
104 #else
105 #define XG(v) (xdebug_globals.v)
106 #endif
107 
108 #define XG_BASE(v)     (XG(globals.base.v))
109 #define XINI_BASE(v)     (XG(settings.base.v))
110 
111 #endif
112