From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21766 invoked by alias); 28 Apr 2005 15:16:19 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 21068 invoked from network); 28 Apr 2005 15:16:02 -0000 Received: from unknown (HELO smarthost2.mail.uk.easynet.net) (212.135.6.12) by sourceware.org with SMTP; 28 Apr 2005 15:16:02 -0000 Received: from [217.207.128.220] (helo=mx.transitive.com) by smarthost2.mail.uk.easynet.net with esmtp (Exim 4.10) id 1DRAkE-0001Oc-00 for gdb@sources.redhat.com; Thu, 28 Apr 2005 16:16:02 +0100 Subject: Persitance of .gdbinit variables From: Alex Bennee To: gdb@sources.redhat.com Content-Type: text/plain Date: Thu, 28 Apr 2005 15:20:00 -0000 Message-Id: <1114701359.6341.83.camel@okra.transitives.com> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TL-MailScanner: Found to be clean X-SW-Source: 2005-04/txt/msg00208.txt.bz2 Hi, I'm working on writing a bunch of user commands for my .gdbinit. However the first time I run the command I want to insert a breakpoint into a piece of code. I'm using some convenience variables to maintain state thus: [extracts from my .gdinit] # # Globally set some convenience variables we use to determine state # and the like. # set $gcbp=0 set $gcbp_hook=0 set $foo=1234 printf "Set gcbp to %d\n", $gcbp printf "Set gcbp_hook to %d\n", $gcbp_hook printf "Set foo to %d\n", $foo define gcb if $gcbp==0 set $gcbp=$arg0 if $gcbp_hook==0 install_gcbp_hook end else print "Can't set new GC Breakpoint until 0x%x set", $gcbp end end [end extracts] When I start up gdb I can see the variables set however running gcb fails with an Invalid type test because the variables have lost there values: [run] 16:04 alex@xxxxx >gdb -x gdb_dirs --args myprog GNU gdb 5.3 Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i386-pc-solaris2.9"...Set gcbp to 0 Set gcbp_hook to 0 Set foo to 1234 (gdb) gcb 0xdb570b24 Invalid type combination in equality test. (gdb) p $gcbp_hook $1 = void (gdb) p $gcbp $2 = void (gdb) [end of run] Is this expected behaviour? Is there a way to ensure variables exist after .gdbinit has loaded? Failing that is there a way to test if a value in undefined/void so I can just setup at that point? -- Alex Bennee