From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23815 invoked by alias); 9 Apr 2007 22:09:40 -0000 Received: (qmail 23802 invoked by uid 22791); 9 Apr 2007 22:09:38 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 09 Apr 2007 23:09:34 +0100 Received: from farnswood.snap.net.nz (164.61.255.123.dynamic.snap.net.nz [123.255.61.164]) by viper.snap.net.nz (Postfix) with ESMTP id C1F163D90A4; Tue, 10 Apr 2007 10:09:31 +1200 (NZST) Received: by farnswood.snap.net.nz (Postfix, from userid 500) id 91DD3627ED; Mon, 9 Apr 2007 23:07:05 +0100 (BST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17946.47368.392951.298692@farnswood.snap.net.nz> Date: Mon, 09 Apr 2007 22:09:00 -0000 To: vb Cc: gdb@sourceware.org Subject: Re: access variables in canned command sequences In-Reply-To: References: <17946.4774.878951.277496@farnswood.snap.net.nz> X-Mailer: VM 7.19 under Emacs 22.0.97.2 X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00045.txt.bz2 > > define xyz > > printf "offset is %d\n", $offs > > end > > > > Yeah, this works as we know, but is there any way of passing an > internal variable value to the shell? It's not clear to me what you want to do but you could write the data to a file and read that file from the shell script: set logging file input.dat define xyz set logging on printf "offset is %d\n", $offs set logging off end However, perhaps we know that too. AFAIK convenience variables are handled in GDB just like ordinary program variables. I don't think you can currently regard the GDB command line as a program language but Daniel Jacobowitz is working on something more powerful. > Somebody mentioned setting up an environment variable - this seems > interesting, I tried > > set environment offset 0x1000 > shell env | grep offset > > `offset' does not get set for the shell started from within gdb.... (gdb) help set environment Set environment variable value to give the program. ^^^^ -- Nick http://www.inet.net.nz/~nickrob