/* Get a Dwarf from live kernel image */ static Dwarf *dwfl_init_live_kernel_dwarf(Dwarf_Addr addr, Dwfl **dwflp, Dwarf_Addr *bias) { Dwarf *dbg; if (!dwflp) return NULL; *dwflp = dwfl_begin(&kernel_callbacks); if (!*dwflp) return NULL; /* Load the kernel dwarves: Don't care the result here */ dwfl_linux_kernel_report_kernel(*dwflp); dwfl_linux_kernel_report_modules(*dwflp); dbg = dwfl_addrdwarf(*dwflp, addr, bias); /* Here, check whether we could get a real dwarf */ if (!dbg) { pr_debug("Failed to find kernel dwarf at %lx\n", (unsigned long)addr); dwfl_end(*dwflp); *dwflp = NULL; } return dbg; }
static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self, Dwarf_Addr addr) { self->dwfl = dwfl_begin(&kernel_callbacks); if (!self->dwfl) return -EINVAL; dwfl_linux_kernel_report_kernel(self->dwfl); dwfl_linux_kernel_report_modules(self->dwfl); self->dbg = dwfl_addrdwarf(self->dwfl, addr, &self->bias); if (!self->dbg) { pr_debug("Failed to find kernel dwarf at %lx\n", (unsigned long)addr); dwfl_end(self->dwfl); memset(self, 0, sizeof(*self)); return -ENOENT; } return 0; }
/* Get a Dwarf from live kernel image */ static int debuginfo__init_online_kernel_dwarf(struct debuginfo *self, Dwarf_Addr addr) { self->dwfl = dwfl_begin(&kernel_callbacks); if (!self->dwfl) return -EINVAL; /* Load the kernel dwarves: Don't care the result here */ dwfl_linux_kernel_report_kernel(self->dwfl); dwfl_linux_kernel_report_modules(self->dwfl); self->dbg = dwfl_addrdwarf(self->dwfl, addr, &self->bias); /* Here, check whether we could get a real dwarf */ if (!self->dbg) { pr_debug("Failed to find kernel dwarf at %lx\n", (unsigned long)addr); dwfl_end(self->dwfl); memset(self, 0, sizeof(*self)); return -ENOENT; } return 0; }