From: Jim Blandy <jimb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: RFA: solib: select symbols based on section flags
Date: Thu, 12 Jun 2003 21:19:00 -0000 [thread overview]
Message-ID: <vt27k7rt2mm.fsf@zenia.home> (raw)
2003-06-11 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.
Index: gdb/solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.33
diff -c -r1.33 solib-svr4.c
*** gdb/solib-svr4.c 1 Jun 2003 23:00:55 -0000 1.33
--- gdb/solib-svr4.c 11 Jun 2003 08:44:51 -0000
***************
*** 166,172 ****
static int match_main (char *);
! static CORE_ADDR bfd_lookup_symbol (bfd *, char *);
/*
--- 166,172 ----
static int match_main (char *);
! static CORE_ADDR bfd_lookup_symbol (bfd *, char *, flagword);
/*
***************
*** 176,182 ****
SYNOPSIS
! CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
DESCRIPTION
--- 176,182 ----
SYNOPSIS
! CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags)
DESCRIPTION
***************
*** 185,196 ****
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;
--- 185,199 ----
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, flagword sect_flags)
{
long storage_needed;
asymbol *sym;
***************
*** 211,217 ****
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;
--- 214,221 ----
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
! if (STREQ (sym->name, symname)
! && (sym->section->flags & sect_flags) == sect_flags)
{
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
***************
*** 238,244 ****
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;
--- 242,250 ----
for (i = 0; i < number_of_symbols; i++)
{
sym = *symbol_table++;
!
! if (STREQ (sym->name, symname)
! && (sym->section->flags & sect_flags) == sect_flags)
{
/* Bfd symbols are section relative. */
symaddr = sym->value + sym->section->vma;
***************
*** 344,350 ****
for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
{
! address = bfd_lookup_symbol (interp_bfd, *symbolp);
if (address != 0)
{
break;
--- 350,356 ----
for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
{
! address = bfd_lookup_symbol (interp_bfd, *symbolp, 0);
if (address != 0)
{
break;
***************
*** 1049,1055 ****
/* 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);
if (sym_addr != 0)
break;
}
--- 1055,1070 ----
/* Now try to set a breakpoint in the dynamic linker. */
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; 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;
}
next reply other threads:[~2003-06-12 21:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-12 21:19 Jim Blandy [this message]
2003-06-12 23:08 ` Kevin Buettner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vt27k7rt2mm.fsf@zenia.home \
--to=jimb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox