23# define PHPDBG_API __declspec(dllexport)
24#elif defined(__GNUC__) && __GNUC__ >= 4
25# define PHPDBG_API __attribute__ ((visibility("default")))
43#if !defined(_WIN32) && !defined(ZEND_SIGNALS)
45#elif defined(PHP_WIN32)
51#if defined(_WIN32) && !defined(__MINGW32__)
53# include "config.w32.h"
56# define strcasecmp _stricmp
57# define strncasecmp _strnicmp
59# include <php_config.h>
70#undef zend_hash_str_add
72#define zend_hash_str_add(...) \
73 zend_hash_str_add(__VA_ARGS__)
75#define zend_hash_str_add_tmp(ht, key, len, pData) \
76 zend_hash_str_add(ht, key, len, pData)
77#define zend_hash_str_add(...) zend_hash_str_add_tmp(__VA_ARGS__)
80#ifdef HAVE_PHPDBG_READLINE
81# ifdef HAVE_LIBREADLINE
82# include <readline/readline.h>
83# include <readline/history.h>
86# include <editline/readline.h>
91#define PHPDBG_NAME "phpdbg"
92#define PHPDBG_AUTHORS "Felipe Pena, Joe Watkins and Bob Weinand"
93#define PHPDBG_ISSUES "https://github.com/php/php-src/issues"
94#define PHPDBG_VERSION PHP_VERSION
95#define PHPDBG_INIT_FILENAME ".phpdbginit"
96#define PHPDBG_DEFAULT_PROMPT "prompt>"
100# define PHPDBG_G(v) ZEND_TSRMG(phpdbg_globals_id, zend_phpdbg_globals *, v)
102# define PHPDBG_G(v) (phpdbg_globals.v)
117#define PHPDBG_UNTIL 3
118#define PHPDBG_FINISH 4
119#define PHPDBG_LEAVE 5
126#define PHPDBG_HAS_FILE_BP (1ULL<<1)
127#define PHPDBG_HAS_PENDING_FILE_BP (1ULL<<2)
128#define PHPDBG_HAS_SYM_BP (1ULL<<3)
129#define PHPDBG_HAS_OPLINE_BP (1ULL<<4)
130#define PHPDBG_HAS_METHOD_BP (1ULL<<5)
131#define PHPDBG_HAS_COND_BP (1ULL<<6)
132#define PHPDBG_HAS_OPCODE_BP (1ULL<<7)
133#define PHPDBG_HAS_FUNCTION_OPLINE_BP (1ULL<<8)
134#define PHPDBG_HAS_METHOD_OPLINE_BP (1ULL<<9)
135#define PHPDBG_HAS_FILE_OPLINE_BP (1ULL<<10)
141#define PHPDBG_IN_COND_BP (1ULL<<11)
142#define PHPDBG_IN_EVAL (1ULL<<12)
144#define PHPDBG_IS_STEPPING (1ULL<<13)
145#define PHPDBG_STEP_OPCODE (1ULL<<14)
146#define PHPDBG_IS_QUIET (1ULL<<15)
147#define PHPDBG_IS_QUITTING (1ULL<<16)
148#define PHPDBG_IS_COLOURED (1ULL<<17)
149#define PHPDBG_IS_CLEANING (1ULL<<18)
150#define PHPDBG_IS_RUNNING (1ULL<<19)
152#define PHPDBG_IN_UNTIL (1ULL<<20)
153#define PHPDBG_IN_FINISH (1ULL<<21)
154#define PHPDBG_IN_LEAVE (1ULL<<22)
156#define PHPDBG_IS_REGISTERED (1ULL<<23)
157#define PHPDBG_IS_STEPONEVAL (1ULL<<24)
158#define PHPDBG_IS_INITIALIZING (1ULL<<25)
159#define PHPDBG_IS_SIGNALED (1ULL<<26)
160#define PHPDBG_IS_INTERACTIVE (1ULL<<27)
161#define PHPDBG_PREVENT_INTERACTIVE (1ULL<<28)
162#define PHPDBG_IS_BP_ENABLED (1ULL<<29)
163#define PHPDBG_SHOW_REFCOUNTS (1ULL<<30)
164#define PHPDBG_IN_SIGNAL_HANDLER (1ULL<<31)
165#define PHPDBG_DISCARD_OUTPUT (1ULL<<32)
166#define PHPDBG_HAS_PAGINATION (1ULL<<33)
168#define PHPDBG_SEEK_MASK (PHPDBG_IN_UNTIL | PHPDBG_IN_FINISH | PHPDBG_IN_LEAVE)
169#define PHPDBG_BP_RESOLVE_MASK (PHPDBG_HAS_FUNCTION_OPLINE_BP | PHPDBG_HAS_METHOD_OPLINE_BP | PHPDBG_HAS_FILE_OPLINE_BP)
170#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)
171#define PHPDBG_IS_STOPPING (PHPDBG_IS_QUITTING | PHPDBG_IS_CLEANING)
173#define PHPDBG_PRESERVE_FLAGS_MASK \
174 (PHPDBG_SHOW_REFCOUNTS | \
175 PHPDBG_IS_STEPONEVAL | \
176 PHPDBG_IS_BP_ENABLED | \
177 PHPDBG_STEP_OPCODE | \
179 PHPDBG_IS_COLOURED | \
180 PHPDBG_HAS_PAGINATION)
183# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET | PHPDBG_IS_COLOURED | PHPDBG_IS_BP_ENABLED | PHPDBG_HAS_PAGINATION)
185# define PHPDBG_DEFAULT_FLAGS (PHPDBG_IS_QUIET | PHPDBG_IS_BP_ENABLED | PHPDBG_HAS_PAGINATION)
189#define PHPDBG_STDIN 0
190#define PHPDBG_STDOUT 1
191#define PHPDBG_STDERR 2
192#define PHPDBG_IO_FDS 3
194#define phpdbg_try_access \
196 JMP_BUF *__orig_bailout = PHPDBG_G(sigsegv_bailout); \
199 PHPDBG_G(sigsegv_bailout) = &__bailout; \
200 if (SETJMP(__bailout) == 0) {
201#define phpdbg_catch_access \
203 PHPDBG_G(sigsegv_bailout) = __orig_bailout;
204#define phpdbg_end_try_access() \
206 PHPDBG_G(sigsegv_bailout) = __orig_bailout; \
246#ifdef HAVE_USERFAULTFD_WRITEFAULT
247 int watch_userfaultfd;
248 pthread_t watch_userfault_thread;
const php_stream_filter_ops * ops
php_output_handler * active
struct _php_stream php_stream
struct _php_stream_wrapper php_stream_wrapper
struct _phpdbg_oplog_entry phpdbg_oplog_entry
HashTable bp[PHPDBG_BREAK_TABLES]
HashTable * watchlist_mem_backup
HashTable watch_collisions
struct @010122165316201240231237266310115370127155020222 err_buf
struct @234323133100145062121301312242002332057146367313 io[PHPDBG_IO_FDS]
phpdbg_watch_element * watch_tmp
int phpdbg_do_parse(phpdbg_param_t *stack, char *input)
ssize_t(* php_stdiop_write)(php_stream *, const char *, size_t)
HashTable * watchlist_mem
HashTable watch_recreation
phpdbg_btree watchpoint_tree
phpdbg_btree watch_HashTables
zend_object * handled_exception
char input_buffer[PHPDBG_MAX_CMD]
void phpdbg_register_file_handles(void)
zend_execute_data * seek_ex
HashTable * original_watchlist_mem
JMP_BUF * sigsegv_bailout
struct sigaction old_sigsegv_signal
phpdbg_param_t * parser_stack
const php_stream_wrapper * orig_url_wrap_php
const phpdbg_color_t * colors[PHPDBG_COLORS]
phpdbg_signal_safe_mem sigsafe_mem
phpdbg_oplog_list * oplog_list
void(* original_free_function)(void *ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC)
phpdbg_oplog_entry * oplog_cur
struct _phpdbg_oplog_list phpdbg_oplog_list
#define PHPDBG_BREAK_TABLES
struct _phpdbg_param phpdbg_param_t
struct _phpdbg_color_t phpdbg_color_t
struct _phpdbg_watch_element phpdbg_watch_element
zend_string * function_name
phpdbg_oplog_entry * next
#define ZEND_END_MODULE_GLOBALS(module_name)
#define ZEND_BEGIN_MODULE_GLOBALS(module_name)
struct _zend_arena zend_arena
enum _zend_compile_position zend_compile_position
struct _zend_op_array zend_op_array
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)
struct _zend_file_handle zend_file_handle
struct _zend_string zend_string
#define ZEND_FILE_LINE_DC
#define ZEND_FILE_LINE_ORIG_DC
struct _zend_class_entry zend_class_entry
struct _zend_object zend_object
struct _zend_array HashTable
struct _zend_execute_data zend_execute_data