This is the mail archive of the gdb-patches@sourceware.cygnus.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]

Re: patch to write_dollar_variable()



> 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.

Testing HPUXHPPA is a mess, though.  How about this?

1999-09-23  Jim Blandy  <jimb@zwingli.cygnus.com>

	* parse.c (write_dollar_variable): Don't check the symbol table
	for identifiers beginning with `$' unless
	IDENTIFIERS_CAN_START_WITH_DOLLAR is #defined.
	* config/pa/tm-hppa.h (IDENTIFIERS_CAN_START_WITH_DOLLAR): Define.
	* doc/gdbint.texinfo (IDENTIFIERS_CAN_START_WITH_DOLLAR): Document.

Index: parse.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/parse.c,v
retrieving revision 2.67
diff -c -r2.67 parse.c
*** parse.c	1999/09/01 20:50:45	2.67
--- parse.c	1999/09/23 20:14:52
***************
*** 460,468 ****
    /* 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;
    /* Double dollar means negate the number and add -1 as well.
--- 460,465 ----
***************
*** 496,523 ****
    if (i >= 0)
      goto handle_register;
  
!   /* 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. */
  
!   sym = lookup_symbol (copy_name (str), (struct block *) NULL,
! 		       VAR_NAMESPACE, (int *) NULL, (struct symtab **) NULL);
!   if (sym)
!     {
!       write_exp_elt_opcode (OP_VAR_VALUE);
!       write_exp_elt_block (block_found);	/* set by lookup_symbol */
!       write_exp_elt_sym (sym);
!       write_exp_elt_opcode (OP_VAR_VALUE);
!       return;
!     }
!   msym = lookup_minimal_symbol (copy_name (str), NULL, NULL);
!   if (msym)
!     {
!       write_exp_msymbol (msym,
! 			 lookup_function_type (builtin_type_int),
! 			 builtin_type_int);
!       return;
!     }
  
    /* Any other names starting in $ are debugger internal variables.  */
  
--- 493,530 ----
    if (i >= 0)
      goto handle_register;
  
! #if defined(IDENTIFIERS_CAN_START_WITH_DOLLAR)
!   {
!     struct symbol *sym = NULL;
!     struct minimal_symbol *msym = NULL;
  
!     /* 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)
!       {
! 	write_exp_elt_opcode (OP_VAR_VALUE);
! 	write_exp_elt_block (block_found);	/* set by lookup_symbol */
! 	write_exp_elt_sym (sym);
! 	write_exp_elt_opcode (OP_VAR_VALUE);
! 	return;
!       }
!     msym = lookup_minimal_symbol (copy_name (str), NULL, NULL);
!     if (msym)
!       {
! 	write_exp_msymbol (msym,
! 			   lookup_function_type (builtin_type_int),
! 			   builtin_type_int);
! 	return;
!       }
!   }
! #endif
  
    /* Any other names starting in $ are debugger internal variables.  */
  
Index: config/pa/tm-hppa.h
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/config/pa/tm-hppa.h,v
retrieving revision 1.76
diff -c -r1.76 tm-hppa.h
*** tm-hppa.h	1999/09/17 16:12:32	1.76
--- tm-hppa.h	1999/09/23 20:14:53
***************
*** 799,801 ****
--- 799,807 ----
  /* Here's how to step off a permanent breakpoint.  */
  #define SKIP_PERMANENT_BREAKPOINT (hppa_skip_permanent_breakpoint)
  extern void hppa_skip_permanent_breakpoint (void);
+ 
+ /* On HP-UX, certain system routines (millicode) have names beginning
+    with $ or $$, e.g. $$dyncall, which handles inter-space procedure
+    calls on PA-RISC.  Tell the expression parser to check for those
+    when parsing tokens that begin with "$".  */
+ #define IDENTIFIERS_CAN_START_WITH_DOLLAR
Index: doc/gdbint.texinfo
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/doc/gdbint.texinfo,v
retrieving revision 1.136
diff -c -r1.136 gdbint.texinfo
*** gdbint.texinfo	1999/09/15 21:27:39	1.136
--- gdbint.texinfo	1999/09/23 20:14:58
***************
*** 1444,1449 ****
--- 1444,1458 ----
  feature-specific macros.  It was introduced in haste and we are
  repenting at leisure.
  
+ @item IDENTIFIERS_CAN_START_WITH_DOLLAR
+ Some systems have routines whose names start with @samp{$}.  Defining
+ this macro tells GDB's expression parser to check for such routines when
+ parsing tokens that begin with @samp{$}.
+ 
+ On HP-UX, certain system routines (millicode) have names beginning with
+ @samp{$} or @samp{$$}.  For example, @code{$$dyncall} is a millicode
+ routine that handles inter-space procedure calls on PA-RISC.
+ 
  @item IEEE_FLOAT
  Define this if the target system uses IEEE-format floating point numbers.
  

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