diff options
author | Mark Kettenis <kettenis@gnu.org> | 2000-08-07 10:56:22 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2000-08-07 10:56:22 +0000 |
commit | 400e89a03a9ae4b046be426791b82d734c45fc64 (patch) | |
tree | 05a0154868d0b04ad183a1e5a160cfeaac8ac7b3 | |
parent | 2eebac516a21fa665d63bda4d846d55ce45d0cd7 (diff) | |
download | gdb-400e89a03a9ae4b046be426791b82d734c45fc64.tar.gz |
* solib.c (bfd_lookup_symbol): Fall back on the dynamic symbol
table if the symbol couldn't be found in the normal symbol table
(i.e. if the shared object in question was stripped).
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/solib.c | 32 |
2 files changed, 36 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0c47be7e05c..aad8daad8b9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2000-05-21 Mark Kettenis <kettenis@gnu.org> + + * solib.c (bfd_lookup_symbol): Fall back on the dynamic symbol + table if the symbol couldn't be found in the normal symbol table + (i.e. if the shared object in question was stripped). + 2000-08-06 Kevin Buettner <kevinb@redhat.com> * ch-exp.c (parse_opt_name_string): Protoize. [Thanks to Eli diff --git a/gdb/solib.c b/gdb/solib.c index b6cfcaa5597..a95741125c0 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -1,5 +1,5 @@ /* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger. - Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999 + Copyright 1990, 91, 92, 93, 94, 95, 96, 98, 1999, 2000 Free Software Foundation, Inc. This file is part of GDB. @@ -528,7 +528,35 @@ bfd_lookup_symbol (bfd *abfd, char *symname) } do_cleanups (back_to); } - return (symaddr); + + if (symaddr) + return symaddr; + + /* On FreeBSD, the dynamic linker is stripped by default. So we'll + have to check the dynamic string table too. */ + + storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd); + + if (storage_needed > 0) + { + symbol_table = (asymbol **) xmalloc (storage_needed); + back_to = make_cleanup (free, (PTR) symbol_table); + number_of_symbols = bfd_canonicalize_dynamic_symtab (abfd, symbol_table); + + for (i = 0; i < number_of_symbols; i++) + { + sym = *symbol_table++; + if (STREQ (sym->name, symname)) + { + /* Bfd symbols are section relative. */ + symaddr = sym->value + sym->section->vma; + break; + } + } + do_cleanups (back_to); + } + + return symaddr; } #ifdef HANDLE_SVR4_EXEC_EMULATORS |