summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Blandy <jimb@codesourcery.com>2003-06-13 23:57:26 +0000
committerJim Blandy <jimb@codesourcery.com>2003-06-13 23:57:26 +0000
commit53c2f22d445f7f78cae38eb084e0e7840d41fadf (patch)
treeadf481eff45fe868cdd05443f7407cd268e961d7
parent5ab377ccf0a1297164a612cd5198d99234b91444 (diff)
downloadgdb-53c2f22d445f7f78cae38eb084e0e7840d41fadf.tar.gz
* solib-svr4.c (bfd_lookup_symbol): New SECT_FLAGS argument.
(enable_break): Pass SEC_CODE as the SECT_FLAGS argument to bfd_lookup_symbol, since we only want symbols in code sections. (look_for_base): Pass zero as the SECT_FLAGS argument to bfd_lookup_symbol, since we're not concerned about which section the symbol is in.
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/solib-svr4.c29
2 files changed, 29 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8b197bd692e..6fabe08ea4e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2003-06-13 Jim Blandy <jimb@redhat.com>
+ * solib-svr4.c (bfd_lookup_symbol): New SECT_FLAGS argument.
+ (enable_break): Pass SEC_CODE as the SECT_FLAGS argument to
+ bfd_lookup_symbol, since we only want symbols in code sections.
+ (look_for_base): Pass zero as the SECT_FLAGS argument to
+ bfd_lookup_symbol, since we're not concerned about which section
+ the symbol is in.
+
* gdbarch.sh (gdbarch_bfd_entry_point): New gdbarch method.
* arch-utils.c (generic_bfd_entry_point): New function.
* arch-utils.h (generic_bfd_entry_point): New declaration.
diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c
index 6a866560ceb..3ab247248d8 100644
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -177,7 +177,7 @@ static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
static int match_main (char *);
-static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
+static CORE_ADDR bfd_lookup_symbol (bfd *, char *, flagword);
/*
@@ -187,7 +187,7 @@ static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
SYNOPSIS
- CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
+ CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags)
DESCRIPTION
@@ -196,12 +196,15 @@ static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
shared library support to find the address of the debugger
interface structures in the shared library.
+ If SECT_FLAGS is non-zero, only match symbols in sections whose
+ flags include all those in SECT_FLAGS.
+
Note that 0 is specifically allowed as an error return (no
such symbol).
*/
static CORE_ADDR
-bfd_lookup_symbol (bfd *abfd, char *symname)
+bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags)
{
long storage_needed;
asymbol *sym;
@@ -222,7 +225,8 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
- if (STREQ (sym->name, symname))
+ if (STREQ (sym->name, symname)
+ && (sym->section->flags & sect_flags) == sect_flags)
{
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
@@ -249,7 +253,9 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
- if (STREQ (sym->name, symname))
+
+ if (STREQ (sym->name, symname)
+ && (sym->section->flags & sect_flags) == sect_flags)
{
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
@@ -355,7 +361,7 @@ look_for_base (int fd, CORE_ADDR baseaddr)
for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
{
- address = bfd_lookup_symbol (interp_bfd, *symbolp);
+ address = bfd_lookup_symbol (interp_bfd, *symbolp, 0);
if (address != 0)
{
break;
@@ -1061,7 +1067,16 @@ enable_break (void)
/* Now try to set a breakpoint in the dynamic linker. */
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
- sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
+ /* On ABI's that use function descriptors, there are usually
+ two linker symbols associated with each C function: one
+ pointing at the actual entry point of the machine code,
+ and one pointing at the function's descriptor. The
+ latter symbol has the same name as the C function.
+
+ What we're looking for here is the machine code entry
+ point, so we are only interested in symbols in code
+ sections. */
+ sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep, SEC_CODE);
if (sym_addr != 0)
break;
}