userspace/kp_symbol.h - ktap

Data types defined

Macros defined

Source code

  1. /*
  2. * symbol.h - extract symbols from DSO.
  3. *
  4. * This file is part of ktap by Jovi Zhangwei.
  5. *
  6. * Copyright (C) 2013 Azat Khuzhin <a3at.mail@gmail.com>.
  7. *
  8. * ktap is free software; you can redistribute it and/or modify it
  9. * under the terms and conditions of the GNU General Public License,
  10. * version 2, as published by the Free Software Foundation.
  11. *
  12. * ktap is distributed in the hope it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along with
  18. * this program; if not, write to the Free Software Foundation, Inc.,
  19. * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  20. */


  21. #define FIND_SYMBOL 1
  22. #define FIND_STAPSDT_NOTE 2

  23. #ifndef NO_LIBELF

  24. #include <gelf.h>
  25. #include <sys/queue.h>

  26. typedef GElf_Addr vaddr_t;
  27. typedef int (*symbol_actor)(const char *name, vaddr_t addr, void *arg);

  28. /**
  29. * Parse all DSO symbols/sdt notes and all for every of them
  30. * an actor.
  31. *
  32. * @exec - path to DSO
  33. * @type - see FIND_*
  34. * @symbol_actor - actor to call (callback)
  35. * @arg - argument for @actor
  36. *
  37. * @return
  38. * If there have errors, return negative value;
  39. * No symbols found, return 0;
  40. * Otherwise return number of dso symbols found
  41. */
  42. int
  43. parse_dso_symbols(const char *exec, int type, symbol_actor actor, void *arg);
  44. #endif