probe-event.h 4.1 KB

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