/* Try to open distro debuginfo files */
dso = dso__new(path); if (!dso) goto out;
/* * Set the build id for DSO_BINARY_TYPE__BUILDID_DEBUGINFO. Don't block * incase the path isn't for a regular file.
*/
assert(!dso__has_build_id(dso)); if (filename__read_build_id(path, &bid, /*block=*/false) > 0)
dso__set_build_id(dso, &bid);
/* if failed to open all distro debuginfo, open given binary */
symbol__join_symfs(buf, path); return __debuginfo__new(buf);
}
void debuginfo__delete(struct debuginfo *dbg)
{ if (dbg) { if (dbg->dwfl)
dwfl_end(dbg->dwfl);
free(dbg);
}
}
/* For the kernel module, we need a special code to get a DIE */ int debuginfo__get_text_offset(struct debuginfo *dbg, Dwarf_Addr *offs, bool adjust_offset)
{ int n, i;
Elf32_Word shndx;
Elf_Scn *scn;
Elf *elf;
GElf_Shdr mem, *shdr; constchar *p;
elf = dwfl_module_getelf(dbg->mod, &dbg->bias); if (!elf) return -EINVAL;
/* Get the number of relocations */
n = dwfl_module_relocations(dbg->mod); if (n < 0) return -ENOENT; /* Search the relocation related .text section */ for (i = 0; i < n; i++) {
p = dwfl_module_relocation_info(dbg->mod, i, &shndx); if (strcmp(p, ".text") == 0) { /* OK, get the section header */
scn = elf_getscn(elf, shndx); if (!scn) return -ENOENT;
shdr = gelf_getshdr(scn, &mem); if (!shdr) return -ENOENT;
*offs = shdr->sh_addr; if (adjust_offset)
*offs -= shdr->sh_offset;
}
} return 0;
}
#ifdef HAVE_DEBUGINFOD_SUPPORT int get_source_from_debuginfod(constchar *raw_path, constchar *sbuild_id, char **new_path)
{
debuginfod_client *c = debuginfod_begin(); constchar *p = raw_path; int fd;
if (!c) return -ENOMEM;
fd = debuginfod_find_source(c, (constunsignedchar *)sbuild_id,
0, p, new_path);
pr_debug("Search %s from debuginfod -> %d\n", p, fd); if (fd >= 0)
close(fd);
debuginfod_end(c); if (fd < 0) {
pr_debug("Failed to find %s in debuginfod (%s)\n",
raw_path, sbuild_id); return -ENOENT;
}
pr_debug("Got a source %s\n", *new_path);
return 0;
} #endif/* HAVE_DEBUGINFOD_SUPPORT */
Messung V0.5
¤ Dauer der Verarbeitung: 0.11 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.