patch to write_dollar_variable()

J.T. Conklin jtc@redback.com
Fri Aug 20 18:26:00 GMT 1999


As previously discussed on the gdb list, this patch is necessary.  At
least until symbol table handling is greatly improved... :-)

        --jtc


1999-08-20  J.T. Conklin  <jtc@redback.com>

	* parse.c (write_dollar_variable): If HPUXHPPA is not defined,
 	don't search for $ variables in the symbol table.  Worst case
 	symbol table lookup performance is extremely poor.  This causes
 	GDB scripts that use convenience variables to execute so slowly
	to be almost unusable.

Index: parse.c
===================================================================
RCS file: /home/jtc/CVSROOT/gdb/gdb/parse.c,v
retrieving revision 1.1.1.8
diff -c -r1.1.1.8 parse.c
*** parse.c	1999/07/20 21:37:54	1.1.1.8
--- parse.c	1999/08/21 01:23:44
***************
*** 459,467 ****
  {
    /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
       and $$digits (equivalent to $<-digits> if you could type that). */
! 
    struct symbol *sym = NULL;
    struct minimal_symbol *msym = NULL;
  
    int negate = 0;
    int i = 1;
--- 459,468 ----
  {
    /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1)
       and $$digits (equivalent to $<-digits> if you could type that). */
! #if defined(HPUXHPPA)
    struct symbol *sym = NULL;
    struct minimal_symbol *msym = NULL;
+ #endif
  
    int negate = 0;
    int i = 1;
***************
*** 496,505 ****
--- 497,510 ----
    if (i >= 0)
      goto handle_register;
  
+ #if defined(HPUXHPPA)
    /* On HP-UX, certain system routines (millicode) have names beginning
       with $ or $$, e.g. $$dyncall, which handles inter-space procedure
       calls on PA-RISC. Check for those, first. */
  
+   /* This code is not enabled on non HP-UX systems, since worst case 
+      symbol table lookup performance is awful, to put it mildly. */
+ 
    sym = lookup_symbol (copy_name (str), (struct block *) NULL,
  		       VAR_NAMESPACE, (int *) NULL, (struct symtab **) NULL);
    if (sym)
***************
*** 518,523 ****
--- 523,529 ----
  			 builtin_type_int);
        return;
      }
+ #endif
  
    /* Any other names starting in $ are debugger internal variables.  */
  
-- 
J.T. Conklin
RedBack Networks


More information about the Gdb-patches mailing list