This is the mail archive of the
gdb-patches@sourceware.cygnus.com
mailing list for the GDB project.
Re: patch to write_dollar_variable()
- To: Stan Shebs <shebs at cygnus dot com>
- Subject: Re: patch to write_dollar_variable()
- From: Jim Blandy <jimb at cygnus dot com>
- Date: 23 Sep 1999 18:44:26 -0500
- Cc: jtc at redback dot com, taylor at cygnus dot com, gdb-patches at sourceware dot cygnus dot com
- References: <199909232052.NAA02680@andros.cygnus.com>
> This is going in the right direction, but to keep in line with our
> future, I'd prefer to see a runtime test:
>
> if (IDENTIFIERS_CAN_START_WITH_DOLLAR)
>
> that is defaulted to 0 somewhere convenient (like at the top of
> parse.c).
Duh. I knew that...
1999-09-23 Jim Blandy <jimb@zwingli.cygnus.com>
* parse.c (IDENTIFIERS_CAN_START_WITH_DOLLAR): New macro,
whose value can be overridden by target files.
(write_dollar_variable): Don't check the symbol table for
identifiers beginning with `$' unless
IDENTIFIERS_CAN_START_WITH_DOLLAR is non-zero.
* 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 23:39:00
***************
*** 44,49 ****
--- 44,64 ----
#include "gdbcmd.h"
#include "symfile.h" /* for overlay functions */
+ /* Symbols which architectures can redefine. */
+
+ /* Some systems have routines whose names start with `$'. Giving this
+ macro a non-zero value tells GDB's expression parser to check for
+ such routines when parsing tokens that begin with `$'.
+
+ On HP-UX, certain system routines (millicode) have names beginning
+ with `$' or `$$'. For example, `$$dyncall' is a millicode routine
+ that handles inter-space procedure calls on PA-RISC. */
+ #ifndef IDENTIFIERS_CAN_START_WITH_DOLLAR
+ #define IDENTIFIERS_CAN_START_WITH_DOLLAR (0)
+ #endif
+
+
+
/* Global variables declared in parser-defs.h (and commented there). */
struct expression *expout;
int expout_size;
***************
*** 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.
--- 475,480 ----
***************
*** 496,522 ****
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. */
--- 508,543 ----
if (i >= 0)
goto handle_register;
! if (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;
! }
}
/* 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 23:39:01
***************
*** 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 23:39:05
***************
*** 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{$}. Giving this
+ macro a non-zero value 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.