aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-frv.c
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2011-08-30 02:48:05 +0000
committerYao Qi <yao@codesourcery.com>2011-08-30 02:48:05 +0000
commitcb457ae2842770922180ce15b4885ff7b224bf95 (patch)
tree5a9c61c90c03d02339fe5a3926632370f9a462be /gdb/solib-frv.c
parent83d1a36ae4e69a3bc19f9aae6c009e7d91d31ad6 (diff)
downloadgdb-cb457ae2842770922180ce15b4885ff7b224bf95.zip
gdb-cb457ae2842770922180ce15b4885ff7b224bf95.tar.gz
gdb-cb457ae2842770922180ce15b4885ff7b224bf95.tar.bz2
gdb/
* solib-dsbt.c (bfd_lookup_symbol): Removed. (cmp_name): New. (enable_break2): Update caller. * solib-frv.c (bfd_lookup_symbol): Removed. (cmp_name): New. (enable_break2): Update caller. * solib-pa64.c (bfd_lookup_symbol): Removed. (cmp_name): New. * solib-svr4.c (bfd_lookup_symbol): Removed. (cmp_name_and_sec_flags): New. (enable_break): Update caller. * solib.c (gdb_bfd_lookup_symbol_from_symtab): New. (gdb_bfd_lookup_symbol_from_dyn_symtab): New. (gdb_bfd_lookup_symbol): New. * solib.h: Functions declarations.
Diffstat (limited to 'gdb/solib-frv.c')
-rw-r--r--gdb/solib-frv.c82
1 files changed, 10 insertions, 72 deletions
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index e1c16d9..acb35a2 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -239,77 +239,6 @@ static void frv_relocate_main_executable (void);
static CORE_ADDR main_got (void);
static int enable_break2 (void);
-/* Lookup the value for a specific symbol.
-
- An expensive way to lookup the value of a single symbol for
- bfd's that are only temporary anyway. This is used by the
- shared library support to find the address of the debugger
- interface structures in the shared library.
-
- Note that 0 is specifically allowed as an error return (no
- such symbol). */
-
-static CORE_ADDR
-bfd_lookup_symbol (bfd *abfd, char *symname)
-{
- long storage_needed;
- asymbol *sym;
- asymbol **symbol_table;
- unsigned int number_of_symbols;
- unsigned int i;
- struct cleanup *back_to;
- CORE_ADDR symaddr = 0;
-
- storage_needed = bfd_get_symtab_upper_bound (abfd);
-
- if (storage_needed > 0)
- {
- symbol_table = (asymbol **) xmalloc (storage_needed);
- back_to = make_cleanup (xfree, symbol_table);
- number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
-
- for (i = 0; i < number_of_symbols; i++)
- {
- sym = *symbol_table++;
- if (strcmp (sym->name, symname) == 0)
- {
- /* Bfd symbols are section relative. */
- symaddr = sym->value + sym->section->vma;
- break;
- }
- }
- do_cleanups (back_to);
- }
-
- if (symaddr)
- return symaddr;
-
- /* Look for the symbol in 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 (xfree, symbol_table);
- number_of_symbols = bfd_canonicalize_dynamic_symtab (abfd, symbol_table);
-
- for (i = 0; i < number_of_symbols; i++)
- {
- sym = *symbol_table++;
- if (strcmp (sym->name, symname) == 0)
- {
- /* Bfd symbols are section relative. */
- symaddr = sym->value + sym->section->vma;
- break;
- }
- }
- do_cleanups (back_to);
- }
-
- return symaddr;
-}
-
/* Implement the "open_symbol_file_object" target_so_ops method. */
static int
@@ -554,6 +483,14 @@ enable_break_failure_warning (void)
"and track explicitly loaded dynamic code."));
}
+/* Helper function for gdb_bfd_lookup_symbol. */
+
+static int
+cmp_name (asymbol *sym, void *data)
+{
+ return (strcmp (sym->name, (const char *) data) == 0);
+}
+
/* Arrange for dynamic linker to hit breakpoint.
The dynamic linkers has, as part of its debugger interface, support
@@ -680,7 +617,8 @@ enable_break2 (void)
interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
}
- addr = bfd_lookup_symbol (tmp_bfd, "_dl_debug_addr");
+ addr = gdb_bfd_lookup_symbol (tmp_bfd, cmp_name, "_dl_debug_addr");
+
if (addr == 0)
{
warning (_("Could not find symbol _dl_debug_addr "