Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Carlton <carlton@math.stanford.edu>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: RFA/symtab: Let search_symbols find exact matches
Date: Mon, 10 Feb 2003 20:10:00 -0000	[thread overview]
Message-ID: <ro1vfzrj3qt.fsf@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <20030210160107.GA587@nevyn.them.org>

On Mon, 10 Feb 2003 11:01:07 -0500, Daniel Jacobowitz <drow@mvista.com> said:

> This patch renames search_symbols to search_symbols_aux, and lets it
> take an argument that specified regex or exact (well, strcmp_iw)
> matching.  Then search_symbols becomes a wrapper.

> The new function is used by make_symbol_overload_list, which shaves
> 50% time off of some tests in the C++ directory if your system libc
> has debugging symbols; it removes the bogusity where all psymtabs
> were converted to symtabs during overload resolution.  Whew.  This
> cuts memory for namespace.exp from 70MB to 7MB, allowing some of my
> hardware to actually run the test without crashing.

I love combining functions, but your patch makes me a bit nervous:
search_symbols and make_symbol_overload_list are fairly different
beasts.  If all you want to do is get rid of the aforementioned
bogosity, how about the much more modest patch that I've included at
the end of this message?

Benefits:

* It's more or less the minimal patch necessary to avoid converting
  unnecessary symtabs.

* It should be faster: it uses the fact that global psymbols are
  sorted.

Drawbacks:

* I'm to busy to spend too much time today thinking about whether or
  not lookup_partial_symbol really works well enough for this patch to
  work.  It certainly depends on partial symbols being demangled, but
  they are now.  My guess is that lookup_partial_symbol still doesn't
  work quite right (both because of improper use of
  SYMBOL_SOURCE_NAME, and because of improper use of strcmp instead of
  strcmp_iw).  The former shouldn't be a big deal; the latter might be
  a big deal in some situations but probably shouldn't affect
  lookup_partial_symbol (I _think_).  The correct fix there is to fix
  lookup_partial_symbol, though, rather than avoiding its use.  (I
  have run the patch through the testsuite; it passes, but that means
  almost nothing, given how little the testsuite exercises partial
  symbols.)

Could be either:

* If you really want some of the extra stuff that search_symbols does
  and that make_symbol_overload_list doesn't (e.g. look at minimal
  symbols), then of course your patch is a better idea.  But if you
  don't, then probably you should avoid using search_symbols.

Anyways, give it a run on your platform to see if it works.  Compared
to unpatched GDB, I'm getting a 3x memory improvement and a 2x speed
improvement when running namespace.exp.

(If anybody else out there wants a laugh, just try to figure out what
the part of lookup_partial_symbols that this patch removes actually
does.  It's rather different from what the comment claims...)

David Carlton
carlton@math.stanford.edu

2003-02-10  David Carlton  <carlton@math.stanford.edu>

	* symtab.c (make_symbol_overload_list): Only read in partial
	symtabs containing a matching partial symbol.

Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.87
diff -u -p -r1.87 symtab.c
--- symtab.c	4 Feb 2003 18:07:01 -0000	1.87
+++ symtab.c	10 Feb 2003 19:35:36 -0000
@@ -4035,8 +4022,8 @@ make_symbol_overload_list (struct symbol
   sym_return_val = (struct symbol **) xmalloc ((sym_return_val_size + 1) * sizeof (struct symbol *));
   sym_return_val[0] = NULL;
 
-  /* Look through the partial symtabs for all symbols which begin
-     by matching OLOAD_NAME.  Make sure we read that symbol table in. */
+  /* Read in all partial symtabs containing a partial symbol named
+     OLOAD_NAME.  */
 
   ALL_PSYMTABS (objfile, ps)
   {
@@ -4047,26 +4034,9 @@ make_symbol_overload_list (struct symbol
     if (ps->readin)
       continue;
 
-    for (psym = objfile->global_psymbols.list + ps->globals_offset;
-	 psym < (objfile->global_psymbols.list + ps->globals_offset
-		 + ps->n_global_syms);
-	 psym++)
-      {
-	/* If interrupted, then quit. */
-	QUIT;
-        /* This will cause the symbol table to be read if it has not yet been */
-        s = PSYMTAB_TO_SYMTAB (ps);
-      }
-
-    for (psym = objfile->static_psymbols.list + ps->statics_offset;
-	 psym < (objfile->static_psymbols.list + ps->statics_offset
-		 + ps->n_static_syms);
-	 psym++)
-      {
-	QUIT;
-        /* This will cause the symbol table to be read if it has not yet been */
-        s = PSYMTAB_TO_SYMTAB (ps);
-      }
+    if ((lookup_partial_symbol (ps, oload_name, 1, VAR_NAMESPACE) != NULL)
+	|| (lookup_partial_symbol (ps, oload_name, 0, VAR_NAMESPACE) != NULL))
+      PSYMTAB_TO_SYMTAB (ps);
   }
 
   /* Search upwards from currently selected frame (so that we can


  reply	other threads:[~2003-02-10 20:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-10 16:01 Daniel Jacobowitz
2003-02-10 20:10 ` David Carlton [this message]
2003-02-10 20:18   ` David Carlton
2003-02-10 20:25   ` Daniel Jacobowitz
2003-02-10 21:15     ` David Carlton
2003-02-10 21:17       ` Daniel Jacobowitz
2003-02-20 22:41 ` David Carlton
2003-02-21 14:10   ` Daniel Jacobowitz
2003-02-21 15:27     ` Elena Zannoni
2003-02-21 17:14       ` David Carlton
2003-02-21 17:09     ` David Carlton
2003-02-25  0:35       ` David Carlton
2003-02-21 19:15   ` Elena Zannoni

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=ro1vfzrj3qt.fsf@jackfruit.Stanford.EDU \
    --to=carlton@math.stanford.edu \
    --cc=drow@mvista.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