probe-finder.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. /* Workaround for undefined _MIPS_SZLONG bug in libdwarf.h: */
  29. #ifndef _MIPS_SZLONG
  30. # define _MIPS_SZLONG 0
  31. #endif
  32. #include <dwarf.h>
  33. #include <libdwarf.h>
  34. struct probe_finder {
  35. struct probe_point *pp; /* Target probe point */
  36. /* For function searching */
  37. Dwarf_Addr addr; /* Address */
  38. Dwarf_Unsigned fno; /* File number */
  39. Dwarf_Unsigned lno; /* Line number */
  40. Dwarf_Off inl_offs; /* Inline offset */
  41. Dwarf_Die cu_die; /* Current CU */
  42. /* For variable searching */
  43. Dwarf_Addr cu_base; /* Current CU base address */
  44. Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
  45. const char *var; /* Current variable name */
  46. char *buf; /* Current output buffer */
  47. int len; /* Length of output buffer */
  48. };
  49. #endif /* NO_LIBDWARF */
  50. #endif /*_PROBE_FINDER_H */