From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20351 invoked by alias); 26 Nov 2009 08:51:39 -0000 Received: (qmail 20343 invoked by uid 22791); 26 Nov 2009 08:51:39 -0000 X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f189.google.com (HELO mail-pz0-f189.google.com) (209.85.222.189) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 26 Nov 2009 08:51:34 +0000 Received: by pzk27 with SMTP id 27so400194pzk.12 for ; Thu, 26 Nov 2009 00:51:33 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.55.11 with SMTP id d11mr980533wfa.17.1259225493092; Thu, 26 Nov 2009 00:51:33 -0800 (PST) In-Reply-To: <4B0D8250.8010705@vmware.com> References: <4B0D8250.8010705@vmware.com> From: Hui Zhu Date: Thu, 26 Nov 2009 16:01:00 -0000 Message-ID: Subject: Re: A question about gdb script To: Michael Snyder Cc: "gdb@sourceware.org" , Pedro Alves , Daniel Jacobowitz Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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/msg00192.txt.bz2 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. =A0It's >> still hard to me. =A0Because 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=3D1 >> 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] =3D=3D '$') 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. =A0Something more elegant might > be better. I try this way but got: (gdb) set $record =3D 3 (gdb) record save core.$record Saved core file core.$record with execution log. 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. Thanks, Hui > >> 2. =A0Sometime, I want just record a function, I want: >> b functon_name >> commands >> silent >> record >> finish >> #Maybe we can record save in this line, this is first question. >> record stop >> end >> But when I really do it. =A0I found that gdb stop running after finish. > > That is unfortunately a long-standing gdb "limitation" (I mean , > known bug). =A0It is so old that it is not likely to be fixed soon. >