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]

Re: [RFA] Fix c++/16253 (tag/variable name collision)


On 03/24/2014 07:15 AM, Joel Brobecker wrote:
This may not be directly related to your patch. I seem to have seen
some unexplainable behavior in GDB occasionally in the recent past
making me wonder whether there might be something fishy in the symbol
lookup for Ada.

It is my patch that is causing the problems.

In this case, add_nonlocal_symbols is calling the qf map_matching_symbols method which is calling match_partial_symbol. Since this method now does strict matches against domain, an explicit check for STRUCT_DOMAIN matches must be added.

Give this amendment a shot and see how it goes. I suspect there are probably one or two more places where this occurs. [The easiest thing to do is audit any function which uses "VAR_DOMAIN".]

Keith

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 00728bf..94c6cf8 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -5336,13 +5336,33 @@ add_nonlocal_symbols (struct obstack *obstackp, const char *name,
       data.objfile = objfile;
 
       if (is_wild_match)
-	objfile->sf->qf->map_matching_symbols (objfile, name, domain, global,
-					       aux_add_nonlocal_symbols, &data,
-					       wild_match, NULL);
+	{
+	  objfile->sf->qf->map_matching_symbols (objfile, name, domain, global,
+						 aux_add_nonlocal_symbols,
+						 &data, wild_match, NULL);
+	  if (domain == VAR_DOMAIN)
+	    {
+	      objfile->sf->qf->map_matching_symbols (objfile, name,
+						     STRUCT_DOMAIN, global,
+						     aux_add_nonlocal_symbols,
+						     &data, wild_match, NULL);
+	    }
+	}
       else
-	objfile->sf->qf->map_matching_symbols (objfile, name, domain, global,
-					       aux_add_nonlocal_symbols, &data,
-					       full_match, compare_names);
+	{
+	  objfile->sf->qf->map_matching_symbols (objfile, name, domain, global,
+						 aux_add_nonlocal_symbols,
+						 &data, full_match,
+						 compare_names);
+	  if (domain == VAR_DOMAIN)
+	    {
+	      objfile->sf->qf->map_matching_symbols (objfile, name,
+						     STRUCT_DOMAIN, global,
+						     aux_add_nonlocal_symbols,
+						     &data, full_match,
+						     compare_names);
+	    }
+	}
     }
 
   if (num_defns_collected (obstackp) == 0 && global && !is_wild_match)

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