probe-event.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef _PROBE_EVENT_H
  2. #define _PROBE_EVENT_H
  3. #include <stdbool.h>
  4. #include "strlist.h"
  5. extern bool probe_event_dry_run;
  6. /* kprobe-tracer tracing point */
  7. struct probe_trace_point {
  8. char *symbol; /* Base symbol */
  9. unsigned long offset; /* Offset from symbol */
  10. bool retprobe; /* Return probe flag */
  11. };
  12. /* probe-tracer tracing argument referencing offset */
  13. struct probe_trace_arg_ref {
  14. struct probe_trace_arg_ref *next; /* Next reference */
  15. long offset; /* Offset value */
  16. };
  17. /* kprobe-tracer tracing argument */
  18. struct probe_trace_arg {
  19. char *name; /* Argument name */
  20. char *value; /* Base value */
  21. char *type; /* Type name */
  22. struct probe_trace_arg_ref *ref; /* Referencing offset */
  23. };
  24. /* kprobe-tracer tracing event (point + arg) */
  25. struct probe_trace_event {
  26. char *event; /* Event name */
  27. char *group; /* Group name */
  28. struct probe_trace_point point; /* Trace point */
  29. int nargs; /* Number of args */
  30. struct probe_trace_arg *args; /* Arguments */
  31. };
  32. /* Perf probe probing point */
  33. struct perf_probe_point {
  34. char *file; /* File path */
  35. char *function; /* Function name */
  36. int line; /* Line number */
  37. bool retprobe; /* Return probe flag */
  38. char *lazy_line; /* Lazy matching pattern */
  39. unsigned long offset; /* Offset from function entry */
  40. };
  41. /* Perf probe probing argument field chain */
  42. struct perf_probe_arg_field {
  43. struct perf_probe_arg_field *next; /* Next field */
  44. char *name; /* Name of the field */
  45. long index; /* Array index number */
  46. bool ref; /* Referencing flag */
  47. };
  48. /* Perf probe probing argument */
  49. struct perf_probe_arg {
  50. char *name; /* Argument name */
  51. char *var; /* Variable name */
  52. char *type; /* Type name */
  53. struct perf_probe_arg_field *field; /* Structure fields */
  54. };
  55. /* Perf probe probing event (point + arg) */
  56. struct perf_probe_event {
  57. char *event; /* Event name */
  58. char *group; /* Group name */
  59. struct perf_probe_point point; /* Probe point */
  60. int nargs; /* Number of arguments */
  61. struct perf_probe_arg *args; /* Arguments */
  62. };
  63. /* Line number container */
  64. struct line_node {
  65. struct list_head list;
  66. int line;
  67. };
  68. /* Line range */
  69. struct line_range {
  70. char *file; /* File name */
  71. char *function; /* Function name */
  72. int start; /* Start line number */
  73. int end; /* End line number */
  74. int offset; /* Start line offset */
  75. char *path; /* Real path name */
  76. char *comp_dir; /* Compile directory */
  77. struct list_head line_list; /* Visible lines */
  78. };
  79. /* Command string to events */
  80. extern int parse_perf_probe_command(const char *cmd,
  81. struct perf_probe_event *pev);
  82. /* Events to command string */
  83. extern char *synthesize_perf_probe_command(struct perf_probe_event *pev);
  84. extern char *synthesize_probe_trace_command(struct probe_trace_event *tev);
  85. extern int synthesize_perf_probe_arg(struct perf_probe_arg *pa, char *buf,
  86. size_t len);
  87. /* Check the perf_probe_event needs debuginfo */
  88. extern bool perf_probe_event_need_dwarf(struct perf_probe_event *pev);
  89. /* Release event contents */
  90. extern void clear_perf_probe_event(struct perf_probe_event *pev);
  91. /* Command string to line-range */
  92. extern int parse_line_range_desc(const char *cmd, struct line_range *lr);
  93. extern int add_perf_probe_events(struct perf_probe_event *pevs, int npevs,
  94. bool force_add, int max_probe_points);
  95. extern int del_perf_probe_events(struct strlist *dellist);
  96. extern int show_perf_probe_events(void);
  97. extern int show_line_range(struct line_range *lr);
  98. /* Maximum index number of event-name postfix */
  99. #define MAX_EVENT_INDEX 1024
  100. #endif /*_PROBE_EVENT_H */