|
From: Josef W. <Jos...@gm...> - 2007-11-23 11:09:52
|
On Friday 23 November 2007, sv...@va... wrote:
> Author: njn
> Date: 2007-11-23 01:41:32 +0000 (Fri, 23 Nov 2007)
> New Revision: 7202
>
> Log:
> Fixed up the log file mess throughout, including the docs. This killed
> --log-file-qualifier and --log-file-exactly.
Thanks!
> +// - Get Josef to update the Callgrind --callgrind-out-file option.
I'll do.
VG_(expand_file_name) looks almost good to me.
In callgrind, I allow to set an absolute output name with eg. "--base=/tmp/clgout".
If the format starts with a slash, we could skip prefixing the output with
the base_dir.
So what about
===================================================================
--- m_options.c (Revision 7203)
+++ m_options.c (Arbeitskopie)
@@ -144,11 +144,17 @@
goto bad;
}
+ // if format starts with a '/', do not prefix with startup dir
+ if (format[0] != '/')
+ j += VG_(strlen)(base_dir);
+
// The 10 is slop, it should be enough in most cases.
- j = VG_(strlen)(base_dir);
len = j + VG_(strlen)(format) + 10;
out = VG_(malloc)( len );
- VG_(strcpy)(out, base_dir);
+ if (format[0] != '/') {
+ VG_(strcpy)(out, base_dir);
+ out[j++] = '/';
+ }
#define ENSURE_THIS_MUCH_SPACE(x) \
if (j + x >= len) { \
@@ -156,7 +162,6 @@
out = VG_(realloc)(out, len); \
}
- out[j++] = '/';
while (format[i]) {
if (format[i] != '%') {
ENSURE_THIS_MUCH_SPACE(1);
===================================================================
Very minor points:
playing a little bit with %q, I got misleading errors.
weidendo@linux:~> valgrind --log-file=foo%q ls
==17529== --log-file: expected 'p' or 'q' or '%' after '%'
valgrind: Bad option '--log-file=foo%q'; aborting.
valgrind: Use --help for more information.
weidendo@linux:~> valgrind --log-file=foo%q{x}%q{y} ls
==17625== --log-file: environment variable x is not set
valgrind: Bad option '--log-file=foo%q{x'; aborting.
valgrind: Use --help for more information.
Thanks again for doing this,
Josef
|