2013-11-11 02:06:41 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
2019-01-30 17:00:23 +08:00
|
|
|
| Copyright (c) The PHP Group |
|
2013-11-11 02:06:41 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| This source file is subject to version 3.01 of the PHP license, |
|
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available through the world-wide-web at the following url: |
|
2021-05-06 18:16:35 +08:00
|
|
|
| https://www.php.net/license/3_01.txt |
|
2013-11-11 02:06:41 +08:00
|
|
|
| If you did not receive a copy of the PHP license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@php.net so we can mail you a copy immediately. |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Felipe Pena <felipe@php.net> |
|
|
|
|
| Authors: Joe Watkins <joe.watkins@live.co.uk> |
|
2013-12-18 18:02:50 +08:00
|
|
|
| Authors: Bob Weinand <bwoebi@php.net> |
|
2013-11-11 02:06:41 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PHPDBG_BP_H
|
|
|
|
#define PHPDBG_BP_H
|
|
|
|
|
2014-09-21 10:17:19 +08:00
|
|
|
/* {{{ defines */
|
|
|
|
#define PHPDBG_BREAK_FILE 0
|
2014-10-27 03:43:49 +08:00
|
|
|
#define PHPDBG_BREAK_FILE_PENDING 1
|
|
|
|
#define PHPDBG_BREAK_SYM 2
|
|
|
|
#define PHPDBG_BREAK_OPLINE 3
|
|
|
|
#define PHPDBG_BREAK_METHOD 4
|
|
|
|
#define PHPDBG_BREAK_COND 5
|
|
|
|
#define PHPDBG_BREAK_OPCODE 6
|
|
|
|
#define PHPDBG_BREAK_FUNCTION_OPLINE 7
|
|
|
|
#define PHPDBG_BREAK_METHOD_OPLINE 8
|
|
|
|
#define PHPDBG_BREAK_FILE_OPLINE 9
|
|
|
|
#define PHPDBG_BREAK_MAP 10
|
|
|
|
#define PHPDBG_BREAK_TABLES 11 /* }}} */
|
2014-09-21 10:17:19 +08:00
|
|
|
|
2013-11-11 21:07:02 +08:00
|
|
|
/* {{{ */
|
|
|
|
typedef struct _zend_op *phpdbg_opline_ptr_t; /* }}} */
|
|
|
|
|
2013-11-27 21:01:57 +08:00
|
|
|
/* {{{ breakpoint base structure */
|
|
|
|
#define phpdbg_breakbase(name) \
|
2013-12-07 22:35:35 +08:00
|
|
|
int id; \
|
2023-02-23 22:56:54 +08:00
|
|
|
uint8_t type; \
|
2013-11-27 21:01:57 +08:00
|
|
|
zend_ulong hits; \
|
2021-01-15 19:30:54 +08:00
|
|
|
bool disabled; \
|
2013-12-07 22:35:35 +08:00
|
|
|
const char *name /* }}} */
|
2013-11-27 21:01:57 +08:00
|
|
|
|
2013-11-27 06:20:52 +08:00
|
|
|
/* {{{ breakpoint base */
|
|
|
|
typedef struct _phpdbg_breakbase_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(name);
|
2013-11-27 06:20:52 +08:00
|
|
|
} phpdbg_breakbase_t; /* }}} */
|
|
|
|
|
2013-11-11 02:06:41 +08:00
|
|
|
/**
|
|
|
|
* Breakpoint file-based representation
|
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breakfile_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(filename);
|
2021-06-17 20:22:33 +08:00
|
|
|
zend_ulong line;
|
2013-11-11 02:06:41 +08:00
|
|
|
} phpdbg_breakfile_t;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Breakpoint symbol-based representation
|
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breaksymbol_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(symbol);
|
2013-11-11 02:06:41 +08:00
|
|
|
} phpdbg_breaksymbol_t;
|
|
|
|
|
2013-11-12 08:27:48 +08:00
|
|
|
/**
|
|
|
|
* Breakpoint method based representation
|
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breakmethod_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(class_name);
|
2013-11-26 18:02:58 +08:00
|
|
|
size_t class_len;
|
|
|
|
const char *func_name;
|
|
|
|
size_t func_len;
|
2013-11-12 08:27:48 +08:00
|
|
|
} phpdbg_breakmethod_t;
|
|
|
|
|
2013-11-29 04:36:45 +08:00
|
|
|
/**
|
|
|
|
* Breakpoint opline num based representation
|
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breakopline_t {
|
2013-12-07 22:35:35 +08:00
|
|
|
phpdbg_breakbase(func_name);
|
|
|
|
size_t func_len;
|
2013-11-29 04:36:45 +08:00
|
|
|
const char *class_name;
|
|
|
|
size_t class_len;
|
2013-12-07 22:35:35 +08:00
|
|
|
zend_ulong opline_num;
|
|
|
|
zend_ulong opline;
|
2013-11-29 04:36:45 +08:00
|
|
|
} phpdbg_breakopline_t;
|
|
|
|
|
2013-11-11 19:54:41 +08:00
|
|
|
/**
|
|
|
|
* Breakpoint opline based representation
|
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breakline_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(name);
|
2013-12-07 22:35:35 +08:00
|
|
|
zend_ulong opline;
|
|
|
|
phpdbg_breakopline_t *base;
|
2013-11-11 19:54:41 +08:00
|
|
|
} phpdbg_breakline_t;
|
|
|
|
|
2013-11-24 07:14:16 +08:00
|
|
|
/**
|
|
|
|
* Breakpoint opcode based representation
|
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breakop_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(name);
|
2013-12-07 22:35:35 +08:00
|
|
|
zend_ulong hash;
|
2013-11-24 07:14:16 +08:00
|
|
|
} phpdbg_breakop_t;
|
|
|
|
|
2013-11-13 22:22:01 +08:00
|
|
|
/**
|
2013-11-24 07:18:21 +08:00
|
|
|
* Breakpoint condition based representation
|
2013-11-13 22:22:01 +08:00
|
|
|
*/
|
|
|
|
typedef struct _phpdbg_breakcond_t {
|
2013-11-27 21:01:57 +08:00
|
|
|
phpdbg_breakbase(code);
|
2013-12-07 22:35:35 +08:00
|
|
|
size_t code_len;
|
2021-01-15 19:30:54 +08:00
|
|
|
bool paramed;
|
2013-12-03 08:15:33 +08:00
|
|
|
phpdbg_param_t param;
|
2013-11-24 19:58:08 +08:00
|
|
|
zend_ulong hash;
|
2013-11-26 18:02:58 +08:00
|
|
|
zend_op_array *ops;
|
2013-11-13 22:22:01 +08:00
|
|
|
} phpdbg_breakcond_t;
|
|
|
|
|
2014-10-27 03:43:49 +08:00
|
|
|
/* {{{ Resolving breaks API */
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API void phpdbg_resolve_op_array_breaks(zend_op_array *op_array);
|
|
|
|
PHPDBG_API int phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, zend_op_array *op_array);
|
|
|
|
PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break);
|
2016-12-22 21:32:02 +08:00
|
|
|
PHPDBG_API HashTable *phpdbg_resolve_pending_file_break_ex(const char *file, uint32_t filelen, zend_string *cur, HashTable *fileht);
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API void phpdbg_resolve_pending_file_break(const char *file); /* }}} */
|
2013-11-11 04:06:19 +08:00
|
|
|
|
2013-11-27 21:28:53 +08:00
|
|
|
/* {{{ Breakpoint Creation API */
|
2021-06-17 20:22:33 +08:00
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_file(const char* filename, size_t path_len, zend_ulong lineno);
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_symbol(const char* func_name, size_t func_name_len);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_method(const char* class_name, const char* func_name);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_opcode(const char* opname, size_t opname_len);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong opline);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_method_opline(const char *class, const char *method, zend_ulong opline);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_function_opline(const char *function, zend_ulong opline);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_file_opline(const char *file, zend_ulong opline);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_expression(const char* expression, size_t expression_len);
|
|
|
|
PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param); /* }}} */
|
2013-11-11 02:24:08 +08:00
|
|
|
|
2013-11-27 21:28:53 +08:00
|
|
|
/* {{{ Breakpoint Detection API */
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API phpdbg_breakbase_t* phpdbg_find_breakpoint(zend_execute_data*); /* }}} */
|
2013-11-11 04:06:19 +08:00
|
|
|
|
2013-11-27 21:28:53 +08:00
|
|
|
/* {{{ Misc Breakpoint API */
|
2021-01-15 19:30:54 +08:00
|
|
|
PHPDBG_API void phpdbg_hit_breakpoint(phpdbg_breakbase_t* brake, bool output);
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type);
|
|
|
|
PHPDBG_API void phpdbg_print_breakpoint(phpdbg_breakbase_t* brake);
|
|
|
|
PHPDBG_API void phpdbg_reset_breakpoints(void);
|
|
|
|
PHPDBG_API void phpdbg_clear_breakpoints(void);
|
|
|
|
PHPDBG_API void phpdbg_delete_breakpoint(zend_ulong num);
|
|
|
|
PHPDBG_API void phpdbg_enable_breakpoints(void);
|
|
|
|
PHPDBG_API void phpdbg_enable_breakpoint(zend_ulong id);
|
|
|
|
PHPDBG_API void phpdbg_disable_breakpoint(zend_ulong id);
|
|
|
|
PHPDBG_API void phpdbg_disable_breakpoints(void); /* }}} */
|
2013-11-12 01:19:05 +08:00
|
|
|
|
2013-12-02 21:43:21 +08:00
|
|
|
/* {{{ Breakbase API */
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase(zend_ulong id);
|
|
|
|
PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase_ex(zend_ulong id, HashTable **table, zend_ulong *numkey, zend_string **strkey); /* }}} */
|
2013-11-12 01:19:05 +08:00
|
|
|
|
2013-11-27 21:28:53 +08:00
|
|
|
/* {{{ Breakpoint Exportation API */
|
2014-12-14 06:06:14 +08:00
|
|
|
PHPDBG_API void phpdbg_export_breakpoints(FILE *handle);
|
|
|
|
PHPDBG_API void phpdbg_export_breakpoints_to_string(char **str); /* }}} */
|
2013-11-26 01:41:09 +08:00
|
|
|
|
2013-11-11 02:06:41 +08:00
|
|
|
#endif /* PHPDBG_BP_H */
|