probe-finder.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. /* Inputs */
  13. char *file; /* File name */
  14. int line; /* Line number */
  15. char *function; /* Function name */
  16. int offset; /* Offset bytes */
  17. int nr_args; /* Number of arguments */
  18. char **args; /* Arguments */
  19. int retprobe; /* Return probe */
  20. /* Output */
  21. int found; /* Number of found probe points */
  22. char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
  23. };
  24. #ifndef NO_LIBDWARF
  25. extern int find_probepoint(int fd, struct probe_point *pp);
  26. #include <libdwarf/dwarf.h>
  27. #include <libdwarf/libdwarf.h>
  28. struct probe_finder {
  29. struct probe_point *pp; /* Target probe point */
  30. /* For function searching */
  31. Dwarf_Addr addr; /* Address */
  32. Dwarf_Unsigned fno; /* File number */
  33. Dwarf_Unsigned lno; /* Line number */
  34. Dwarf_Off inl_offs; /* Inline offset */
  35. Dwarf_Die cu_die; /* Current CU */
  36. /* For variable searching */
  37. Dwarf_Addr cu_base; /* Current CU base address */
  38. Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
  39. const char *var; /* Current variable name */
  40. char *buf; /* Current output buffer */
  41. int len; /* Length of output buffer */
  42. };
  43. #endif /* NO_LIBDWARF */
  44. #endif /*_PROBE_FINDER_H */