From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12240 invoked by alias); 22 Aug 2006 02:06:07 -0000 Received: (qmail 12224 invoked by uid 22791); 22 Aug 2006 02:06:03 -0000 X-Spam-Check-By: sourceware.org Received: from smtp.gentoo.org (HELO smtp.gentoo.org) (140.211.166.183) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 22 Aug 2006 02:05:59 +0000 Received: from home.wh0rd.org (localhost [127.0.0.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTP id 785F964776 for ; Tue, 22 Aug 2006 02:05:56 +0000 (UTC) Received: (qmail 15621 invoked from network); 21 Aug 2006 22:05:44 -0400 Received: from unknown (HELO vapier) (192.168.0.2) by 192.168.0.1 with SMTP; 21 Aug 2006 22:05:44 -0400 From: Mike Frysinger To: Daniel Jacobowitz Subject: Re: only force symbol lookups with local variables on hppa Date: Tue, 22 Aug 2006 18:34:00 -0000 User-Agent: KMail/1.9.4 Cc: Mark Kettenis , gdb-patches@sourceware.org References: <200608200903.07185.vapier@gentoo.org> <200608212132.30241.vapier@gentoo.org> <20060822013517.GA4935@nevyn.them.org> In-Reply-To: <20060822013517.GA4935@nevyn.them.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_Kbm6E11q5HTm/Rg" Message-Id: <200608212207.06622.vapier@gentoo.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00153.txt.bz2 --Boundary-00=_Kbm6E11q5HTm/Rg Content-Type: multipart/signed; boundary="nextPart1186692.EZuLBqTBes"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1186692.EZuLBqTBes Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Content-length: 768 On Monday 21 August 2006 21:35, Daniel Jacobowitz wrote: > On Mon, Aug 21, 2006 at 09:32:29PM -0400, Mike Frysinger wrote: > > On Sunday 20 August 2006 09:57, Daniel Jacobowitz wrote: > > > As a followup, there are several better options: > > > > hmm, is there a spec somewhere that says what order symbols need to be > > resolved ? how about an alternative option: > > - in write_dollar_variable(), if the symbol starts with a '$', we first > > try to look it up via lookup_internalvar() ... if that fails, we fall > > back to lookup_symbol() and lookup_minimal_symbol() and then jump back to > > the lookup_internalvar() ... > > Hmm... that's also an interesting option. I have no opinion. here's a stab at it then ... i'm sure others have better ideas :) -mike --nextPart1186692.EZuLBqTBes Content-Type: application/pgp-signature Content-length: 827 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iQIVAwUAROpmykFjO5/oN/WBAQKYfxAApi758AEoW+n2Gtnr+lAcFDJHWM4TgUf1 xmfd3ryPUDQmKFm5UfjI9vGgbfRh9mwymstn2hXmmzrH70V/TTcbOX6IPlZqM44j mU1Ku/XsYOGYr0JUO9kCStm1lla9xfHlLf7b8YOkzOmA4qu0ntuMukJpjYRrjB3r /EUm+LBtQdS7yYpaHXhh5rs6hrax0Y7n8tukY+c/FzRqzP6Ut/DolwSeMxPd+HyT 3QOgfNpShowcAsXkrBC0prpHQXYw2EJ/rsZ2JKHezByzcDpPuWmAq3rOuKlvYrSF QsTd3bXmJ9an0jhE2uFMyV83QvoDyJCRyqrY+tPoydF+CNrMPSsZXD+RgsBA3qM9 3pr7VEEH72dcCw7KBTFm4eRTrLXGwTdkl0BPhadD+rslDP4I67yeDCHwCtRMHi88 xSvKTs/Hzo2LSwFwsN6ILTNTwymfyscz5W0F5zZrv1wWwjQA32TbCzonS8icjfRX fGQDILDqhiB4pYJPQ0jahiolxsee53GkNjJgLXfMBXu8/hYn66eDLZl8O5z46kiD N4REeogzNUf9f/HbL662i5E5346YbtFtsKVnZqBou8YbZjrwi5AZ8Li651kSTOmy +h8z09iWCv691JCkTVlCtViAXJZNDTuxo4PDRbQorPnFXChYjryThn5ZzfOcdwe4 JL/Fxji3mEk= =hyKX -----END PGP SIGNATURE----- --nextPart1186692.EZuLBqTBes-- --Boundary-00=_Kbm6E11q5HTm/Rg Content-Type: text/x-diff; charset="iso-8859-1"; name="gdb-lookup-internal-first.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdb-lookup-internal-first.patch" Content-length: 2899 2006-08-21 Mike Frysinger * value.h (lookup_only_internalvar): New prototype. * value.c (lookup_only_internalvar): New function. (lookup_internalvar): Use lookup_only_internalvar. * parse.c (write_dollar_variable): Look up $ symbols in internal table first rather than last. --- gdb/value.h +++ gdb/value.h @@ -419,6 +419,8 @@ extern void set_internalvar_component (s int bitpos, int bitsize, struct value *newvalue); +extern struct internalvar *lookup_only_internalvar (char *name); + extern struct internalvar *lookup_internalvar (char *name); extern int value_equal (struct value *arg1, struct value *arg2); --- gdb/value.c +++ gdb/value.c @@ -741,10 +741,10 @@ init_if_undefined_command (char* args, i normally include a dollar sign. If the specified internal variable does not exist, - one is created, with a void value. */ + the return value is NULL. */ struct internalvar * -lookup_internalvar (char *name) +lookup_only_internalvar (char *name) { struct internalvar *var; @@ -752,6 +752,25 @@ lookup_internalvar (char *name) if (strcmp (var->name, name) == 0) return var; + return NULL; +} + + +/* Look up an internal variable with name NAME. NAME should not + normally include a dollar sign. + + If the specified internal variable does not exist, + one is created, with a void value. */ + +struct internalvar * +lookup_internalvar (char *name) +{ + struct internalvar *var; + + var = lookup_only_internalvar (name); + if (var) + return var; + var = (struct internalvar *) xmalloc (sizeof (struct internalvar)); var->name = concat (name, (char *)NULL); var->value = allocate_value (builtin_type_void); --- gdb/parse.c +++ gdb/parse.c @@ -486,6 +486,17 @@ write_dollar_variable (struct stoken str if (i >= 0) goto handle_register; + /* Any names starting with $ are probably debugger internal variables. */ + + if (str.ptr[0] == '$' && lookup_only_internalvar (copy_name (str) + 1)) + { +internal_lookup: + write_exp_elt_opcode (OP_INTERNALVAR); + write_exp_elt_intern (lookup_internalvar (copy_name (str) + 1)); + write_exp_elt_opcode (OP_INTERNALVAR); + return; + } + /* On some systems, such as HP-UX and hppa-linux, certain system routines have names beginning with $ or $$. Check for those, first. */ @@ -508,12 +519,9 @@ write_dollar_variable (struct stoken str return; } - /* Any other names starting in $ are debugger internal variables. */ - - write_exp_elt_opcode (OP_INTERNALVAR); - write_exp_elt_intern (lookup_internalvar (copy_name (str) + 1)); - write_exp_elt_opcode (OP_INTERNALVAR); - return; + /* Any other names are assumed to be debugger internal variables. */ + + goto internal_lookup; handle_last: write_exp_elt_opcode (OP_LAST); write_exp_elt_longcst ((LONGEST) i); --Boundary-00=_Kbm6E11q5HTm/Rg--