1 #include <source.h>
2
find_section(source_t * source,Elf64_Addr address,Elf_Scn ** scn,GElf_Shdr * shdr,Elf_Data ** data)3 void find_section(source_t *source, Elf64_Addr address,
4 Elf_Scn **scn,
5 GElf_Shdr *shdr,
6 Elf_Data **data)
7 {
8 range_t *range = find_range(source->sorted_sections, address);
9 FAILIF(NULL == range,
10 "Cannot match address %lld to any range in [%s]!\n",
11 address,
12 source->name);
13 *scn = (Elf_Scn *)range->user;
14 ASSERT(*scn);
15 FAILIF_LIBELF(NULL == gelf_getshdr(*scn, shdr), gelf_getshdr);
16 *data = elf_getdata(*scn, NULL);
17 FAILIF_LIBELF(NULL == *data, elf_getdata);
18 }
19