[PATCH 2/2] [PR symtab/17602] Fix arguments to symbol_name_cmp

Doug Evans dje@google.com
Wed Nov 26 04:20:00 GMT 2014


Hi.

This patch fixes pr 17602, the arguments to symbol_name_cmp are
reversed, as explained in the comment in this patch.

Regression tested on amd64-linux.

2014-11-25  Doug Evans  <dje@google.com>

	PR symtab/17602
	* linespec.c (iterate_name_matcher): Fix arguments to symbol_name_cmp.

diff --git a/gdb/linespec.c b/gdb/linespec.c
index 5325702..35b0205 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -982,7 +982,12 @@ iterate_name_matcher (const char *name, void *d)
 {
   const struct symbol_matcher_data *data = d;
 
-  if (data->symbol_name_cmp (name, data->lookup_name) == 0)
+  /* The order of arguments we pass to symbol_name_cmp is important as
+     strcmp_iw, a typical value for symbol_name_cmp, only performs special
+     processing of '(' to remove overload info on the first argument and not
+     the second.  The first argument is what the user provided, the second
+     argument is what came from partial syms / .gdb_index.  */
+  if (data->symbol_name_cmp (data->lookup_name, name) == 0)
     return 1; /* Expand this symbol's symbol table.  */
   return 0; /* Skip this symbol.  */
 }



More information about the Gdb-patches mailing list