phpdbg_bp.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Felipe Pena <felipe@php.net> |
  16. | Authors: Joe Watkins <joe.watkins@live.co.uk> |
  17. | Authors: Bob Weinand <bwoebi@php.net> |
  18. +----------------------------------------------------------------------+
  19. */
  20. #ifndef PHPDBG_BP_H
  21. #define PHPDBG_BP_H
  22. /* {{{ */
  23. typedef struct _zend_op *phpdbg_opline_ptr_t; /* }}} */
  24. /* {{{ breakpoint base structure */
  25. #define phpdbg_breakbase(name) \
  26. int id; \
  27. zend_uchar type; \
  28. zend_ulong hits; \
  29. zend_bool disabled; \
  30. const char *name /* }}} */
  31. /* {{{ breakpoint base */
  32. typedef struct _phpdbg_breakbase_t {
  33. phpdbg_breakbase(name);
  34. } phpdbg_breakbase_t; /* }}} */
  35. /**
  36. * Breakpoint file-based representation
  37. */
  38. typedef struct _phpdbg_breakfile_t {
  39. phpdbg_breakbase(filename);
  40. long line;
  41. } phpdbg_breakfile_t;
  42. /**
  43. * Breakpoint symbol-based representation
  44. */
  45. typedef struct _phpdbg_breaksymbol_t {
  46. phpdbg_breakbase(symbol);
  47. } phpdbg_breaksymbol_t;
  48. /**
  49. * Breakpoint method based representation
  50. */
  51. typedef struct _phpdbg_breakmethod_t {
  52. phpdbg_breakbase(class_name);
  53. size_t class_len;
  54. const char *func_name;
  55. size_t func_len;
  56. } phpdbg_breakmethod_t;
  57. /**
  58. * Breakpoint opline num based representation
  59. */
  60. typedef struct _phpdbg_breakopline_t {
  61. phpdbg_breakbase(func_name);
  62. size_t func_len;
  63. const char *class_name;
  64. size_t class_len;
  65. zend_ulong opline_num;
  66. zend_ulong opline;
  67. } phpdbg_breakopline_t;
  68. /**
  69. * Breakpoint opline based representation
  70. */
  71. typedef struct _phpdbg_breakline_t {
  72. phpdbg_breakbase(name);
  73. zend_ulong opline;
  74. phpdbg_breakopline_t *base;
  75. } phpdbg_breakline_t;
  76. /**
  77. * Breakpoint opcode based representation
  78. */
  79. typedef struct _phpdbg_breakop_t {
  80. phpdbg_breakbase(name);
  81. zend_ulong hash;
  82. } phpdbg_breakop_t;
  83. /**
  84. * Breakpoint condition based representation
  85. */
  86. typedef struct _phpdbg_breakcond_t {
  87. phpdbg_breakbase(code);
  88. size_t code_len;
  89. zend_bool paramed;
  90. phpdbg_param_t param;
  91. zend_ulong hash;
  92. zend_op_array *ops;
  93. } phpdbg_breakcond_t;
  94. /* {{{ Opline breaks API */
  95. PHPDBG_API void phpdbg_resolve_op_array_breaks(zend_op_array *op_array TSRMLS_DC);
  96. PHPDBG_API int phpdbg_resolve_op_array_break(phpdbg_breakopline_t *brake, zend_op_array *op_array TSRMLS_DC);
  97. PHPDBG_API int phpdbg_resolve_opline_break(phpdbg_breakopline_t *new_break TSRMLS_DC); /* }}} */
  98. /* {{{ Breakpoint Creation API */
  99. PHPDBG_API void phpdbg_set_breakpoint_file(const char* filename, long lineno TSRMLS_DC);
  100. PHPDBG_API void phpdbg_set_breakpoint_symbol(const char* func_name, size_t func_name_len TSRMLS_DC);
  101. PHPDBG_API void phpdbg_set_breakpoint_method(const char* class_name, const char* func_name TSRMLS_DC);
  102. PHPDBG_API void phpdbg_set_breakpoint_opcode(const char* opname, size_t opname_len TSRMLS_DC);
  103. PHPDBG_API void phpdbg_set_breakpoint_opline(zend_ulong opline TSRMLS_DC);
  104. PHPDBG_API void phpdbg_set_breakpoint_opline_ex(phpdbg_opline_ptr_t opline TSRMLS_DC);
  105. PHPDBG_API void phpdbg_set_breakpoint_method_opline(const char *class, const char *method, zend_ulong opline TSRMLS_DC);
  106. PHPDBG_API void phpdbg_set_breakpoint_function_opline(const char *function, zend_ulong opline TSRMLS_DC);
  107. PHPDBG_API void phpdbg_set_breakpoint_file_opline(const char *file, zend_ulong opline TSRMLS_DC);
  108. PHPDBG_API void phpdbg_set_breakpoint_expression(const char* expression, size_t expression_len TSRMLS_DC);
  109. PHPDBG_API void phpdbg_set_breakpoint_at(const phpdbg_param_t *param TSRMLS_DC); /* }}} */
  110. /* {{{ Breakpoint Detection API */
  111. PHPDBG_API phpdbg_breakbase_t* phpdbg_find_breakpoint(zend_execute_data* TSRMLS_DC); /* }}} */
  112. /* {{{ Misc Breakpoint API */
  113. PHPDBG_API void phpdbg_hit_breakpoint(phpdbg_breakbase_t* brake, zend_bool output TSRMLS_DC);
  114. PHPDBG_API void phpdbg_print_breakpoints(zend_ulong type TSRMLS_DC);
  115. PHPDBG_API void phpdbg_print_breakpoint(phpdbg_breakbase_t* brake TSRMLS_DC);
  116. PHPDBG_API void phpdbg_reset_breakpoints(TSRMLS_D);
  117. PHPDBG_API void phpdbg_clear_breakpoints(TSRMLS_D);
  118. PHPDBG_API void phpdbg_delete_breakpoint(zend_ulong num TSRMLS_DC);
  119. PHPDBG_API void phpdbg_enable_breakpoints(TSRMLS_D);
  120. PHPDBG_API void phpdbg_enable_breakpoint(zend_ulong id TSRMLS_DC);
  121. PHPDBG_API void phpdbg_disable_breakpoint(zend_ulong id TSRMLS_DC);
  122. PHPDBG_API void phpdbg_disable_breakpoints(TSRMLS_D); /* }}} */
  123. /* {{{ Breakbase API */
  124. PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase(zend_ulong id TSRMLS_DC);
  125. PHPDBG_API phpdbg_breakbase_t *phpdbg_find_breakbase_ex(zend_ulong id, HashTable ***table, HashPosition *position TSRMLS_DC); /* }}} */
  126. /* {{{ Breakpoint Exportation API */
  127. PHPDBG_API void phpdbg_export_breakpoints(FILE *handle TSRMLS_DC); /* }}} */
  128. #endif /* PHPDBG_BP_H */