probe-event.h 4.1 KB

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