Changeset View
Changeset View
Standalone View
Standalone View
head/contrib/elftoolchain/libdwarf/libdwarf_elf_init.c
Show First 20 Lines • Show All 254 Lines • ▼ Show 20 Lines | _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error *error) | ||||
(void) elf_errno(); | (void) elf_errno(); | ||||
while ((scn = elf_nextscn(elf, scn)) != NULL) { | while ((scn = elf_nextscn(elf, scn)) != NULL) { | ||||
if (gelf_getshdr(scn, &sh) == NULL) { | if (gelf_getshdr(scn, &sh) == NULL) { | ||||
DWARF_SET_ELF_ERROR(dbg, error); | DWARF_SET_ELF_ERROR(dbg, error); | ||||
ret = DW_DLE_ELF; | ret = DW_DLE_ELF; | ||||
goto fail_cleanup; | goto fail_cleanup; | ||||
} | } | ||||
if (sh.sh_type == SHT_NOBITS) | |||||
continue; | |||||
if ((name = elf_strptr(elf, e->eo_strndx, sh.sh_name)) == | if ((name = elf_strptr(elf, e->eo_strndx, sh.sh_name)) == | ||||
NULL) { | NULL) { | ||||
DWARF_SET_ELF_ERROR(dbg, error); | DWARF_SET_ELF_ERROR(dbg, error); | ||||
ret = DW_DLE_ELF; | ret = DW_DLE_ELF; | ||||
goto fail_cleanup; | goto fail_cleanup; | ||||
} | } | ||||
if (!strcmp(name, ".symtab")) { | if (!strcmp(name, ".symtab")) { | ||||
Show All 36 Lines | _dwarf_elf_init(Dwarf_Debug dbg, Elf *elf, Dwarf_Error *error) | ||||
scn = NULL; | scn = NULL; | ||||
j = 0; | j = 0; | ||||
while ((scn = elf_nextscn(elf, scn)) != NULL && j < n) { | while ((scn = elf_nextscn(elf, scn)) != NULL && j < n) { | ||||
if (gelf_getshdr(scn, &sh) == NULL) { | if (gelf_getshdr(scn, &sh) == NULL) { | ||||
DWARF_SET_ELF_ERROR(dbg, error); | DWARF_SET_ELF_ERROR(dbg, error); | ||||
ret = DW_DLE_ELF; | ret = DW_DLE_ELF; | ||||
goto fail_cleanup; | goto fail_cleanup; | ||||
} | } | ||||
if (sh.sh_type == SHT_NOBITS) | |||||
continue; | |||||
memcpy(&e->eo_shdr[j], &sh, sizeof(sh)); | memcpy(&e->eo_shdr[j], &sh, sizeof(sh)); | ||||
if ((name = elf_strptr(elf, e->eo_strndx, sh.sh_name)) == | if ((name = elf_strptr(elf, e->eo_strndx, sh.sh_name)) == | ||||
NULL) { | NULL) { | ||||
DWARF_SET_ELF_ERROR(dbg, error); | DWARF_SET_ELF_ERROR(dbg, error); | ||||
ret = DW_DLE_ELF; | ret = DW_DLE_ELF; | ||||
goto fail_cleanup; | goto fail_cleanup; | ||||
▲ Show 20 Lines • Show All 68 Lines • Show Last 20 Lines |