From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12999 invoked by alias); 23 Feb 2007 00:10:48 -0000 Received: (qmail 12991 invoked by uid 22791); 23 Feb 2007 00:10:48 -0000 X-Spam-Check-By: sourceware.org Received: from wr-out-0506.google.com (HELO wr-out-0506.google.com) (64.233.184.231) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 23 Feb 2007 00:10:42 +0000 Received: by wr-out-0506.google.com with SMTP id 55so552531wri for ; Thu, 22 Feb 2007 16:10:41 -0800 (PST) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=DjMSpf09gMkhn2IB2XkdSlIY9CBTKh5IlRENhCOVyoZRfsrmmDx4Dj7/oMYTBf8G/lFmoENwR9r9CEBSMpAB4CFXDv6UGLdDJchJ2c3K8Y9hNHkGOFcwG7yFPrKvFfUcsxIGDf+wZ23z3gCkXW8H3B2n4FUo9G+sP4qWMh2wxVY= Received: by 10.115.93.16 with SMTP id v16mr563051wal.1172189440724; Thu, 22 Feb 2007 16:10:40 -0800 (PST) Received: by 10.114.95.11 with HTTP; Thu, 22 Feb 2007 16:10:40 -0800 (PST) Message-ID: Date: Fri, 23 Feb 2007 11:49:00 -0000 From: "Rob Quill" To: gdb@sourceware.org Subject: Re: step through entire file, saving each line to file? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <9109689.post@talk.nabble.com> 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-02/txt/msg00244.txt.bz2 On 22/02/07, Dexter Riley wrote: > > hello! I'd like to step through an entire program, and dump each executed > line fo file. I can do > gdb myprogram > tee savefile > (gdb)display/i $pc > (gdb)start > (gdb)si > > and it displays the currently executed line. I'd like the equivalent of > typing si multiple times; trying > (gdb) si 1000 > apparently steps through 1000 lines and shows me THAT line. > > Is there some nifty si or shell trick to do this? Sorry for the newbie > question, but any help would be greatly appreciated. You should be able to write a GDB command file to do it. I think this should work: myprogram > tee savefile display/i $pc start # Loop while the program hasn't finished while($_exitcode == (void *)0) { si } Although I haven't tested that, but if it is not that it is something close. You can read up on command files in the manual, but basically, write a file with the above in, then run GDB with the -x option. eg: gdb myprogram -x myscript Hopefully that will work. Appologies if I'm wrong, it's been a long day of memory leak fixing :( Rob > Thanks very much, > dexter > -- > View this message in context: http://www.nabble.com/step-through-entire-file%2C-saving-each-line-to-file--tf3275680.html#a9109689 > Sent from the gdb - General mailing list archive at Nabble.com. > >