kallsyms.h 646 B

12345678910111213141516171819202122232425262728293031323334
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _LIBLOCKDEP_LINUX_KALLSYMS_H_
  3. #define _LIBLOCKDEP_LINUX_KALLSYMS_H_
  4. #include <linux/kernel.h>
  5. #include <stdio.h>
  6. #include <unistd.h>
  7. #define KSYM_NAME_LEN 128
  8. struct module;
  9. static inline const char *kallsyms_lookup(unsigned long addr,
  10. unsigned long *symbolsize,
  11. unsigned long *offset,
  12. char **modname, char *namebuf)
  13. {
  14. return NULL;
  15. }
  16. #include <execinfo.h>
  17. #include <stdlib.h>
  18. static inline void print_ip_sym(const char *loglvl, unsigned long ip)
  19. {
  20. char **name;
  21. name = backtrace_symbols((void **)&ip, 1);
  22. dprintf(STDOUT_FILENO, "%s\n", *name);
  23. free(name);
  24. }
  25. #endif