PageRenderTime 49ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/xdebug_branch_info.h

http://github.com/derickr/xdebug
C Header | 88 lines | 53 code | 16 blank | 19 comment | 0 complexity | 32c53e9e7b8f5326e64c86f5984cd8e4 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Xdebug |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 2002-2016 Derick Rethans |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 1.0 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. | http://xdebug.derickrethans.nl/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. | xdebug@derickrethans.nl so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Authors: Derick Rethans <derick@xdebug.org> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef __HAVE_XDEBUG_BRANCH_INFO_H__
  19. #define __HAVE_XDEBUG_BRANCH_INFO_H__
  20. #include "xdebug_set.h"
  21. #include "xdebug_str.h"
  22. #define XDEBUG_JMP_NOT_SET (INT_MAX-1)
  23. #define XDEBUG_JMP_EXIT (INT_MAX-2)
  24. typedef struct _xdebug_branch {
  25. unsigned int start_lineno;
  26. unsigned int end_lineno;
  27. unsigned int end_op;
  28. int out[2];
  29. unsigned char hit;
  30. unsigned char out_hit[2];
  31. } xdebug_branch;
  32. typedef struct _xdebug_path {
  33. unsigned int elements_count;
  34. unsigned int elements_size;
  35. unsigned int *elements;
  36. unsigned char hit;
  37. } xdebug_path;
  38. /* Contains information for paths that belong to a set of branches (as stored in xdebug_branch_info) */
  39. typedef struct _xdebug_path_info {
  40. unsigned int paths_count; /* The number of collected paths */
  41. unsigned int paths_size; /* The amount of slots allocated for storing paths */
  42. xdebug_path **paths; /* An array of possible paths */
  43. xdebug_hash *path_hash; /* A hash where each path's key is the sequence of followed branches, pointing to a path in the paths array */
  44. } xdebug_path_info;
  45. /* Contains all the branch information for a specific function */
  46. typedef struct _xdebug_branch_info {
  47. unsigned int size; /* The number of stored branches */
  48. xdebug_set *entry_points; /* A set that contains all the entry points into the function */
  49. xdebug_set *starts; /* A set of opcodes nrs where each branch starts */
  50. xdebug_set *ends; /* A set of opcodes nrs where each ends starts */
  51. xdebug_branch *branches; /* Information about each branch */
  52. xdebug_path_info path_info; /* The paths that can be created out of these branches */
  53. } xdebug_branch_info;
  54. xdebug_branch_info *xdebug_branch_info_create(unsigned int size);
  55. void xdebug_branch_info_update(xdebug_branch_info *branch_info, unsigned int pos, unsigned int lineno, unsigned int outidx, unsigned int jump_pos);
  56. void xdebug_branch_post_process(zend_op_array *opa, xdebug_branch_info *branch_info);
  57. void xdebug_branch_find_paths(xdebug_branch_info *branch_info);
  58. void xdebug_branch_info_dump(zend_op_array *opa, xdebug_branch_info *branch_info TSRMLS_DC);
  59. void xdebug_branch_info_add_branches_and_paths(char *filename, char *function_name, xdebug_branch_info *branch_info TSRMLS_DC);
  60. void xdebug_branch_info_free(xdebug_branch_info *branch_info);
  61. void xdebug_path_add(xdebug_path *path, unsigned int nr);
  62. xdebug_path *xdebug_path_new(xdebug_path *old_path);
  63. void xdebug_path_info_dump(xdebug_path *path TSRMLS_DC);
  64. void xdebug_path_free(xdebug_path *path);
  65. xdebug_path_info *xdebug_path_info_ctor(void);
  66. void xdebug_path_info_dtor(xdebug_path_info *path_info);
  67. void xdebug_path_info_add_path_for_level(xdebug_path_info *path_info, xdebug_path *path, unsigned int level TSRMLS_DC);
  68. xdebug_path *xdebug_path_info_get_path_for_level(xdebug_path_info *path_info, unsigned int level TSRMLS_DC);
  69. void xdebug_create_key_for_path(xdebug_path *path, xdebug_str *str);
  70. void xdebug_branch_info_mark_reached(char *filename, char *function_name, zend_op_array *op_array, long opcode_nr TSRMLS_DC);
  71. void xdebug_branch_info_mark_end_of_function_reached(char *filename, char *function_name, char *key, int key_len TSRMLS_DC);
  72. #endif