static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self, Dwarf_Addr addr __used) { const char *path = kernel_get_module_path("kernel"); if (!path) { pr_err("Failed to find vmlinux path\n"); return -ENOENT; } pr_debug2("Use file %s for debuginfo\n", path); return debuginfo__init_offline_dwarf(self, path); }
/* With older elfutils, this just support kernel module... */ static Dwarf *dwfl_init_live_kernel_dwarf(Dwarf_Addr addr __used, Dwfl **dwflp, Dwarf_Addr *bias) { int fd; const char *path = kernel_get_module_path("kernel"); if (!path) { pr_err("Failed to find vmlinux path\n"); return NULL; } pr_debug2("Use file %s for debuginfo\n", path); fd = open(path, O_RDONLY); if (fd < 0) return NULL; return dwfl_init_offline_dwarf(fd, dwflp, bias); }
static int __linux_kernel_find_elf(Dwfl_Module *mod, void **userdata, const char *module_name, Dwarf_Addr base, char **file_name, Elf **elfp) { int fd; const char *path = kernel_get_module_path(module_name); pr_debug2("Use file %s for %s\n", path, module_name); if (path) { fd = open(path, O_RDONLY); if (fd >= 0) { *file_name = strdup(path); return fd; } } return dwfl_linux_kernel_find_elf(mod, userdata, module_name, base, file_name, elfp); }