This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch]


Hi.

linespec.c:find_linespec_symbols first tries to find "foo::bar" as
method bar in class foo (via lookup_prefix_sym).
If that fails it then tries to find bar in namespace foo.

      /* If successful, we're done.  If NOT_FOUND_ERROR
	 was not thrown, rethrow the exception that we did get.
	 Otherwise, fall back to looking up the entire name as a symbol.
	 This can happen with namespace::function.  */

Given that, there's no need for collect_one_symbol (only used by
lookup_prefix_sym) to collect namespaces.

Regression tested on amd64-linux.
I will commit this patch in a few days if there are no objections.

2013-01-23  Doug Evans  <dje@google.com>

	* linespec.c (collect_one_symbol): Clarify comment.
	Don't collect TYPE_CODE_NAMESPACE symbols.

Index: linespec.c
===================================================================
RCS file: /cvs/src/src/gdb/linespec.c,v
retrieving revision 1.174
diff -u -p -r1.174 linespec.c
--- linespec.c	1 Jan 2013 06:32:46 -0000	1.174
+++ linespec.c	23 Jan 2013 18:36:23 -0000
@@ -2539,7 +2539,7 @@ struct decode_compound_collector
 };
 
 /* A callback for iterate_over_symbols that is used by
-   lookup_prefix_sym to collect type symbols.  */
+   lookup_prefix_sym to collect class symbols.  */
 
 static int
 collect_one_symbol (struct symbol *sym, void *d)
@@ -2554,8 +2554,7 @@ collect_one_symbol (struct symbol *sym, 
   t = SYMBOL_TYPE (sym);
   CHECK_TYPEDEF (t);
   if (TYPE_CODE (t) != TYPE_CODE_STRUCT
-      && TYPE_CODE (t) != TYPE_CODE_UNION
-      && TYPE_CODE (t) != TYPE_CODE_NAMESPACE)
+      && TYPE_CODE (t) != TYPE_CODE_UNION)
     return 1; /* Continue iterating.  */
 
   slot = htab_find_slot (collector->unique_syms, sym, INSERT);


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]