• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LIBLOCKDEP_LINUX_KALLSYMS_H_
3 #define _LIBLOCKDEP_LINUX_KALLSYMS_H_
4 
5 #include <linux/kernel.h>
6 #include <stdio.h>
7 #include <unistd.h>
8 
9 #define KSYM_NAME_LEN 512
10 
11 struct module;
12 
kallsyms_lookup(unsigned long addr,unsigned long * symbolsize,unsigned long * offset,char ** modname,char * namebuf)13 static inline const char *kallsyms_lookup(unsigned long addr,
14 					  unsigned long *symbolsize,
15 					  unsigned long *offset,
16 					  char **modname, char *namebuf)
17 {
18 	return NULL;
19 }
20 
21 #ifdef HAVE_BACKTRACE_SUPPORT
22 #include <execinfo.h>
23 #include <stdlib.h>
print_ip_sym(const char * loglvl,unsigned long ip)24 static inline void print_ip_sym(const char *loglvl, unsigned long ip)
25 {
26 	char **name;
27 
28 	name = backtrace_symbols((void **)&ip, 1);
29 
30 	dprintf(STDOUT_FILENO, "%s\n", *name);
31 
32 	free(name);
33 }
34 #else
print_ip_sym(const char * loglvl,unsigned long ip)35 static inline void print_ip_sym(const char *loglvl, unsigned long ip) {}
36 #endif
37 
38 #endif
39