This is the mail archive of the gdb-patches@sources.redhat.com 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]

[PATCH] revert 10-12 changes



Since these changes have been the bane of my existence, i'd like to
revert them.

Maybe in a few {weeks,months,years}, i'll make another go at it.

The attached should do this, but I left the division between
lookup_symbol and lookup_symbol_aux, since it seemed to make sense
(i'll revert this too if someone wants it the old way).

I also fixed the infinite recursion caused by this renaming, that Peter
had submitted a patch for.

Can someone look this over, and tell me if I missed anything? I went
by my submitted patch, but i've got a massive headache this morning,
so i may have missed something accidently.


--Dan

Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.20
diff -c -3 -p -r1.20 symfile.c
*** symfile.c	2000/10/27 15:02:42	1.20
--- symfile.c	2000/11/16 17:06:36
*************** compare_symbols (const PTR s1p, const PT
*** 212,218 ****
  
    s1 = (struct symbol **) s1p;
    s2 = (struct symbol **) s2p;
!   return (STRCMP (SYMBOL_SOURCE_NAME (*s1), SYMBOL_SOURCE_NAME (*s2)));
  }
  
  /*
--- 212,218 ----
  
    s1 = (struct symbol **) s1p;
    s2 = (struct symbol **) s2p;
!   return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2)));
  }
  
  /*
*************** compare_psymbols (const PTR s1p, const P
*** 245,252 ****
  
    s1 = (struct partial_symbol **) s1p;
    s2 = (struct partial_symbol **) s2p;
!   st1 = SYMBOL_SOURCE_NAME (*s1);
!   st2 = SYMBOL_SOURCE_NAME (*s2);
  
  
    if ((st1[0] - st2[0]) || !st1[0])
--- 245,252 ----
  
    s1 = (struct partial_symbol **) s1p;
    s2 = (struct partial_symbol **) s2p;
!   st1 = SYMBOL_NAME (*s1);
!   st2 = SYMBOL_NAME (*s2);
  
  
    if ((st1[0] - st2[0]) || !st1[0])
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.22
diff -c -3 -p -r1.22 symtab.c
*** symtab.c	2000/11/10 23:02:56	1.22
--- symtab.c	2000/11/16 17:06:37
*************** lookup_symbol (const char *name, const s
*** 563,569 ****
  {
    char *modified_name = NULL;
    char *modified_name2 = NULL;
-   int needtofreename = 0;
    struct symbol *returnval;
  
    if (case_sensitivity == case_sensitive_off)
--- 563,568 ----
*************** lookup_symbol (const char *name, const s
*** 581,603 ****
    else 
        modified_name = (char *) name;
  
-   /* If we are using C++ language, demangle the name before doing a lookup, so
-      we can always binary search. */
-   if (current_language->la_language == language_cplus)
-     {
-       modified_name2 = cplus_demangle (modified_name, DMGL_ANSI | DMGL_PARAMS);
-       if (modified_name2)
- 	{
- 	  modified_name = modified_name2;
- 	  needtofreename = 1;
- 	}
-     }
- 
    returnval = lookup_symbol_aux (modified_name, block, namespace,
  				 is_a_field_of_this, symtab);
-   if (needtofreename)
-     free (modified_name2);
- 
    return returnval;	 
  }
  
