From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14187 invoked by alias); 26 Sep 2007 19:50:25 -0000 Received: (qmail 14171 invoked by uid 22791); 26 Sep 2007 19:50:23 -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; Wed, 26 Sep 2007 19:50:18 +0000 Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id DD62F65772; Wed, 26 Sep 2007 19:50:15 +0000 (UTC) From: Mike Frysinger To: Daniel Jacobowitz Subject: Re: [patch ping] change lookup order of $localvars to happen before symbol tables Date: Wed, 26 Sep 2007 19:50:00 -0000 User-Agent: KMail/1.9.7 Cc: gdb-patches@sourceware.org References: <200608200903.07185.vapier@gentoo.org> <200609170022.09732.vapier@gentoo.org> <20060917151051.GA21071@nevyn.them.org> In-Reply-To: <20060917151051.GA21071@nevyn.them.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_3fr+GV0HykizxbN" Message-Id: <200709261550.15355.vapier@gentoo.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-09/txt/msg00388.txt.bz2 --Boundary-00=_3fr+GV0HykizxbN Content-Type: multipart/signed; boundary="nextPart1646197.IHqdoACGTP"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit --nextPart1646197.IHqdoACGTP Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Content-length: 970 On Sunday 17 September 2006, Daniel Jacobowitz wrote: > On Sun, Sep 17, 2006 at 12:22:08AM -0400, Mike Frysinger wrote: > > > Would you mind resubmitting with those changes? > > > > sure, ive attached two versions ... the first is just the previous patch > > with your requested changes while the second is that plus breaking up t= he > > internal_lookup() function into lookup_only_internal() and > > create_internal() ... doesnt matter to me which of these patches are > > accepted as they both accomplish my original goal :) > > Nice. The second one is OK. There's one small problem; I don't think > we get to call a patch of this size trivial, and I don't see a > copyright assignment for you on file. Am I missing one? If not, I > think I have to ask you to put one in place. looks like we finally have an agreement in place with the FSF ... but since= =20 it's been almost a year (!), i'll just re-attach the patch re-diffed agains= t=20 current cvs :) -mike --nextPart1646197.IHqdoACGTP Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part. Content-length: 827 -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iQIVAwUARvq390FjO5/oN/WBAQKxlhAApshVW86p4WEkN0cvMive6Ydm/PbD80md tAneRUOJW93eWur2rVzkoGqxqXFr4YBhjxaCfRNo4qd1zPcOomeMVACZmhuVDh5n 17SMHTNKEZZavNLsxI58ozczJOd+eFQmYAzleNEUst8mU1yEPBEbkoPVkTb1PRL7 dD1UHIQI0pNcFR+g/jdeuzVOCmwXMpUmtSsbr9FBjN1WNEQGl1vpivReIAg49wqe drszS8lV/M0S12P3BxX3nHwZ8EHt/+4DxLVxvY+6iA7MMMIhm2N9wugjk+VUNOH6 9Qfvuu1XBd0qsNoshiMgg1fqWXE+WcHKQ5PiVGM98x+ozvRoAhrwdweiyaGqqVUy +gPSOR7xgGKNYoTkV/6QbMb00czPzsnJE5Frtbyb8acKRLDZ0brO5cNjs6lqGkKJ BwrZjIN+YEdlXSi4ro/uNBF+eD97vrLhFCiHoo6mOuH3cvamH/n0Hv9uqXZh1ihI +tURfjKzYw6w8MXtHf55K9+S30TZ8D/KQZPo/E96JqZown7QKHgaEmbEljF1qBUc lA7T8rSZqVRx1C0G3e8ZpYoswXnfiYKua3xYQEttqaSwG4nW4l6pjBqNfSMq21Sn 3cjiaaAlEcK+lxC8s056wB1L1pBR1NbD+zQ4/VuIMHWW9QPnYR8horKDv/kjFp/j CEovhVkzbio= =M8zB -----END PGP SIGNATURE----- --nextPart1646197.IHqdoACGTP-- --Boundary-00=_3fr+GV0HykizxbN Content-Type: text/x-diff; charset="iso-8859-1"; name="gdb-lookup-internal-first-4.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="gdb-lookup-internal-first-4.patch" Content-length: 3695 2007-09-26 Mike Frysinger * value.h (lookup_only_internalvar): New prototype. (create_internalvar): Likewise. * value.c (lookup_only_internalvar): New function. (create_internalvar): Likewise. (lookup_internalvar): Use new lookup_only_internalvar and create_internalvar functions. * parse.c (write_dollar_variable): Look up $ symbols in internal table first rather than last. --- gdb/value.h +++ gdb/value.h @@ -434,6 +434,10 @@ extern void set_internalvar_component (s int bitpos, int bitsize, struct value *newvalue); +extern struct internalvar *lookup_only_internalvar (char *name); + +extern struct internalvar *create_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 @@ -742,10 +742,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; @@ -753,6 +753,17 @@ lookup_internalvar (char *name) if (strcmp (var->name, name) == 0) return var; + return NULL; +} + + +/* Create an internal variable with name NAME and with a void value. + NAME should not normally include a dollar sign. */ + +struct internalvar * +create_internalvar (char *name) +{ + struct internalvar *var; var = (struct internalvar *) xmalloc (sizeof (struct internalvar)); var->name = concat (name, (char *)NULL); var->value = allocate_value (builtin_type_void); @@ -763,6 +774,25 @@ lookup_internalvar (char *name) return var; } + +/* 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; + + return create_internalvar (name); +} + struct value * value_of_internalvar (struct internalvar *var) { --- gdb/parse.c +++ gdb/parse.c @@ -469,6 +469,7 @@ write_dollar_variable (struct stoken str { struct symbol *sym = NULL; struct minimal_symbol *msym = NULL; + struct internalvar *isym = NULL; /* Handle the tokens $digits; also $ (short for $0) and $$ (short for $$1) and $$digits (equivalent to $<-digits> if you could type that). */ @@ -507,6 +508,17 @@ write_dollar_variable (struct stoken str if (i >= 0) goto handle_register; + /* Any names starting with $ are probably debugger internal variables. */ + + isym = lookup_only_internalvar (copy_name (str) + 1); + if (isym) + { + write_exp_elt_opcode (OP_INTERNALVAR); + write_exp_elt_intern (isym); + 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. */ @@ -529,10 +541,10 @@ write_dollar_variable (struct stoken str return; } - /* Any other names starting in $ are debugger internal variables. */ + /* Any other names are assumed to be debugger internal variables. */ write_exp_elt_opcode (OP_INTERNALVAR); - write_exp_elt_intern (lookup_internalvar (copy_name (str) + 1)); + write_exp_elt_intern (create_internalvar (copy_name (str) + 1)); write_exp_elt_opcode (OP_INTERNALVAR); return; handle_last: --Boundary-00=_3fr+GV0HykizxbN--