Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sasha Levin | 5634bd7 | 2013-06-13 18:41:17 -0400 | [diff] [blame] | 2 | #ifndef _LIBLOCKDEP_LINUX_KALLSYMS_H_ |
| 3 | #define _LIBLOCKDEP_LINUX_KALLSYMS_H_ |
| 4 | |
| 5 | #include <linux/kernel.h> |
| 6 | #include <stdio.h> |
Alexander Sverdlin | 20fb654 | 2017-05-25 12:58:46 +0000 | [diff] [blame] | 7 | #include <unistd.h> |
Sasha Levin | 5634bd7 | 2013-06-13 18:41:17 -0400 | [diff] [blame] | 8 | |
| 9 | #define KSYM_NAME_LEN 128 |
| 10 | |
| 11 | struct module; |
| 12 | |
| 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 | #include <execinfo.h> |
| 22 | #include <stdlib.h> |
| 23 | static inline void print_ip_sym(unsigned long ip) |
| 24 | { |
| 25 | char **name; |
| 26 | |
| 27 | name = backtrace_symbols((void **)&ip, 1); |
| 28 | |
Alexander Sverdlin | 20fb654 | 2017-05-25 12:58:46 +0000 | [diff] [blame] | 29 | dprintf(STDOUT_FILENO, "%s\n", *name); |
Sasha Levin | 5634bd7 | 2013-06-13 18:41:17 -0400 | [diff] [blame] | 30 | |
| 31 | free(name); |
| 32 | } |
| 33 | |
| 34 | #endif |