From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9254 invoked by alias); 24 Jan 2006 19:24:44 -0000 Received: (qmail 9245 invoked by uid 22791); 24 Jan 2006 19:24:44 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 24 Jan 2006 19:24:40 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1F1TmQ-0006Jb-8K for gdb-patches@sourceware.org; Tue, 24 Jan 2006 14:24:38 -0500 Date: Tue, 24 Jan 2006 19:24:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sourceware.org Subject: Re: [RFC] Alternate approach to keeping convenience variables Message-ID: <20060124192438.GA24103@nevyn.them.org> Mail-Followup-To: gdb-patches@sourceware.org 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8f2776cb0601241116l3338806mc334d157e5553481@mail.gmail.com> User-Agent: Mutt/1.5.8i 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/msg00366.txt.bz2 On Tue, Jan 24, 2006 at 11:16:38AM -0800, 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. At this point we've gotten pretty far afield from the original question. How does defined($foo) help relative to having the variables always present? To refresh, here's what an unpatched GDB without a symbol file shows: (gdb) show convenience $trace_frame = -1 $tpnum = 0 With a symbol file: (gdb) show convenience No debugger convenience variables now defined. Convenience variables have names starting with "$"; use "set" as in "set $foo = 5" to define them. With a tracepoint: (gdb) show convenience $tpnum = 1 And, presumably, $trace_frame is set when you're actually using tracepoints (which I can't test). I think that the "without symbol file" output should be replaced by the "with symbol file" output. I don't think it likely that there are any existing scripts that this would break. If there were, they could add "init-if-undefined $tpnum = 0" and "init-if-undefined $trace_frame = -1", and be back where they started from. For those not using tracepoints, or huge .gdbinit scripts which know about tracepoints, it's nice to hide the tracepoint variables. Can you think of any example that would break? Since GDB is normally used with a symbol file, it seems unlikely. -- Daniel Jacobowitz CodeSourcery