--- 580,587 ----
*************** lookup_symbol_aux (const char *name, con
*** 772,778 ****
  	    {
  	      /* This is a mangled variable, look it up by its
  	         mangled name.  */
! 	      return lookup_symbol (SYMBOL_NAME (msymbol), block,
  				    namespace, is_a_field_of_this, symtab);
  	    }
  	  /* There are no debug symbols for this file, or we are looking
--- 756,762 ----
  	    {
  	      /* This is a mangled variable, look it up by its
  	         mangled name.  */
! 	      return lookup_symbol_aux (SYMBOL_NAME (msymbol), block,
  				    namespace, is_a_field_of_this, symtab);
  	    }
  	  /* There are no debug symbols for this file, or we are looking
*************** lookup_symbol_aux (const char *name, con
*** 950,956 ****
  		   && MSYMBOL_TYPE (msymbol) != mst_file_text
  		   && !STREQ (name, SYMBOL_NAME (msymbol)))
  	    {
! 	      return lookup_symbol (SYMBOL_NAME (msymbol), block,
  				    namespace, is_a_field_of_this, symtab);
  	    }
  	}
--- 934,940 ----
  		   && MSYMBOL_TYPE (msymbol) != mst_file_text
  		   && !STREQ (name, SYMBOL_NAME (msymbol)))
  	    {
! 	      return lookup_symbol_aux (SYMBOL_NAME (msymbol), block,
  				    namespace, is_a_field_of_this, symtab);
  	    }
  	}
*************** lookup_symbol_aux (const char *name, con
*** 964,971 ****
  }
  								
  /* Look, in partial_symtab PST, for symbol NAME.  Check the global
!    symbols if GLOBAL, the static symbols if not */
  
  static struct partial_symbol *
  lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
  		       namespace_enum namespace)
--- 948,960 ----
  }
  								
  /* Look, in partial_symtab PST, for symbol NAME.  Check the global
!    symbols if GLOBAL, the static symbols if not. 
  
+    Be aware that minimal symbols have no demangled names. So we need to lookup
+    by mangled name. However, this also means we can always binary search them, 
+    since they are a sorted list. If you change the way partial symbols work, 
+    you'll need to change this routine.  */
+ 
  static struct partial_symbol *
  lookup_partial_symbol (struct partial_symtab *pst, const char *name, int global,
  		       namespace_enum namespace)
*************** lookup_partial_symbol (struct partial_sy
*** 1001,1011 ****
  	  if (!(center < top))
  	    abort ();
  	  if (!do_linear_search
! 	      && (SYMBOL_LANGUAGE (*center) == language_java))
  	    {
  	      do_linear_search = 1;
! 	    }
! 	  if (STRCMP (SYMBOL_SOURCE_NAME (*center), name) >= 0)
  	    {
  	      top = center;
  	    }
--- 990,1002 ----
  	  if (!(center < top))
  	    abort ();
  	  if (!do_linear_search
! 	      && (SYMBOL_LANGUAGE (*center) == language_cplus
! 		  || SYMBOL_LANGUAGE (*center) == language_java
! 		  ))
  	    {
  	      do_linear_search = 1;
! 	    }	  
!   	  if (STRCMP (SYMBOL_NAME (*center), name) >= 0)
  	    {
  	      top = center;
  	    }
*************** lookup_block_symbol (register const stru
*** 1226,1244 ****
  	    }
  	  inc = (inc >> 1) + bot;
  	  sym = BLOCK_SYM (block, inc);
! 	  if (!do_linear_search && (SYMBOL_LANGUAGE (sym) == language_java))
  	    {
  	      do_linear_search = 1;
  	    }
! 	  if (SYMBOL_SOURCE_NAME (sym)[0] < name[0])
  	    {
  	      bot = inc;
  	    }
! 	  else if (SYMBOL_SOURCE_NAME (sym)[0] > name[0])
  	    {
  	      top = inc;
  	    }
! 	  else if (STRCMP (SYMBOL_SOURCE_NAME (sym), name) < 0)
  	    {
  	      bot = inc;
  	    }
--- 1217,1235 ----
  	    }
  	  inc = (inc >> 1) + bot;
  	  sym = BLOCK_SYM (block, inc);
! 	  if (!do_linear_search && ((SYMBOL_LANGUAGE (sym) == language_java) || SYMBOL_LANGUAGE (sym) == language_cplus))
  	    {
  	      do_linear_search = 1;
  	    }
! 	  if (SYMBOL_NAME (sym)[0] < name[0])
  	    {
  	      bot = inc;
  	    }
! 	  else if (SYMBOL_NAME (sym)[0] > name[0])
  	    {
  	      top = inc;
  	    }
! 	  else if (STRCMP (SYMBOL_NAME (sym), name) < 0)
  	    {
  	      bot = inc;
  	    }



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