From: Nicholas Nethercote Date: Sat, 12 Mar 2005 21:20:39 +0000 (+0000) Subject: BUGFIX: process_cmd_line_options mangles options with the syntax X-Git-Tag: svn/VALGRIND_3_0_0~1000 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bfa6142ae683fba7cdfc73baf2450f2335248a06;p=thirdparty%2Fvalgrind.git BUGFIX: process_cmd_line_options mangles options with the syntax --TOOLNAME:option=foo. If you use --trace-children=yes, the child Valgrinds are passed the mangled options and fail as a result. This patch makes sure that process_cmd_line_options makes a copy of the option before mangling it. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3318 --- diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 5338118076..1793fafcd5 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -1645,7 +1645,7 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname ) // prefix matches, convert "--toolname:foo" to "--foo" if (0) VG_(printf)("tool-specific arg: %s\n", arg); - arg += toolname_len + 1; + arg = strdup(arg + toolname_len + 1); arg[0] = '-'; arg[1] = '-'; @@ -1657,14 +1657,14 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname ) /* Ignore these options - they've already been handled */ if (VG_CLO_STREQN(7, arg, "--tool=")) - continue; + goto skip_arg; if (VG_CLO_STREQN(7, arg, "--exec=")) - continue; + goto skip_arg; if (VG_CLO_STREQN(20, arg, "--command-line-only=")) - continue; + goto skip_arg; if ( VG_CLO_STREQ(arg, "--")) - continue; + goto skip_arg; else if (VG_CLO_STREQ(arg, "-v") || VG_CLO_STREQ(arg, "--verbose")) @@ -1819,6 +1819,9 @@ static void process_cmd_line_options( UInt* client_auxv, const char* toolname ) || ! TL_(process_cmd_line_option)(arg) ) { VG_(bad_option)(arg); } + skip_arg: + if (arg != vg_argv[i]) + free(arg); } /* Make VEX control parameters sane */