|
From: Paul F. <pa...@fr...> - 2008-07-22 16:57:33
|
Hi If I put this in my .valgrindrc --db-attach=yes --db-command="ddd %f %p" then when the aut runs, I get # valgrind: Bad option '%f'; aborting. # valgrind: Use --help for more information. I've tried just about all combinations of single and double quotes. Is there a way to get this to work with a .valgrindrc file? A+ Paul |
|
From: Paul F. <pa...@fr...> - 2008-07-23 16:07:56
|
Quoting Paul Floyd <pa...@fr...>:
> Hi
>
> If I put this in my .valgrindrc
>
> --db-attach=yes --db-command="ddd %f %p"
>
> then when the aut runs, I get
>
> # valgrind: Bad option '%f'; aborting.
> # valgrind: Use --help for more information.
>
> I've tried just about all combinations of single and double quotes.
>
> Is there a way to get this to work with a .valgrindrc file?
Hi
[I should have stated, Valgrind 3.3.1 on RHEL3]
Looking at m_commandline.c, add_args_from_string
then I can't see how it's possible to use any option that includes blanks, since
this function cuts the string unconditionally on blanks.
Here's my stab at allowing double quotes. Double quotes are skipped and
converted to spaces. I don't do any error detection of unclosed double quotes.
static void add_args_from_string ( HChar* s )
{
HChar* tmp;
HChar* cp = s;
int quoted = 0;
vg_assert(cp);
while (True) {
// We have alternating sequences: blanks, non-blanks, blanks...
// blanks may be included within double quotes, which themselves are
// skipped and converted into blanks
// copy the non-blanks sequences, and add terminating '\0'
while (VG_(isspace)(*cp))
cp++;
if (*cp == 0)
break;
tmp = cp;
if (*cp == '"') {
quoted = 1;
*cp = ' ';
++cp;
}
while ((quoted || !VG_(isspace)(*cp)) && *cp != 0 ) {
++cp;
if (*cp == '"') {
quoted = !quoted;
*cp = ' ';
++cp;
}
}
if ( *cp != 0 )
*cp++ = '\0'; // terminate if not the last
add_string( VG_(args_for_valgrind), tmp );
}
}
A+
Paul
|