probe-finder.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. /* Output */
  20. int found; /* Number of found probe points */
  21. char *probes[MAX_PROBES]; /* Output buffers (will be allocated)*/
  22. };
  23. #ifndef NO_LIBDWARF
  24. extern int find_probepoint(int fd, struct probe_point *pp);
  25. #include <libdwarf/dwarf.h>
  26. #include <libdwarf/libdwarf.h>
  27. struct probe_finder {
  28. struct probe_point *pp; /* Target probe point */
  29. /* For function searching */
  30. Dwarf_Addr addr; /* Address */
  31. Dwarf_Unsigned fno; /* File number */
  32. Dwarf_Off inl_offs; /* Inline offset */
  33. /* For variable searching */
  34. Dwarf_Addr cu_base; /* Current CU base address */
  35. Dwarf_Locdesc fbloc; /* Location of Current Frame Base */
  36. const char *var; /* Current variable name */
  37. char *buf; /* Current output buffer */
  38. int len; /* Length of output buffer */
  39. };
  40. #endif /* NO_LIBDWARF */
  41. #endif /*_PROBE_FINDER_H */