From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15481 invoked by alias); 26 Nov 2009 18:32:40 -0000 Received: (qmail 15468 invoked by uid 22791); 26 Nov 2009 18:32:39 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from smtp-outbound-1.vmware.com (HELO smtp-outbound-1.vmware.com) (65.115.85.69) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Nov 2009 18:32:34 +0000 Received: from mailhost4.vmware.com (mailhost4.vmware.com [10.16.67.124]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id 7092D13089; Thu, 26 Nov 2009 10:32:33 -0800 (PST) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost4.vmware.com (Postfix) with ESMTP id 6789BC9A1C; Thu, 26 Nov 2009 10:32:33 -0800 (PST) Message-ID: <4B0EC8BF.2050504@vmware.com> Date: Fri, 27 Nov 2009 01:37:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20090624) MIME-Version: 1.0 To: Hui Zhu CC: "gdb@sourceware.org" , Pedro Alves , Daniel Jacobowitz Subject: Re: A question about gdb script References: <4B0D8250.8010705@vmware.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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: 2009-11/txt/msg00198.txt.bz2 Hui Zhu wrote: > On Thu, Nov 26, 2009 at 03:15, Michael Snyder wrote: >> Hui Zhu wrote: >> >>> 1. If I want get the gdb_record.xxx file of each record cycle. It's >>> still hard to me. Because if I add "record save" to commands, each >>> time it will save record entry to same file. >>> Does gdb have some way to handle it? like: >>> $a=1 >>> record save $a >>> $a++ >> If you look at cmd_record_save, you see it has (char *args). >> GDB will pass "$a" as "args", so at that point you have the >> opportunity to say, eg. "if (args[0] == '$') then do something". >> >> One possibility would be to create your default name, eg. >> gdb_record.12345, and then append $a making gdb_record.12345.1 >> >> That's the quick and dirty way. Something more elegant might >> be better. > > I try this way but got: > (gdb) set $record = 3 > (gdb) record save core.$record > Saved core file core.$record with execution log. No, what I meant was (gdb) set $foo = 3 (gdb) record save $foo That way you can look at the *first character* of "args", and use an 'if' to do something special with it, such as char *filename = strcat("gdb_record.core", args); > Maybe I can post a patch for it. What about following: > (gdb) set record not_overwrite_save on > (gdb) record save core > Saved core file core with execution log. > (gdb) record save core > Saved core file core.0 with execution log. > (gdb) record save core > Saved core file core.1 with execution log. That's also a possibility, although I think we are headed in the direction of having too many mode variables associated with process rec.