This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFC] Avoid multiple unnecessary execution of regformats/regdat.sh script
- From: "Pierre Muller" <pierre dot muller at ics-cnrs dot unistra dot fr>
- To: <gdb-patches at sourceware dot org>
- Date: Tue, 18 Jan 2011 16:45:26 +0100
- Subject: [RFC] Avoid multiple unnecessary execution of regformats/regdat.sh script
On Cygwin/Mingw targets,
compilation of gdbserver is lengthy because
it recompiles i386.c and similar files
over and over again.
The patch below avoids this by touching
the generated file, if it is unchanged but older
that the script or the data file sued by the script.
As I have no idea if the use of 'touch'
is OK here, I simply send this in as a RFC.
I works nicely for me, and I don't see
any drawback, other than that you lose the real
time at which the generated file was last changed
if the script or the data file is changed later
without affecting the output.
Comments?
Pierre Muller
GDB pascal language maintainer
2011-01-18 Pierre Muller <muller@ics.u-strasbg.fr>
* regformats/regdat.sh (move_if_change): Touch unchanged file
if script of data file is newer to avoid rerunning script.
Index: src/gdb/regformats/regdat.sh
===================================================================
RCS file: /cvs/src/src/gdb/regformats/regdat.sh,v
retrieving revision 1.14
diff -u -p -r1.14 regdat.sh
--- src/gdb/regformats/regdat.sh 1 Jan 2011 15:33:27 -0000 1.14
+++ src/gdb/regformats/regdat.sh 18 Jan 2011 15:07:19 -0000
@@ -25,6 +25,16 @@ move_if_change ()
if test -r ${file} && cmp -s "${file}" new-"${file}"
then
echo "${file} unchanged." 1>&2
+ if test ${file} -ot $0
+ then
+ echo "Script \"$0\" is newer, touching \"${file}\"" 1>&2
+ touch -r $0 ${file}
+ fi
+ if test ${file} -ot $1
+ then
+ echo "Data file \"$1\" is newer, touching \"${file}\"" 1>&2
+ touch -r $1 ${file}
+ fi
else
mv new-"${file}" "${file}"
echo "${file} updated." 1>&2