probe-event.h 4.7 KB

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