public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA] Change to pre-expand symtabs
@ 2010-07-26 18:47 Keith Seitz
  2010-07-29 20:52 ` Tom Tromey
  2010-09-01 21:44 ` Tom Tromey
  0 siblings, 2 replies; 8+ messages in thread
From: Keith Seitz @ 2010-07-26 18:47 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

Hi,

This patch actually does two things, both related to PR symtab/11743 
(for which I've previously submitted various ugly patches). First, it 
switches gdb to search for symtabs by using psymtab pre-expansion.

Second, it strips off overload information from psymtab search names, 
since psymtabs do not contain any of this information to begin with. I 
believe this is going to be the cleanest approach to fixing the 
overload-instance-in-a-psymtab problem (symtab/11743) that we're likely 
to find.

Note that I have not addressed the linespec.c problems specifically 
reported in symtab/11743. This simply gets the non-quoted case working 
(which is a pre-requisite anyway).

Keith

ChangeLog
2010-07-26  Keith Seitz  <keiths@redhat.com>

	PR symtab/11743 (partial):
	* psymtab.c (lookup_symbol_aux_psymtabs): Always return NULL;
	switching to pre-expanding symtabs instead.
	(pre_expand_symtabs_matching_psymtabs): Implement.
	If overload information is present in the search name,
	strip it.

[-- Attachment #2: expand-psymtabs-overloaded.patch --]
[-- Type: text/plain, Size: 1526 bytes --]

Index: psymtab.c
===================================================================
RCS file: /cvs/src/src/gdb/psymtab.c,v
retrieving revision 1.7
diff -u -p -r1.7 psymtab.c
--- psymtab.c	13 Jul 2010 20:52:52 -0000	1.7
+++ psymtab.c	26 Jul 2010 18:38:24 -0000
@@ -409,15 +409,6 @@ lookup_symbol_aux_psymtabs (struct objfi
 			    int block_index, const char *name,
 			    const domain_enum domain)
 {
-  struct partial_symtab *ps;
-  const int psymtab_index = (block_index == GLOBAL_BLOCK ? 1 : 0);
-
-  ALL_OBJFILE_PSYMTABS (objfile, ps)
-  {
-    if (!ps->readin && lookup_partial_symbol (ps, name, psymtab_index, domain))
-      return PSYMTAB_TO_SYMTAB (ps);
-  }
-
   return NULL;
 }
 
@@ -426,7 +417,27 @@ pre_expand_symtabs_matching_psymtabs (st
 				      int kind, const char *name,
 				      domain_enum domain)
 {
-  /* Nothing.  */
+  char *paren;
+  struct partial_symtab *pst;
+  const int psymtab_index = (kind == GLOBAL_BLOCK ? 1 : 0);
+
+  /* If NAME contains overload information, strip it, since psymtabs only
+     contain the method name.  */
+  paren = strchr (name, '(');
+  if (paren != NULL)
+    {
+      char *tmp = alloca (strlen (name));
+      memcpy (tmp, name, paren - name);
+      tmp[name - paren] = '\0';
+      name = tmp;
+    }
+
+  ALL_OBJFILE_PSYMTABS (objfile, pst)
+    {
+      if (!pst->readin
+	  && lookup_partial_symbol (pst, name, psymtab_index, domain) != NULL)
+	PSYMTAB_TO_SYMTAB (pst);
+    }
 }
 
 /* Look, in partial_symtab PST, for symbol whose natural name is NAME.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-09-07 21:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-26 18:47 [RFA] Change to pre-expand symtabs Keith Seitz
2010-07-29 20:52 ` Tom Tromey
2010-07-30 16:48   ` Keith Seitz
2010-09-01 21:44 ` Tom Tromey
2010-09-02 17:28   ` Keith Seitz
2010-09-02 22:13   ` Keith Seitz
2010-09-04 20:48     ` Jan Kratochvil
2010-09-08 17:17       ` Keith Seitz

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).