This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: [RFC] syntax change for "record save"
- From: "Jakob Engblom" <jakob at virtutech dot com>
- To: "'Joel Brobecker'" <brobecker at adacore dot com>, "'Michael Snyder'" <msnyder at vmware dot com>
- Cc: <gdb at sourceware dot org>, "'Hui Zhu'" <teawater at gmail dot com>
- Date: Tue, 1 Dec 2009 13:56:03 +0100
- Subject: RE: [RFC] syntax change for "record save"
- References: <4B0EF39A.10802@vmware.com> <20091127013738.GL18141@adacore.com>
> > 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.
>
> This is not an objection, but I am really not fond of that extension.
> It feels ad hoc that the extension, if provided, should be evaluated
> as an integer. What if the user wanted a more general scheme? Or what
> if he wanted to the suffix to be in hex?
>
> If I were Teawater, I'd probably look at writing a python script
> rather than a GDB script. In particular, it's easy to compose the
> right CLI command from python using:
>
> (gdb) python gdb.execute("rec save file.%d" % 1)
>
> You can replace the "1" above by an python variable, including
> one obtained by evaluating an expression as a long.
To take some input from a different (commercial, closed-source, if someone asks)
tool with a similar interface of script + Python, in Simics, we solve that by
having our CLI (quite similar to gdb in many ways) be able to construct strings.
So we would do something like this:
simics> save ("file." + $a)
(when the first argument to + is a string, the next argument is forced to a
string)
Or
Simics> save ("file.%d" % [$a]) ## Support for Python-style % operator in CLI
I think supporting string generation would solve many more problems easily.
The save name INDEX to me seems silly, if you are doing this manually, why don't
you just type a different name each time?
Best regards,
/jakob
_______________________________________________________
Jakob Engblom, PhD, Technical Marketing Manager
Virtutech?????????????????? Direct: +46 8 690 07 47???
Drottningholmsvägen 22????? Mobile: +46 709 242 646??
11243 Stockholm???????????? Web:??? www.virtutech.com?
Sweden
________________________________________________________
?