aboutsummaryrefslogtreecommitdiff
path: root/gdb/elfread.c
diff options
context:
space:
mode:
authorPeter Schauer <Peter.Schauer@mytum.de>1994-04-01 08:50:03 +0000
committerPeter Schauer <Peter.Schauer@mytum.de>1994-04-01 08:50:03 +0000
commit38b90473602f5c7295242ec0cce8f804d171bcbf (patch)
tree9e835890af03c6a3c8c8cc2205180734280ad1a3 /gdb/elfread.c
parent01f8d30971233e0c259278adf41cc870837e3aed (diff)
downloadgdb-38b90473602f5c7295242ec0cce8f804d171bcbf.zip
gdb-38b90473602f5c7295242ec0cce8f804d171bcbf.tar.gz
gdb-38b90473602f5c7295242ec0cce8f804d171bcbf.tar.bz2
For SVR4 targets, enable gdb to set breakpoints in shared
library functions before the executable is run. * elfread.c (elf_symtab_read): Handle symbols for shared library functions. * sparc-tdep.c (in_solib_trampoline): Renamed to in_plt_section and moved to objfiles.c. * objfiles.c (in_plt_section): Moved to here from sparc-tdep. * config/tm-sysv4.h (IN_SOLIB_TRAMPOLINE): Use new in_plt_section. * config/sparc/tm-sun4sol2.h (IN_SOLIB_TRAMPOLINE): Removed, the new generic definition from tm-sysv4.h works for Solaris.
Diffstat (limited to 'gdb/elfread.c')
-rw-r--r--gdb/elfread.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 89df794..11d4b7e 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -311,7 +311,29 @@ elf_symtab_read (abfd, addr, objfile)
/* For non-absolute symbols, use the type of the section
they are relative to, to intuit text/data. Bfd provides
no way of figuring this out for absolute symbols. */
- if (sym -> section == &bfd_abs_section)
+ if (sym -> section == &bfd_und_section
+ && (sym -> flags & BSF_GLOBAL)
+ && (sym -> flags & BSF_FUNCTION))
+ {
+ /* Symbol is a reference to a function defined in
+ a shared library.
+ If its value is non zero then it is usually the
+ absolute address of the corresponding entry in
+ the procedure linkage table.
+ If its value is zero then the dynamic linker has to
+ resolve the symbol. We are unable to find any
+ meaningful address for this symbol in the
+ executable file, so we skip it.
+ Irix 5 has a zero value for all shared library functions
+ in the main symbol table. The dynamic symbol table
+ would provide the right values, but BFD currently
+ cannot handle dynamic ELF symbol tables. */
+ ms_type = mst_solib_trampoline;
+ symaddr = sym -> value;
+ if (symaddr == 0)
+ continue;
+ }
+ else if (sym -> section == &bfd_abs_section)
{
ms_type = mst_abs;
}