Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Elena Zannoni <ezannoni@redhat.com>
To: David Carlton <carlton@math.stanford.edu>
Cc: gdb-patches@sources.redhat.com,
	Elena Zannoni <ezannoni@redhat.com>, Jim Blandy <jimb@redhat.com>
Subject: Re: [patch] delete find_addr_symbol
Date: Fri, 25 Oct 2002 18:05:00 -0000	[thread overview]
Message-ID: <15801.59816.307534.951655@localhost.redhat.com> (raw)
In-Reply-To: <ro1k7k6umdb.fsf@jackfruit.Stanford.EDU>

David Carlton writes:
 > In my eternal quest to tame symtab.c, I just started looking at the
 > commented-out definition of find_addr_symbol.  Looking through
 > ChangeLogs, it turns out that this function was in existence for 2
 > months in 1994, has been commented out for the following 8 years, and
 > has a big honking bug in the middle of it, though to be fair the bug
 > is at least commented:
 > 
 >   /* FIXME -- we should pull in all the psymtabs, too!  */
 > 
 > So the time has come to bid that code adieu, I think.  This patch
 > seems obvious: speak up if you have any sentimental attachment to the
 > code.  Otherwise, I'll delete it soon after a compile/check has
 > finished to make sure I'm not doing anything stupid somehow.
 > 

Sniff, sniff. Yes kill it.

Thanks!
Elena

 > David Carlton
 > carlton@math.stanford.edu
 > 
 > 2002-10-25  David Carlton  <carlton@math.stanford.edu>
 > 
 > 	* symtab.c (find_addr_symbol): Delete.  (It was already commented
 > 	out.)
 > 	* symtab.h: Delete prototype for find_addr_symbol.
 > 
 > Index: symtab.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symtab.c,v
 > retrieving revision 1.74
 > diff -u -p -r1.74 symtab.c
 > --- symtab.c	24 Oct 2002 21:02:53 -0000	1.74
 > +++ symtab.c	25 Oct 2002 23:21:53 -0000
 > @@ -1692,94 +1692,6 @@ find_pc_symtab (CORE_ADDR pc)
 >  }
 >  \f
 >  
 > -#if 0
 > -
 > -/* Find the closest symbol value (of any sort -- function or variable)
 > -   for a given address value.  Slow but complete.  (currently unused,
 > -   mainly because it is too slow.  We could fix it if each symtab and
 > -   psymtab had contained in it the addresses ranges of each of its
 > -   sections, which also would be required to make things like "info
 > -   line *0x2345" cause psymtabs to be converted to symtabs).  */
 > -
 > -struct symbol *
 > -find_addr_symbol (CORE_ADDR addr, struct symtab **symtabp, CORE_ADDR *symaddrp)
 > -{
 > -  struct symtab *symtab, *best_symtab;
 > -  struct objfile *objfile;
 > -  register int bot, top;
 > -  register struct symbol *sym;
 > -  register CORE_ADDR sym_addr;
 > -  struct block *block;
 > -  int blocknum;
 > -
 > -  /* Info on best symbol seen so far */
 > -
 > -  register CORE_ADDR best_sym_addr = 0;
 > -  struct symbol *best_sym = 0;
 > -
 > -  /* FIXME -- we should pull in all the psymtabs, too!  */
 > -  ALL_SYMTABS (objfile, symtab)
 > -  {
 > -    /* Search the global and static blocks in this symtab for
 > -       the closest symbol-address to the desired address.  */
 > -
 > -    for (blocknum = GLOBAL_BLOCK; blocknum <= STATIC_BLOCK; blocknum++)
 > -      {
 > -	QUIT;
 > -	block = BLOCKVECTOR_BLOCK (BLOCKVECTOR (symtab), blocknum);
 > -	ALL_BLOCK_SYMBOLS (block, bot, sym)
 > -	  {
 > -	    switch (SYMBOL_CLASS (sym))
 > -	      {
 > -	      case LOC_STATIC:
 > -	      case LOC_LABEL:
 > -		sym_addr = SYMBOL_VALUE_ADDRESS (sym);
 > -		break;
 > -
 > -	      case LOC_INDIRECT:
 > -		sym_addr = SYMBOL_VALUE_ADDRESS (sym);
 > -		/* An indirect symbol really lives at *sym_addr,
 > -		 * so an indirection needs to be done.
 > -		 * However, I am leaving this commented out because it's
 > -		 * expensive, and it's possible that symbolization
 > -		 * could be done without an active process (in
 > -		 * case this read_memory will fail). RT
 > -		 sym_addr = read_memory_unsigned_integer
 > -		 (sym_addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
 > -		 */
 > -		break;
 > -
 > -	      case LOC_BLOCK:
 > -		sym_addr = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
 > -		break;
 > -
 > -	      default:
 > -		continue;
 > -	      }
 > -
 > -	    if (sym_addr <= addr)
 > -	      if (sym_addr > best_sym_addr)
 > -		{
 > -		  /* Quit if we found an exact match.  */
 > -		  best_sym = sym;
 > -		  best_sym_addr = sym_addr;
 > -		  best_symtab = symtab;
 > -		  if (sym_addr == addr)
 > -		    goto done;
 > -		}
 > -	  }
 > -      }
 > -  }
 > -
 > -done:
 > -  if (symtabp)
 > -    *symtabp = best_symtab;
 > -  if (symaddrp)
 > -    *symaddrp = best_sym_addr;
 > -  return best_sym;
 > -}
 > -#endif /* 0 */
 > -
 >  /* Find the source file and line number for a given PC value and SECTION.
 >     Return a structure containing a symtab pointer, a line number,
 >     and a pc range for the entire source line.
 > Index: symtab.h
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/symtab.h,v
 > retrieving revision 1.50
 > diff -u -p -r1.50 symtab.h
 > --- symtab.h	24 Oct 2002 21:02:53 -0000	1.50
 > +++ symtab.h	25 Oct 2002 23:21:44 -0000
 > @@ -1261,13 +1261,6 @@ extern struct symtab_and_line find_pc_li
 >  
 >  extern struct symtab_and_line find_pc_sect_line (CORE_ADDR, asection *, int);
 >  
 > -/* Given an address, return the nearest symbol at or below it in memory.
 > -   Optionally return the symtab it's from through 2nd arg, and the
 > -   address in inferior memory of the symbol through 3rd arg.  */
 > -
 > -extern struct symbol *find_addr_symbol (CORE_ADDR, struct symtab **,
 > -					CORE_ADDR *);
 > -
 >  /* Given a symtab and line number, return the pc there.  */
 >  
 >  extern int find_line_pc (struct symtab *, int, CORE_ADDR *);


  reply	other threads:[~2002-10-26  1:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-25 16:31 David Carlton
2002-10-25 18:05 ` Elena Zannoni [this message]
2002-10-28  9:15   ` David Carlton

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=15801.59816.307534.951655@localhost.redhat.com \
    --to=ezannoni@redhat.com \
    --cc=carlton@math.stanford.edu \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@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