This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: A question about gdb script


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.

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. ?Sometime, 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. ?I found that gdb stop running after finish.
>
> That is unfortunately a long-standing gdb "limitation" (I mean ,
> known bug). ?It is so old that it is not likely to be fixed soon.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]