aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-01-26 23:42:58 +0000
committerIan Lance Taylor <ian@airs.com>1996-01-26 23:42:58 +0000
commit86aac8eabe837aed915022d188da157ba5736c09 (patch)
tree7f6c7fad1c561070c8977aaee8c7a7c587ecc9f5 /bfd/elf.c
parenta77bf669dce7d953f2c32b162ccec49ed844f962 (diff)
downloadgdb-86aac8eabe837aed915022d188da157ba5736c09.zip
gdb-86aac8eabe837aed915022d188da157ba5736c09.tar.gz
gdb-86aac8eabe837aed915022d188da157ba5736c09.tar.bz2
* syms.c: Include "bfdlink.h".
(struct stab_find_info): Define. (_bfd_stab_section_find_nearest_line): New function. * libbfd-in.h (_bfd_stab_section_find_nearest_line): Declare. * libbfd.h: Rebuild. * elf-bfd.h (struct elf_obj_tdata): Add line_info field. * elf.c (_bfd_elf_find_nearest_line): Try calling _bfd_stab_section_find_nearest_line before searching the ELF symbol table. Find the closest STT_FUNC symbol, not the last one. * libcoff-in.h (coff_data_type): Add line_info field. * libcoff.h: Rebuild. * coffgen.c (coff_find_nearest_line): Try calling _bfd_stab_section_find_nearest_line before searching the COFF symbol table. * Makefile.in: Rebuild dependencies.
Diffstat (limited to 'bfd/elf.c')
-rw-r--r--bfd/elf.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/bfd/elf.c b/bfd/elf.c
index e12a885..95181c6 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -554,6 +554,7 @@ _bfd_elf_link_hash_newfunc (entry, table, string)
ret->weakdef = NULL;
ret->got_offset = (bfd_vma) -1;
ret->plt_offset = (bfd_vma) -1;
+ ret->linker_section_pointer = (elf_linker_section_pointers_t *)0;
ret->type = STT_NOTYPE;
ret->elf_link_hash_flags = 0;
}
@@ -3142,15 +3143,26 @@ _bfd_elf_find_nearest_line (abfd,
CONST char **functionname_ptr;
unsigned int *line_ptr;
{
+ boolean found;
const char *filename;
asymbol *func;
+ bfd_vma low_func;
asymbol **p;
+ if (! _bfd_stab_section_find_nearest_line (abfd, symbols, section, offset,
+ &found, filename_ptr,
+ functionname_ptr, line_ptr,
+ &elf_tdata (abfd)->line_info))
+ return false;
+ if (found)
+ return true;
+
if (symbols == NULL)
return false;
filename = NULL;
func = NULL;
+ low_func = 0;
for (p = symbols; *p != NULL; p++)
{
@@ -3169,9 +3181,13 @@ _bfd_elf_find_nearest_line (abfd,
filename = bfd_asymbol_name (&q->symbol);
break;
case STT_FUNC:
- if (func == NULL
- || q->symbol.value <= offset)
- func = (asymbol *) q;
+ if (q->symbol.section == section
+ && q->symbol.value >= low_func
+ && q->symbol.value <= offset)
+ {
+ func = (asymbol *) q;
+ low_func = q->symbol.value;
+ }
break;
}
}