in src/backward.h [1454:1518]
void find_in_section(
bfd_vma addr,
bfd_vma base_addr,
bfd_fileobject& fobj,
asection* section,
find_sym_result& result)
{
if (result.found)
return;
# ifdef bfd_get_section_flags
if ((bfd_get_section_flags(fobj.handle.get(), section) & SEC_ALLOC) == 0)
# else
if ((bfd_section_flags(section) & SEC_ALLOC) == 0)
# endif
return; // a debug section is never loaded automatically.
# ifdef bfd_get_section_vma
bfd_vma sec_addr = bfd_get_section_vma(fobj.handle.get(), section);
# else
bfd_vma sec_addr = bfd_section_vma(section);
# endif
# ifdef bfd_get_section_size
bfd_size_type size = bfd_get_section_size(section);
# else
bfd_size_type size = bfd_section_size(section);
# endif
// are we in the boundaries of the section?
if (addr < sec_addr || addr >= sec_addr + size) {
addr -= base_addr; // oups, a relocated object, lets try again...
if (addr < sec_addr || addr >= sec_addr + size) {
return;
}
}
# if defined(__clang__)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
# endif
if (!result.found && fobj.symtab) {
result.found = bfd_find_nearest_line(
fobj.handle.get(),
section,
fobj.symtab.get(),
addr - sec_addr,
&result.filename,
&result.funcname,
&result.line);
}
if (!result.found && fobj.dynamic_symtab) {
result.found = bfd_find_nearest_line(
fobj.handle.get(),
section,
fobj.dynamic_symtab.get(),
addr - sec_addr,
&result.filename,
&result.funcname,
&result.line);
}
# if defined(__clang__)
# pragma clang diagnostic pop
# endif
}