From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14930 invoked by alias); 24 Jan 2006 11:44:01 -0000 Received: (qmail 14921 invoked by uid 22791); 24 Jan 2006 11:44:00 -0000 X-Spam-Check-By: sourceware.org Received: from lon-del-02.spheriq.net (HELO lon-del-02.spheriq.net) (195.46.50.98) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 24 Jan 2006 11:43:58 +0000 Received: from lon-out-01.spheriq.net ([195.46.50.129]) by lon-del-02.spheriq.net with ESMTP id k0OBhkCt006383 for ; Tue, 24 Jan 2006 11:43:46 GMT Received: from lon-cus-01.spheriq.net (lon-cus-01.spheriq.net [195.46.50.37]) by lon-out-01.spheriq.net with ESMTP id k0OBhhgs031151 for ; Tue, 24 Jan 2006 11:43:46 GMT Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by lon-cus-01.spheriq.net with ESMTP id k0OBhYCS008164 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=OK); Tue, 24 Jan 2006 11:43:37 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 46CADDDDE; Tue, 24 Jan 2006 11:21:12 +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 BDD8A472B9; Tue, 24 Jan 2006 11:24:42 +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 CHD89205 (AUTH stubbsa); Tue, 24 Jan 2006 11:21:09 GMT Message-ID: <43D60D20.2080004@st.com> Date: Tue, 24 Jan 2006 11:44: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> In-Reply-To: <8f2776cb0601231429y38714c9bm830991b4b037ec70@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/msg00354.txt.bz2 Jim Blandy wrote: > The $trace_frame variable is set to -1 when GDB starts, which > indicates that there's no trace frame selected. I think it would be a > little more helpful for the variables to always exist: you can write > user-defined commands that give a reasonable error message, for > example. GDB doesn't have any way (?) to check whether a convenience > variable has been initialized yet. A newly created convenience variable has the value 'void'. (A variable is created the first time it is referenced, even as an rvalue.) Therefore, if it is 'void' it can be considered uninitialised. This is how the 'init-if-undefined' command works. The only way (I know of) to set it back to 'void', once assigned another value, is to assign the value of another uninitialised variable, which I would consider as copying the undefined status as well as the value 'void'. So an example GDB script fragment to check a variable might look like this: set $temp = $trace_frame init-if-undefined $temp = 99999 if $temp == 99999 Copying the value to $temp ensures that the original variable $trace_frame remains undamaged. HTH Andrew Stubbs