probe-finder.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #ifndef _PROBE_FINDER_H
  2. #define _PROBE_FINDER_H
  3. #define MAX_PATH_LEN 256
  4. #define MAX_PROBE_BUFFER 1024
  5. #define MAX_PROBES 128
  6. static inline int is_c_varname(const char *name)
  7. {
  8. /* TODO */
  9. return isalpha(name[0]) || name[0] == '_';
  10. }
  11. struct probe_point {
  12. char *event; /* Event name */
  13. char *group; /* Event group */
  14. /* Inputs */
  15. char *file; /* File name */
  16. int line; /* Line number */
  17. char *function; /* Function name */
  18. int offset; /* Offset bytes */
  19. int nr_args; /* Number of arguments */
  20. char **args; /* Arguments */
  21. int retprobe; /* Return probe */
  22. /* Output */
  23. int found; /* Number of found probe points */
  24. char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
  25. };
  26. #ifndef NO_LIBDWARF
  27. extern int find_probepoint(int fd, struct probe_point *pp);
  28. #include <libdwarf/dwarf.h>
  29. #include <libdwarf/libdwarf.h>
  30. struct probe_finder {
  31. struct probe_point *pp; /* Target probe point */
  32. /* For function searching */
  33. Dwarf_Addr addr; /* Address */
  34. Dwarf_Unsigned fno; /* File number */
  35. Dwarf_Unsigned lno; /* Line number */
  36. Dwarf_Off inl_offs; /* Inline offset */
  37. Dwarf_Die cu_die; /* Current CU */
  38. /* For variable searching */
  39. Dwarf_Addr cu_base; /* Current CU base address */
  40. Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
  41. const char *var; /* Current variable name */
  42. char *buf; /* Current output buffer */
  43. int len; /* Length of output buffer */
  44. };
  45. #endif /* NO_LIBDWARF */
  46. #endif /*_PROBE_FINDER_H */