From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19425 invoked by alias); 26 Nov 2009 21:35:30 -0000 Received: (qmail 19415 invoked by uid 22791); 26 Nov 2009 21:35:30 -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-2.vmware.com (HELO smtp-outbound-2.vmware.com) (65.115.85.73) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Nov 2009 21:35:27 +0000 Received: from mailhost3.vmware.com (mailhost3.vmware.com [10.16.27.45]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 3C953121B0; Thu, 26 Nov 2009 13:35:25 -0800 (PST) Received: from [10.20.94.141] (msnyder-server.eng.vmware.com [10.20.94.141]) by mailhost3.vmware.com (Postfix) with ESMTP id 318A4CD905; Thu, 26 Nov 2009 13:35:25 -0800 (PST) Message-ID: <4B0EF39A.10802@vmware.com> Date: Fri, 27 Nov 2009 02:25:00 -0000 From: Michael Snyder User-Agent: Thunderbird 1.5.0.12 (X11/20090624) MIME-Version: 1.0 To: gdb@sourceware.org, Hui Zhu Subject: [RFC] syntax change for "record save" 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/msg00199.txt.bz2 This proposal follows from Teawater's thread "A question about gdb script", in which Teawater wants to know how to use a gdb local variable to append a sequence number to the file name of a record log file. Here is my proposal. We change the syntax of the "record save" command so that it expects an additional, optional argument. If the 2nd argument is present, we evaluate it as an integer expression and suffix it to the filename (with a period). Evaluating it as an expression means that it can be anything from an integer to a dollar-variable, and the expression can even increment it. So, for instance: (gdb) rec save Saved core file gdb_record.19165 with execution log. (gdb) rec save foo 1 Saved core file foo.1 with execution log. (gdb) rec save foo 2 Saved core file foo.2 with execution log. (gdb) set $a = 1 (gdb) rec save foo $a++ Saved core file foo.1 with execution log. (gdb) step foo () at /data/home/msnyder/cvs/localhost/quilt/gdb/testsuite/gdb.reverse/break-reverse.c:28 28 xyz = 1; /* break in foo */ (gdb) rec save foo $a++ Saved core file foo.2 with execution log. (gdb) step 29 return bar (); (gdb) rec save foo $a++ Saved core file foo.3 with execution log. I'll submit a patch momentarily.