public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@mvista.com>
To: gdb-patches@sources.redhat.com, insight@sources.redhat.com
Subject: [rfa] Remove a silly looking symtab sort.
Date: Wed, 24 Oct 2001 21:29:00 -0000	[thread overview]
Message-ID: <20011025002938.A13688@nevyn.them.org> (raw)

The function search_symbols () does not seem to be used anywhere where the
order of the returned functions matters, and the algorithm it searches with
does not rely on any sorting.  The same thing seems to be true for
gdb_listfuncs, but I haven't investigated as thoroughly.

Both of these functions have a blurb like:
  if (!BLOCK_SHOULD_SORT (b))
    sort_block_syms (b);

Note that this isn't something like "! BLOCK_SORTED" - it's "!
BLOCK_SHOULD_SORT".  The condition for that currently is

#define BLOCK_SHOULD_SORT(bl) ((bl)->nsyms >= 40 && BLOCK_FUNCTION (bl) == NULL)

In that latter case, we certainly should not sort the symtab.  I have never
run across this in practice, but the symbol hashing patch wants this to be
cleaned up first.  Sorting a hash table's buckets is bad, mmkay?

Is this patch OK to commit?  If someone disagrees with my assessment on the
need for the results of these functions to be sorted, I can add code to sort
them after searching.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2001-10-25  Daniel Jacobowitz  <drow@mvista.com>

	* symtab.c (search_symbols): Do not attempt to sort a block
	if !BLOCK_SHOULD_SORT (b).

2001-10-25  Daniel Jacobowitz  <drow@mvista.com>

	* generic/gdbtk-cmds (gdb_listfuncs): Do not attempt to sort a block
	if !BLOCK_SHOULD_SORT (b).

Index: gdb/symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.44
diff -u -p -r1.44 symtab.c
--- gdb/symtab.c	2001/10/12 23:51:29	1.44
+++ gdb/symtab.c	2001/10/25 04:23:05
@@ -2475,9 +2475,6 @@ search_symbols (char *regexp, namespace_
       for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
 	{
 	  b = BLOCKVECTOR_BLOCK (bv, i);
-	  /* Skip the sort if this block is always sorted.  */
-	  if (!BLOCK_SHOULD_SORT (b))
-	    sort_block_syms (b);
 	  for (j = 0; j < BLOCK_NSYMS (b); j++)
 	    {
 	      QUIT;
Index: gdb/gdbtk/generic/gdbtk-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/generic/gdbtk-cmds.c,v
retrieving revision 1.40
diff -u -p -r1.40 gdbtk-cmds.c
--- gdb/gdbtk/generic/gdbtk-cmds.c	2001/10/12 23:51:29	1.40
+++ gdb/gdbtk/generic/gdbtk-cmds.c	2001/10/25 04:23:06
@@ -1495,9 +1495,6 @@ gdb_listfuncs (clientData, interp, objc,
   for (i = GLOBAL_BLOCK; i <= STATIC_BLOCK; i++)
     {
       b = BLOCKVECTOR_BLOCK (bv, i);
-      /* Skip the sort if this block is always sorted.  */
-      if (!BLOCK_SHOULD_SORT (b))
-	sort_block_syms (b);
       ALL_BLOCK_SYMBOLS (b, j, sym)
 	{
 	  if (SYMBOL_CLASS (sym) == LOC_BLOCK)

             reply	other threads:[~2001-10-24 21:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-24 21:29 Daniel Jacobowitz [this message]
     [not found] <3BE6DCE4.6550BBBD@cygnus.com>
2001-11-05 15:04 ` Elena Zannoni
2001-11-05 15:36   ` Daniel Jacobowitz
2001-11-05 15:40   ` Daniel Berlin
2001-11-07 17:56 Elena Zannoni
2001-11-07 17:58 Elena Zannoni
2001-11-07 18:19 ` Daniel Berlin

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=20011025002938.A13688@nevyn.them.org \
    --to=drow@mvista.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=insight@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).