From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15937 invoked by alias); 24 Jan 2006 19:45:37 -0000 Received: (qmail 15923 invoked by uid 22791); 24 Jan 2006 19:45:35 -0000 X-Spam-Check-By: sourceware.org Received: from fra-del-03.spheriq.net (HELO fra-del-03.spheriq.net) (195.46.51.99) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 24 Jan 2006 19:45:28 +0000 Received: from fra-out-01.spheriq.net (fra-out-01.spheriq.net [195.46.51.129]) by fra-del-03.spheriq.net with ESMTP id k0OJjOkw000952 for ; Tue, 24 Jan 2006 19:45:25 GMT Received: from fra-cus-01.spheriq.net (fra-cus-01.spheriq.net [195.46.51.37]) by fra-out-01.spheriq.net with ESMTP id k0OJjMMV008610 for ; Tue, 24 Jan 2006 19:45:24 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by fra-cus-01.spheriq.net with ESMTP id k0OJjLmZ027963 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Tue, 24 Jan 2006 19:45:22 GMT Received: from zeta.dmz-eu.st.com (ns2.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9C167DA41; Tue, 24 Jan 2006 19:45:08 +0000 (GMT) Received: from mail1.bri.st.com (mail1.bri.st.com [164.129.8.218]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id B2713474A5; Tue, 24 Jan 2006 19:48:39 +0000 (GMT) Received: from [164.129.15.13] (terrorhawk.bri.st.com [164.129.15.13]) by mail1.bri.st.com (MOS 3.5.8-GR) with ESMTP id CHD93675 (AUTH stubbsa); Tue, 24 Jan 2006 19:45:06 GMT Message-ID: <43D6833C.7070206@st.com> Date: Tue, 24 Jan 2006 19:45:00 -0000 From: Andrew STUBBS User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Jim Blandy Cc: Eli Zaretskii , gdb-patches@sources.redhat.com Subject: Re: [RFC] Alternate approach to keeping convenience variables References: <4381DC75.80800@st.com> <8f2776cb0511212138g2adef40cr1632365c00e3bebc@mail.gmail.com> <43835114.5060401@st.com> <20051209205923.GA21331@nevyn.them.org> <8f2776cb0601231429y38714c9bm830991b4b037ec70@mail.gmail.com> <43D60D20.2080004@st.com> <8f2776cb0601241040u3f542b15s2efae535170a6492@mail.gmail.com> <20060124184348.GA22916@nevyn.them.org> <8f2776cb0601241116l3338806mc334d157e5553481@mail.gmail.com> In-Reply-To: <8f2776cb0601241116l3338806mc334d157e5553481@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-O-Spoofed: Not Scanned X-O-General-Status: No X-O-Spam1-Status: Not Scanned X-O-Spam2-Status: Not Scanned X-O-URL-Status: Not Scanned X-O-Virus1-Status: No X-O-Virus2-Status: Not Scanned X-O-Virus3-Status: No X-O-Virus4-Status: No X-O-Virus5-Status: Not Scanned X-O-Image-Status: Not Scanned X-O-Attach-Status: Not Scanned X-SpheriQ-Ver: 4.2.0 X-IsSubscribed: yes 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-01/txt/msg00369.txt.bz2 Jim Blandy wrote: > On 1/24/06, Daniel Jacobowitz wrote: >>> Right, but there's no way to test for that in the scripting language. >>> Your 'init-if-undefined' command has to be a primitive, implemented in >>> C. My argument was that having the variables always be present is >>> more convenient for user-defined commands. >> Andrew's point is that such a primitive was recently committed :-) > > If you want your user-defined command to print a helpful error mesage, > you can't use that in an 'if'. If we had some operator like > $defined($foo), then that'd be different. I'm not totally sure what you mean by this. I put the following into the wavefront GDB and it works as I expected: define defined set $temp = $arg0 init-if-undefined $temp = 99999 if $temp == 99999 echo $arg0 not defined\n end end (gdb) defined $a $a not defined (gdb) defined $tpnum (gdb) It has its limitations, of course, but it does work. Your suggestion would still be better.