probe-finder.h 1.6 KB

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