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]

[RFC] syntax change for "record save"


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.



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