Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Snyder <msnyder@vmware.com>
To: Hui Zhu <teawater@gmail.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>,
	  Pedro Alves <pedro@codesourcery.com>,
	 Daniel Jacobowitz <drow@false.org>
Subject: Re: A question about gdb script
Date: Fri, 27 Nov 2009 01:37:00 -0000	[thread overview]
Message-ID: <4B0EC8BF.2050504@vmware.com> (raw)
In-Reply-To: <daef60380911260051r3af4118bqc0db7afc5fadf57a@mail.gmail.com>

Hui Zhu wrote:
> On Thu, Nov 26, 2009 at 03:15, Michael Snyder <msnyder@vmware.com> 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.


      reply	other threads:[~2009-11-26 18:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-25 19:19 Hui Zhu
2009-11-26  8:30 ` Daniel Jacobowitz
2009-11-26  8:51   ` Pedro Alves
2009-11-26 15:54     ` Hui Zhu
2009-11-26 17:16       ` Marc Khouzam
2009-11-27  0:32       ` Michael Snyder
2009-11-27  8:05         ` Hui Zhu
2009-11-26 15:39 ` Michael Snyder
2009-11-26 16:01   ` Hui Zhu
2009-11-27  1:37     ` Michael Snyder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4B0EC8BF.2050504@vmware.com \
    --to=msnyder@vmware.com \
    --cc=drow@false.org \
    --cc=gdb@sourceware.org \
    --cc=pedro@codesourcery.com \
    --cc=teawater@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox