|
From: <sv...@va...> - 2005-09-22 11:34:55
|
Author: sewardj
Date: 2005-09-22 12:34:48 +0100 (Thu, 22 Sep 2005)
New Revision: 4720
Log:
Overhaul and simplify command line and environment handling. Currently
half-baked; do not use.
Added:
branches/ASPACEM/include/pub_tool_clientstate.h
Modified:
branches/ASPACEM/cachegrind/cg_main.c
branches/ASPACEM/coregrind/Makefile.am
branches/ASPACEM/coregrind/m_clientstate.c
branches/ASPACEM/coregrind/m_commandline.c
branches/ASPACEM/coregrind/m_debugger.c
branches/ASPACEM/coregrind/m_launcher.c
branches/ASPACEM/coregrind/m_libcproc.c
branches/ASPACEM/coregrind/m_main.c
branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
branches/ASPACEM/coregrind/pub_core_clientstate.h
branches/ASPACEM/coregrind/pub_core_commandline.h
branches/ASPACEM/coregrind/pub_core_libcproc.h
branches/ASPACEM/coregrind/pub_core_main.h
branches/ASPACEM/include/Makefile.am
branches/ASPACEM/include/pub_tool_libcproc.h
branches/ASPACEM/massif/ms_main.c
Modified: branches/ASPACEM/cachegrind/cg_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/cachegrind/cg_main.c 2005-09-21 12:01:37 UTC (rev 47=
19)
+++ branches/ASPACEM/cachegrind/cg_main.c 2005-09-22 11:34:48 UTC (rev 47=
20)
@@ -42,6 +42,7 @@
#include "pub_tool_options.h"
#include "pub_tool_profile.h"
#include "pub_tool_tooliface.h"
+#include "pub_tool_clientstate.h"
=20
#include "cg_arch.h"
#include "cg_sim.c"
@@ -894,11 +895,12 @@
// "cmd:" line
VG_(strcpy)(buf, "cmd:");
VG_(write)(fd, (void*)buf, VG_(strlen)(buf));
- for (i =3D 0; i < VG_(client_argc); i++) {
- if (VG_(client_argv)[i] =3D=3D NULL)
+ for (i =3D 0; i < VG_(args_for_client).used; i++) {
+ if (VG_(args_for_client).strs[i] =3D=3D NULL)
continue;
VG_(write)(fd, " ", 1);
- VG_(write)(fd, VG_(client_argv)[i], VG_(strlen)(VG_(client_argv)[=
i]));
+ VG_(write)(fd, VG_(args_for_client).strs[i],=20
+ VG_(strlen)(VG_(args_for_client).strs[i]));
}
// "events:" line
VG_(sprintf)(buf, "\nevents: Ir I1mr I2mr Dr D1mr D2mr Dw D1mw D2mw\n=
");
Modified: branches/ASPACEM/coregrind/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/Makefile.am 2005-09-21 12:01:37 UTC (rev 4=
719)
+++ branches/ASPACEM/coregrind/Makefile.am 2005-09-22 11:34:48 UTC (rev 4=
720)
@@ -87,7 +87,6 @@
=20
valgrind_SOURCES =3D \
m_launcher.c \
- m_commandline.c \
m_debuglog.c
=20
libcoregrind_singles_a_SOURCES =3D \
Modified: branches/ASPACEM/coregrind/m_clientstate.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_clientstate.c 2005-09-21 12:01:37 UTC (r=
ev 4719)
+++ branches/ASPACEM/coregrind/m_clientstate.c 2005-09-22 11:34:48 UTC (r=
ev 4720)
@@ -39,20 +39,46 @@
/*--- ---*/
/*-----------------------------------------------------------------*/
=20
+/* Client address space, lowest to highest (see top of ume.c) */
// TODO: get rid of as many of these as possible.
=20
-/* Client address space, lowest to highest (see top of ume.c) */
-Addr VG_(client_base); /* client address space limits */
-Addr VG_(client_end);
+Addr VG_(client_base) =3D 0; /* client address space limits */
+Addr VG_(client_end) =3D 0;
=20
-Addr VG_(clstk_base);
-Addr VG_(clstk_end);
-UWord VG_(clstk_id);
+Addr VG_(clstk_base) =3D 0;
+Addr VG_(clstk_end) =3D 0;
+UWord VG_(clstk_id) =3D 0;
=20
-Addr VG_(brk_base) =3D 0; /* start of brk */
-Addr VG_(brk_limit) =3D 0; /* current brk */
+Addr VG_(brk_base) =3D 0; /* start of brk */
+Addr VG_(brk_limit) =3D 0; /* current brk */
=20
=20
+// Command line pieces, after they have been extracted from argv in
+// m_main.main(). The payload vectors are allocated in VG_AR_TOOL
+// (the default arena). They are never freed.
+
+/* Args for the client. */
+XArrayStrings VG_(args_for_client) =3D {0,0,NULL};
+
+/* Args for V (augments, then those from the launcher). */
+XArrayStrings VG_(args_for_valgrind) =3D {0,0,NULL};
+
+/* How many of the above not to pass on at execve time? */
+Int VG_(args_for_valgrind_noexecpass) =3D 0;
+
+/* The name of the client executable, as specified on the command
+ line. */
+HChar* VG_(args_the_exename) =3D NULL;
+
+// Client's original rlimit data and rlimit stack
+struct vki_rlimit VG_(client_rlimit_data);
+struct vki_rlimit VG_(client_rlimit_stack);
+
+// Name of the launcher, as extracted from VALGRIND_LAUNCHER at
+// startup.
+HChar* VG_(name_of_launcher) =3D NULL;
+
+
/*--------------------------------------------------------------------*/
/*--- end ---*/
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/m_commandline.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_commandline.c 2005-09-21 12:01:37 UTC (r=
ev 4719)
+++ branches/ASPACEM/coregrind/m_commandline.c 2005-09-22 11:34:48 UTC (r=
ev 4720)
@@ -28,6 +28,7 @@
The GNU General Public License is contained in the file COPYING.
*/
=20
+// TODO: prune these
#include "pub_core_basics.h"
#include "pub_core_commandline.h"
#include "pub_core_libcassert.h"
@@ -37,7 +38,94 @@
#include "pub_core_libcproc.h"
#include "pub_core_mallocfree.h"
#include "pub_core_options.h"
+#include "pub_core_clientstate.h"
=20
+
+/* Add a string to an expandable array of strings. */
+static void add_string ( XArrayStrings* xa, HChar* str )
+{
+ Int i;
+ HChar** strs2;
+ vg_assert(xa->used >=3D 0);
+ vg_assert(xa->size >=3D 0);
+ vg_assert(xa->used <=3D xa->size);
+ if (xa->strs =3D=3D NULL) vg_assert(xa->size =3D=3D 0);
+
+ if (xa->used =3D=3D xa->size) {
+ xa->size =3D xa->size=3D=3D0 ? 2 : 2*xa->size;
+ strs2 =3D VG_(malloc)( xa->size * sizeof(HChar*) );
+ for (i =3D 0; i < xa->used; i++)
+ strs2[i] =3D xa->strs[i];
+ if (xa->strs)=20
+ VG_(free)(xa->strs);
+ xa->strs =3D strs2;
+ }
+ vg_assert(xa->used < xa->size);
+ xa->strs[xa->used++] =3D str;
+}
+
+
+/* Split up the args presented by the launcher to m_main.main(), and
+ park them in VG_(args_for_client), VG_(args_for_valgrind),
+ VG_(args_for_valgrind_extras) and VG_(args_the_exename). The
+ latter are acquired from $VALGRIND_OPTS, ./.valgrindrc and
+ ~/.valgrindrc.=20
+*/
+/* Scheme: args look like this:
+
+ args-for-v exe_name args-for-c
+
+ args-for-v are taken until either they don't start with '-' or
+ a "--" is seen.
+
+ If args-for-v includes --command-line-only=3Dyes, then the extra
+ sources (env vars, files) are not consulted.
+*/
+
+
+void VG_(split_up_argv)( Int argc, HChar** argv )
+{
+ Int i;
+ Bool augment =3D True;
+ static Bool already_called =3D False;
+
+ /* This function should be called once, at startup, and then never
+ again. */
+ vg_assert(!already_called);
+ already_called =3D True;
+
+ /* Collect up the args-for-V. */
+ i =3D 1; /* skip the exe (stage2) name. */
+ for (; i < argc; i++) {
+ vg_assert(argv[i]);
+ if (0 =3D=3D VG_(strcmp)(argv[i], "--")) {
+ i++;
+ break;
+ }
+ if (0 =3D=3D VG_(strcmp)(argv[i], "--command-line-only=3Dyes"))
+ augment =3D False;
+ if (argv[i][0] !=3D '-')
+ break;
+ add_string( &VG_(args_for_valgrind), argv[i] );
+ }
+
+ /* Should now be looking at the exe name. */
+ if (i < argc) {
+ vg_assert(argv[i]);
+ VG_(args_the_exename) =3D argv[i];
+ i++;
+ }
+
+ /* The rest are args for the client. */
+ for (; i < argc; i++) {
+ vg_assert(argv[i]);
+ add_string( &VG_(args_for_client), argv[i] );
+ }
+
+
+}
+
+
// Note that we deliberately don't free the malloc'd memory. See commen=
t
// at call site.
static char* get_file_clo(char* dir)
@@ -107,6 +195,7 @@
// files.
static void augment_command_line(Int* vg_argc_inout, char*** vg_argv_ino=
ut)
{
+#if 0
int vg_argc0 =3D *vg_argc_inout;
char** vg_argv0 =3D *vg_argv_inout;
=20
@@ -173,81 +262,5 @@
=20
*vg_argc_inout =3D vg_argc0;
*vg_argv_inout =3D vg_argv0;
+#endif
}
-
-void VG_(get_command_line)( int argc, char** argv,
- Int* vg_argc_out, Char*** vg_argv_out,=20
- char*** cl_argv_out )
-{
- int vg_argc0;
- char** vg_argv0;
- char** cl_argv;
- char* env_clo =3D VG_(getenv)(VALGRINDCLO);
-
- if (env_clo !=3D NULL && *env_clo !=3D '\0') {
- char *cp;
- char **cpp;
-
- /* OK, VALGRINDCLO is set, which means we must be a child of anoth=
er
- Valgrind process using --trace-children, so we're getting all o=
ur
- arguments from VALGRINDCLO, and the entire command line belongs=
to
- the client (including argv[0]) */
- vg_argc0 =3D 1; /* argv[0] */
- for (cp =3D env_clo; *cp; cp++)
- if (*cp =3D=3D VG_CLO_SEP)
- vg_argc0++;
-
- vg_argv0 =3D VG_(malloc)(sizeof(char **) * (vg_argc0 + 1));
- vg_assert(vg_argv0);
-
- cpp =3D vg_argv0;
-
- *cpp++ =3D "valgrind"; /* nominal argv[0] */
- *cpp++ =3D env_clo;
-
- // Replace the VG_CLO_SEP args separator with '\0'
- for (cp =3D env_clo; *cp; cp++) {
- if (*cp =3D=3D VG_CLO_SEP) {
- *cp++ =3D '\0'; /* chop it up in place */
- *cpp++ =3D cp;
- }
- }
- *cpp =3D NULL;
- cl_argv =3D argv;
-
- } else {
- Bool noaugment =3D False;
-
- /* Count the arguments on the command line. */
- vg_argv0 =3D argv;
-
- for (vg_argc0 =3D 1; vg_argc0 < argc; vg_argc0++) {
- Char* arg =3D argv[vg_argc0];
- if (arg[0] !=3D '-') /* exe name */
- break;
- if (VG_STREQ(arg, "--")) { /* dummy arg */
- vg_argc0++;
- break;
- }
- VG_BOOL_CLO(arg, "--command-line-only", noaugment)
- }
- cl_argv =3D &argv[vg_argc0];
-
- /* Get extra args from VALGRIND_OPTS and .valgrindrc files.
- Note we don't do this if getting args from VALGRINDCLO, as=20
- those extra args will already be present in VALGRINDCLO.
- (We also don't do it when --command-line-only=3Dyes.) */
- if (!noaugment)
- augment_command_line(&vg_argc0, &vg_argv0);
- }
-
- if (0) {
- Int i;
- for (i =3D 0; i < vg_argc0; i++)
- VG_(printf)("vg_argv0[%d]=3D\"%s\"\n", i, vg_argv0[i]);
- }
-
- *vg_argc_out =3D vg_argc0;
- *vg_argv_out =3D (Char**)vg_argv0;
- *cl_argv_out =3D cl_argv;
-}
Modified: branches/ASPACEM/coregrind/m_debugger.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_debugger.c 2005-09-21 12:01:37 UTC (rev =
4719)
+++ branches/ASPACEM/coregrind/m_debugger.c 2005-09-22 11:34:48 UTC (rev =
4720)
@@ -30,6 +30,7 @@
=20
#include "pub_core_basics.h"
#include "pub_core_threadstate.h"
+#include "pub_core_clientstate.h"
#include "pub_core_debugger.h"
#include "pub_core_libcbase.h"
#include "pub_core_libcprint.h"
Modified: branches/ASPACEM/coregrind/m_launcher.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_launcher.c 2005-09-21 12:01:37 UTC (rev =
4719)
+++ branches/ASPACEM/coregrind/m_launcher.c 2005-09-22 11:34:48 UTC (rev =
4720)
@@ -28,27 +28,20 @@
The GNU General Public License is contained in the file COPYING.
*/
=20
-#include <ctype.h>
+/* Note: this is a "normal" program and not part of Valgrind proper,
+ and so it doesn't have to conform to Valgrind's arcane rules on
+ no-glibc-usage etc. */
+
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <assert.h>
=20
-#include "pub_core_basics.h"
-#include "pub_core_commandline.h"
#include "pub_core_debuglog.h"
-#include "pub_core_libcassert.h"
-#include "pub_core_libcbase.h"
-#include "pub_core_libcfile.h"
-#include "pub_core_libcprint.h"
-#include "pub_core_libcproc.h" // For VALGRINDLIB
-#include "pub_core_mallocfree.h"
+#include "pub_core_libcproc.h" // For VALGRIND_LIB, VALGRIND_LAUNCHER
=20
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <assert.h>
=20
=20
#define PATH_MAX 4096 /* POSIX refers to this a lot but I dunno
@@ -66,68 +59,57 @@
int main(int argc, char** argv, char** envp)
{
int i, j, loglevel, r;
- Int vg_argc;
- Char **vg_argv;
- char **cl_argv;
const char *toolname =3D NULL;
const char *cp;
char *toolfile;
- char stage1_name[PATH_MAX+1];
+ char launcher_name[PATH_MAX+1];
char* new_line;
char** new_env;
=20
/* Start the debugging-log system ASAP. First find out how many=20
- "-d"s were specified. This is a pre-scan of the command line. */
+ "-d"s were specified. This is a pre-scan of the command line.
+ At the same time, look for the tool name. */
loglevel =3D 0;
for (i =3D 1; i < argc; i++) {
- if (argv[i][0] !=3D '-')
- break;
- if (0 =3D=3D strcmp(argv[i], "--"))=20
- break;
- if (0 =3D=3D strcmp(argv[i], "-d"))=20
- loglevel++;
+ if (argv[i][0] !=3D '-')
+ break;
+ if (0 =3D=3D strcmp(argv[i], "--"))=20
+ break;
+ if (0 =3D=3D strcmp(argv[i], "-d"))=20
+ loglevel++;
+ if (0 =3D=3D strncmp(argv[i], "--tool=3D", 7))=20
+ toolname =3D argv[i] + 7;
}
=20
/* ... and start the debug logger. Now we can safely emit logging
messages all through startup. */
VG_(debugLog_startup)(loglevel, "Stage 1");
=20
- /* Get the full command line */
- VG_(get_command_line)(argc, argv, &vg_argc, &vg_argv, &cl_argv);
-
- /* Look for a --tool switch */
- for (i =3D 1; i < vg_argc; i++) {
- if (0 =3D=3D strncmp(vg_argv[i], "--tool=3D", 7))=20
- toolname =3D vg_argv[i] + 7;
- }
-
/* Make sure we know which tool we're using */
if (toolname) {
- VG_(debugLog)(1, "stage1", "tool %s requested\n", toolname);
+ VG_(debugLog)(1, "launcher", "tool '%s' requested\n", toolname);
} else {
- VG_(debugLog)(1, "stage1", "no tool requested, defaulting to memch=
eck\n");
+ VG_(debugLog)(1, "launcher",=20
+ "no tool requested, defaulting to 'memcheck'\n");
toolname =3D "memcheck";
}
=20
- /* Figure out the name of this executable, so we can tell
- stage2. */
- memset(stage1_name, 0, PATH_MAX+1);
- r =3D readlink("/proc/self/exe", stage1_name, PATH_MAX);
+ /* Figure out the name of this executable (viz, the launcher), so
+ we can tell stage2. stage2 will use the name for recursive
+ invokations of valgrind on child processes. */
+ memset(launcher_name, 0, PATH_MAX+1);
+ r =3D readlink("/proc/self/exe", launcher_name, PATH_MAX);
if (r =3D=3D -1)
barf("readlink(\"/proc/self/exe\") failed.");
=20
- r =3D setenv(VALGRINDSTAGE1, stage1_name, 1/*overwrite*/);
- if (r !=3D 0)
- barf("setenv(VALGRINDSTAGE1) failed.");
-
- /* tediously augment the env: VALGRINDSTAGE1=3Dstage1_name */
- new_line =3D malloc(strlen(VALGRINDSTAGE1) + 1=20
- + strlen(stage1_name) + 1);
+ /* tediously augment the env: VALGRIND_LAUNCHER=3Dlauncher_name */
+ new_line =3D malloc(strlen(VALGRIND_LAUNCHER) + 1=20
+ + strlen(launcher_name) + 1);
if (new_line =3D=3D NULL)
barf("malloc of new_line failed.");
- strcpy(new_line, VALGRINDSTAGE1);
+ strcpy(new_line, VALGRIND_LAUNCHER);
strcat(new_line, "=3D");
- strcat(new_line, stage1_name);
+ strcat(new_line, launcher_name);
=20
for (j =3D 0; envp[j]; j++)
;
@@ -140,18 +122,19 @@
new_env[i++] =3D NULL;
assert(i =3D=3D j+2);
=20
+ /* Establish the correct VALGRIND_LIB. */
+ cp =3D getenv(VALGRIND_LIB);
=20
- cp =3D getenv(VALGRINDLIB);
-
if (cp !=3D NULL)
valgrind_lib =3D cp;
=20
+ /* Build the stage2 invokation, and execve it. Bye! */
toolfile =3D malloc(strlen(valgrind_lib) + strlen(toolname) + 2);
if (toolfile =3D=3D NULL)
barf("malloc of toolfile failed.");
sprintf(toolfile, "%s/%s", valgrind_lib, toolname);
=20
- VG_(debugLog)(1, "stage1", "launching %s\n", toolfile);
+ VG_(debugLog)(1, "launcher", "launching %s\n", toolfile);
=20
execve(toolfile, argv, new_env);
=20
@@ -160,103 +143,3 @@
=20
exit(1);
}
-
-void* VG_(malloc) ( SizeT nbytes )
-{
- return malloc(nbytes);
-}
-
-Bool VG_(isspace) ( Char c )
-{
- return isspace(c);
-}
-
-Int VG_(strcmp) ( const Char* s1, const Char* s2 )
-{
- return strcmp(s1, s2);
-}
-
-Char *VG_(getenv)(Char *varname)
-{
- return getenv(varname);
-}
-
-SysRes VG_(open) ( const Char* pathname, Int flags, Int mode )
-{
- SysRes res;
- Int fd;
- if ((fd =3D open(pathname, flags, mode)) < 0) {
- res.isError =3D True;
- res.val =3D errno;
- } else {
- res.isError =3D False;
- res.val =3D fd;
- }
- return res;
-}
-
-void VG_(close) ( Int fd )
-{
- close(fd);
- return;
-}
-
-Int VG_(read) ( Int fd, void* buf, Int count)
-{
- return read(fd, buf, count);
-}
-
-Int VG_(fsize) ( Int fd )
-{
- struct stat buf;
- return fstat(fd, &buf) =3D=3D 0 ? buf.st_size : (-1);
-}
-
-UInt VG_(snprintf) ( Char* buf, Int size, const HChar *format, ... )
-{
- va_list vargs;
- UInt n;
-
- va_start(vargs, format);
- n =3D vsnprintf(buf, size, format, vargs);
- va_end(vargs);
-
- return n;
-}
-
-void VG_(assert_fail) ( Bool isCore, const Char* expr, const Char* file,=
=20
- Int line, const Char* fn, const HChar* format, .=
.. )
-{
- va_list vargs;
- Char buf[256];
-
- va_start(vargs, format);
- vsprintf(buf, format, vargs);
- va_end(vargs);
-
- fprintf(stderr, "\nvalgrind: %s:%d (%s): Assertion '%s' failed.\n",
- file, line, fn, expr );
- if (!strcmp(buf, ""))
- fprintf(stderr, "valgrind: %s\n", buf);
-
- exit(1);
-}
-
-static Bool isterm ( Char c )
-{
- return ( VG_(isspace)(c) || 0 =3D=3D c );
-}
-
-Int VG_(strcmp_ws) ( const Char* s1, const Char* s2 )
-{
- while (True) {
- if (isterm(*s1) && isterm(*s2)) return 0;
- if (isterm(*s1)) return -1;
- if (isterm(*s2)) return 1;
-
- if (*(UChar*)s1 < *(UChar*)s2) return -1;
- if (*(UChar*)s1 > *(UChar*)s2) return 1;
-
- s1++; s2++;
- }
-}
Modified: branches/ASPACEM/coregrind/m_libcproc.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_libcproc.c 2005-09-21 12:01:37 UTC (rev =
4719)
+++ branches/ASPACEM/coregrind/m_libcproc.c 2005-09-22 11:34:48 UTC (rev =
4720)
@@ -35,6 +35,7 @@
#include "pub_core_libcproc.h"
#include "pub_core_mallocfree.h"
#include "pub_core_syscall.h"
+#include "pub_core_clientstate.h"
#include "vki_unistd.h"
=20
/* ---------------------------------------------------------------------
@@ -213,12 +214,9 @@
VG_(sprintf)(buf, "%s*", VG_(libdir));
mash_colon_env(ld_library_path_str, buf);
=20
- // Remove VALGRIND_CLO variable.
- VG_(env_unsetenv)(envp, VALGRINDCLO);
+ // Remove VALGRIND_LAUNCHER variable.
+ VG_(env_unsetenv)(envp, VALGRIND_LAUNCHER);
=20
- // Remove VALGRIND_STAGE1 variable.
- VG_(env_unsetenv)(envp, VALGRINDSTAGE1);
-
// XXX if variable becomes empty, remove it completely?
=20
VG_(arena_free)(VG_AR_CORE, buf);
@@ -311,9 +309,6 @@
Resource limits
------------------------------------------------------------------ */
=20
-struct vki_rlimit VG_(client_rlimit_data);
-struct vki_rlimit VG_(client_rlimit_stack);
-
/* Support for getrlimit. */
Int VG_(getrlimit) (Int resource, struct vki_rlimit *rlim)
{
Modified: branches/ASPACEM/coregrind/m_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_main.c 2005-09-21 12:01:37 UTC (rev 4719=
)
+++ branches/ASPACEM/coregrind/m_main.c 2005-09-22 11:34:48 UTC (rev 4720=
)
@@ -108,8 +108,8 @@
static HChar* name_of_stage1 =3D NULL;
=20
/* our argc/argv */
-static Int vg_argc;
-static Char **vg_argv;
+//static Int vg_argc;
+//static Char **vg_argv;
=20
/* This should get some address inside the stack on which we gained
control (eg, it could be the SP at startup). It doesn't matter
@@ -228,24 +228,23 @@
=20
/* Prepare the client's environment. This is basically a copy of our
environment, except:
- LD_PRELOAD=3D$VALGRINDLIB/vg_preload_core.so:($VALGRINDLIB/vgpreloa=
d_TOOL.so:)?$LD_PRELOAD
=20
+ LD_PRELOAD=3D$VALGRIND_LIB/vg_preload_core.so:
+ ($VALGRIND_LIB/vgpreload_TOOL.so:)?
+ $LD_PRELOAD
+
If this is missing, then it is added.
=20
- Yummy. String hacking in C.
-
If this needs to handle any more variables it should be hacked
- into something table driven.
- */
-static HChar **fix_environment(HChar **origenv, const HChar *toolname)
+ into something table driven. The copy is VG_(malloc)'d space.
+*/
+static HChar** setup_client_env ( HChar** origenv, const HChar* toolname=
)
{
static const HChar preload_core_so[] =3D "vg_preload_core.so";
static const HChar ld_preload[] =3D "LD_PRELOAD=3D";
- static const HChar valgrind_clo[] =3D VALGRINDCLO "=3D";
- static const Int ld_preload_len =3D sizeof(ld_preload)-1;
- static const Int valgrind_clo_len =3D sizeof(valgrind_clo)-1;
- Bool ld_preload_done =3D False;
- Int vgliblen =3D VG_(strlen)(VG_(libdir));
+ static const Int ld_preload_len =3D sizeof(ld_preload)-1;
+ Bool ld_preload_done =3D False;
+ Int vgliblen =3D VG_(strlen)(VG_(libdir));
HChar** cpp;
HChar** ret;
HChar* preload_tool_path;;
@@ -260,7 +259,7 @@
Int preload_string_len =3D preload_core_path_len + preload_tool_pa=
th_len;
HChar* preload_string =3D VG_(malloc)(preload_string_len);
vg_assert(preload_string);
- =20
+
/* Determine if there's a vgpreload_<tool>.so file, and setup
preload_string. */
preload_tool_path =3D VG_(malloc)(preload_tool_path_len);
@@ -279,7 +278,7 @@
VG_(debugLog)(1, "main", "preload_string =3D %s\n", preload_string);
=20
/* Count the original size of the env */
- envc =3D 0; /* trailing NULL */
+ envc =3D 0;
for (cpp =3D origenv; cpp && *cpp; cpp++)
envc++;
=20
@@ -307,8 +306,6 @@
*cpp =3D cp;
=20
ld_preload_done =3D True;
- } else if (VG_(memcmp)(*cpp, valgrind_clo, valgrind_clo_len) =3D=3D=
0) {
- *cpp =3D "";
}
}
=20
@@ -329,7 +326,6 @@
return ret;
}
=20
-extern char **environ; /* our environment */
=20
/* Add a string onto the string table, and return its address */
static char *copy_str(char **tab, const char *str)
@@ -386,7 +382,6 @@
new stack. The returned value is the SP value for the client. */
static=20
Addr setup_client_stack( void* init_sp,
- char** orig_argv,=20
char** orig_envp,=20
const struct exeinfo *info,
UInt** client_auxv,
@@ -403,11 +398,12 @@
const struct ume_auxv *cauxv;
unsigned stringsize; /* total size of strings in bytes */
unsigned auxsize; /* total size of auxv in bytes */
- int argc; /* total argc */
- int envc; /* total number of env vars */
+ Int argc; /* total argc */
+ Int envc; /* total number of env vars */
unsigned stacksize; /* total client stack size */
Addr client_SP; /* client stack base (initial SP) */
Addr clstack_start;
+ Int i;
=20
vg_assert(VG_IS_PAGE_ALIGNED(clstack_end+1));
=20
@@ -432,9 +428,9 @@
}
=20
/* now scan the args we're given... */
- for (cpp =3D orig_argv; *cpp; cpp++) {
+ for (i =3D 0; i < VG_(args_for_client).used; i++) {
argc++;
- stringsize +=3D VG_(strlen)(*cpp) + 1;
+ stringsize +=3D VG_(strlen)( VG_(args_for_client).strs[i] ) + 1;
}
=20
/* ...and the environment */
@@ -540,7 +536,7 @@
*ptr++ =3D (Addr)copy_str(&strtab, info->interp_args);
VG_(free)(info->interp_args);
}
- for (cpp =3D orig_argv; *cpp; ptr++, cpp++) {
+ for (i =3D 0; i < VG_(args_for_client).used; ptr++, i++) {
*ptr =3D (Addr)copy_str(&strtab, *cpp);
}
*ptr++ =3D 0;
@@ -654,7 +650,7 @@
vg_assert((strtab-stringbase) =3D=3D stringsize);
=20
/* We know the initial SP is pointing at argc/argv */
- VG_(client_argc) =3D *(Int*)client_SP;
+ // VG_(client_argc) =3D *(Int*)client_SP;
VG_(client_argv) =3D (Char**)(client_SP + sizeof(HWord));
=20
if (0) VG_(printf)("startup SP =3D %p\n", client_SP);
@@ -748,7 +744,7 @@
return False;
}
=20
-static const char* find_executable(const char* exec)
+static HChar* find_executable ( HChar* exec )
{
vg_assert(NULL !=3D exec);
VG_(strncpy)( executable_name, exec, VKI_PATH_MAX-1 );
@@ -756,7 +752,7 @@
=20
if (VG_(strchr)(executable_name, '/') =3D=3D NULL) {
/* no '/' - we need to search the path */
- char *path =3D VG_(getenv)("PATH");
+ HChar *path =3D VG_(getenv)("PATH");
scan_colsep(path, match_executable);
}
return executable_name;
@@ -802,37 +798,26 @@
/*=3D=3D=3D Loading the client =
=3D=3D=3D*/
/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/
=20
-static void load_client(char* cl_argv[], const char* exec, Int need_help=
,
- /*out*/struct exeinfo* info, /*out*/Addr* client_eip)
+/* Load the client whose name is VG_(argv_the_exename). */
+
+static void load_client ( /*OUT*/struct exeinfo* info,=20
+ /*OUT*/Addr* client_eip)
{
- // If they didn't specify an executable with --exec, and didn't speci=
fy=20
- // --help, then use client argv[0] (searching $PATH if necessary).
- if (NULL =3D=3D exec && !need_help) {
- if (cl_argv[0] =3D=3D NULL ||=20
- ( NULL =3D=3D (exec =3D find_executable(cl_argv[0])) ) )
- {
- missing_prog();
- }
- }
+ HChar* exec;
+ Int ret;
=20
+ vg_assert( VG_(args_the_exename) !=3D NULL);
+ exec =3D find_executable( VG_(args_the_exename) );
+
VG_(memset)(info, 0, sizeof(*info));
info->exe_base =3D VG_(client_base);
info->exe_end =3D VG_(client_end);
- info->argv =3D cl_argv;
=20
- if (need_help) {
- VG_(clexecfd) =3D -1;
- } else {
- Int ret;
- /* HACK: assumes VG_(open) always succeeds */
- VG_(clexecfd) =3D VG_(open)(exec, VKI_O_RDONLY, VKI_S_IRUSR)
- .val;
- ret =3D VG_(do_exec)(exec, info);
- if (ret !=3D 0) {
- VG_(printf)("valgrind: do_exec(%s) failed: %s\n",
- exec, VG_(strerror)(ret));
- VG_(exit)(127);
- }
+ ret =3D VG_(do_exec)(exec, info);
+ if (ret !=3D 0) {
+ VG_(printf)("valgrind: do_exec(%s) failed: %s\n",
+ exec, VG_(strerror)(ret));
+ VG_(exit)(127);
}
=20
/* Copy necessary bits of 'info' that were filled in */
@@ -973,33 +958,36 @@
VG_(exit)(0);
}
=20
-static void pre_process_cmd_line_options
- ( Int* need_help, HChar** tool, HChar** exec )
-{
- UInt i;
=20
- LibVEX_default_VexControl(& VG_(clo_vex_control));
+/* Peer at previously set up VG_(args_for_valgrind) and extract any
+ request for help and also the tool name. */
=20
+static void get_helprequest_and_toolname ( Int* need_help, HChar** tool =
)
+{
+ UInt i;
+ HChar* str;
+
/* parse the options we have (only the options we care about now) */
- for (i =3D 1; i < vg_argc; i++) {
+ for (i =3D 0; i < VG_(args_for_valgrind).used; i++) {
=20
- if (VG_STREQ(vg_argv[i], "--version")) {
+ str =3D VG_(args_for_valgrind).strs[i];
+ vg_assert(str);
+
+ if (VG_STREQ(str, "--version")) {
VG_(printf)("valgrind-" VERSION "\n");
VG_(exit)(0);
=20
- } else if (VG_CLO_STREQ(vg_argv[i], "--help") ||
- VG_CLO_STREQ(vg_argv[i], "-h")) {
+ } else if (VG_CLO_STREQ(str, "--help") ||
+ VG_CLO_STREQ(str, "-h")) {
*need_help =3D 1;
=20
- } else if (VG_CLO_STREQ(vg_argv[i], "--help-debug")) {
+ } else if (VG_CLO_STREQ(str, "--help-debug")) {
*need_help =3D 2;
=20
// The tool has already been determined, but we need to know it he=
re.
- } else if (VG_CLO_STREQN(7, vg_argv[i], "--tool=3D")) {
- *tool =3D &vg_argv[i][7];
+ } else if (VG_CLO_STREQN(7, str, "--tool=3D")) {
+ *tool =3D &str[7];
=20
- } else if (VG_CLO_STREQN(7, vg_argv[i], "--exec=3D")) {
- *exec =3D &vg_argv[i][7];
}
}
}
@@ -1024,10 +1012,10 @@
config_error("Please use absolute paths in "
"./configure --prefix=3D... or --libdir=3D...");
=20
- for (i =3D 1; i < vg_argc; i++) {
+ for (i =3D 0; i < VG_(args_for_valgrind).used; i++) {
=20
- Char* arg =3D vg_argv[i];
- Char* colon =3D arg;
+ HChar* arg =3D VG_(args_for_valgrind).strs[i];
+ HChar* colon =3D arg;
=20
/* Look for a colon in the switch name */
while (*colon && *colon !=3D ':' && *colon !=3D '=3D')
@@ -1224,7 +1212,7 @@
VG_(bad_option)(arg);
}
skip_arg:
- if (arg !=3D vg_argv[i]) {
+ if (arg !=3D VG_(args_for_valgrind).strs[i]) {
VG_(free)(arg);
}
}
@@ -1504,8 +1492,8 @@
VG_(message)(Vg_UserMsg,=20
"My PID =3D %d, parent PID =3D %d. Prog and args are:",
VG_(getpid)(), VG_(getppid)() );
- for (i =3D 0; i < VG_(client_argc); i++)=20
- VG_(message)(Vg_UserMsg, " %s", VG_(client_argv)[i]);
+ for (i =3D 0; i < VG_(args_for_client).used; i++)=20
+ VG_(message)(Vg_UserMsg, " %s", VG_(args_for_client).strs[i])=
;
if (VG_(clo_log_file_qualifier)) {
HChar* val =3D VG_(getenv)(VG_(clo_log_file_qualifier));
VG_(message)(Vg_UserMsg, "");
@@ -1537,17 +1525,18 @@
VG_(message)(Vg_UserMsg, "");
VG_(message)(Vg_UserMsg, "<args>");
VG_(message)(Vg_UserMsg, " <vargv>");
- for (i =3D 0; i < vg_argc; i++) {
+ for (i =3D 0; i < VG_(args_for_valgrind).used; i++) {
HChar* tag =3D i=3D=3D0 ? "exe" : "arg";
- VG_(message)(Vg_UserMsg, " <%s>%t</%s>",=20
- tag, vg_argv[i], tag);
+ VG_(message)(Vg_UserMsg,=20
+ " <%s>%t</%s>",=20
+ tag, VG_(args_for_valgrind).strs[i], tag);
}
VG_(message)(Vg_UserMsg, " </vargv>");
VG_(message)(Vg_UserMsg, " <argv>");
- for (i =3D 0; i < VG_(client_argc); i++) {
+ for (i =3D 0; i < VG_(args_for_client).used; i++) {
HChar* tag =3D i=3D=3D0 ? "exe" : "arg";
VG_(message)(Vg_UserMsg, " <%s>%t</%s>",=20
- tag, VG_(client_argv)[i], tag);
+ tag, VG_(args_for_client).strs[i], tag=
);
}
VG_(message)(Vg_UserMsg, " </argv>");
VG_(message)(Vg_UserMsg, "</args>");
@@ -1559,12 +1548,12 @@
VG_(message)(Vg_DebugMsg, "");
VG_(message)(Vg_DebugMsg, "Valgrind library directory: %s", VG_(li=
bdir));
VG_(message)(Vg_DebugMsg, "Command line");
- for (i =3D 0; i < VG_(client_argc); i++)
- VG_(message)(Vg_DebugMsg, " %s", VG_(client_argv)[i]);
+ for (i =3D 0; i < VG_(args_for_client).used; i++)
+ VG_(message)(Vg_DebugMsg, " %s", VG_(args_for_client).strs[i]=
);
=20
VG_(message)(Vg_DebugMsg, "Startup, with flags:");
- for (i =3D 1; i < vg_argc; i++) {
- VG_(message)(Vg_DebugMsg, " %s", vg_argv[i]);
+ for (i =3D 0; i < VG_(args_for_valgrind).used; i++) {
+ VG_(message)(Vg_DebugMsg, " %s", VG_(args_for_valgrind).strs[=
i]);
}
=20
VG_(message)(Vg_DebugMsg, "Contents of /proc/version:");
@@ -1600,66 +1589,6 @@
}
}
=20
-// Build the string for VALGRINDCLO.
-Char* VG_(build_child_VALGRINDCLO)( Char* exename )
-{
- /* If we're tracing the children, then we need to start it
- with our starter+arguments, which are copied into VALGRINDCLO,
- except the --exec=3D option is changed if present.
- */
- Int i;
- Char *exec;
- Char *cp;
- Char *optvar;
- Int optlen, execlen;
-
- // All these allocated blocks are not free - because we're either
- // going to exec, or panic when we fail.
-
- // Create --exec=3D option: "--exec=3D<exename>"
- exec =3D VG_(arena_malloc)(VG_AR_CORE,=20
- VG_(strlen)( exename ) + 7/*--exec=3D*/ + 1/=
*\0*/);
- vg_assert(NULL !=3D exec);
- VG_(sprintf)(exec, "--exec=3D%s", exename);
-
- // Allocate space for optvar (may overestimate by counting --exec twi=
ce,
- // no matter)
- optlen =3D 1;
- for (i =3D 0; i < vg_argc; i++)
- optlen +=3D VG_(strlen)(vg_argv[i]) + 1;
- optlen +=3D VG_(strlen)(exec)+1;
- optvar =3D VG_(arena_malloc)(VG_AR_CORE, optlen);
-
- // Copy all valgrind args except the old --exec (if present)
- // VG_CLO_SEP is the separator.
- cp =3D optvar;
- for (i =3D 1; i < vg_argc; i++) {
- Char *arg =3D vg_argv[i];
- =20
- if (VG_CLO_STREQN(7, arg, "--exec=3D")) {
- // don't copy existing --exec=3D arg
- } else if (VG_CLO_STREQ(arg, "--")) {
- // stop at "--"
- break;
- } else {
- // copy non "--exec" arg
- Int len =3D VG_(strlen)(arg);
- VG_(memcpy)(cp, arg, len);
- cp +=3D len;
- *cp++ =3D VG_CLO_SEP;
- }
- }
- // Add the new --exec=3D option
- execlen =3D VG_(strlen)(exec);
- VG_(memcpy)(cp, exec, execlen);
- cp +=3D execlen;
- *cp++ =3D VG_CLO_SEP;
-
- *cp =3D '\0';
-
- return optvar;
-}
-
// Build "/proc/self/fd/<execfd>".
Char* VG_(build_child_exename)( void )
{
@@ -1894,19 +1823,17 @@
=20
Int main(Int argc, HChar **argv, HChar **envp)
{
- HChar** cl_argv;
- HChar* tool =3D "memcheck"; // default to Memcheck
- HChar* exec =3D NULL;
- HChar** env;
- Int need_help =3D 0; // 0 =3D no, 1 =3D --help, 2 =3D --help=
-debug
- struct exeinfo info;
- Addr initial_client_IP;
- Addr initial_client_SP;
- Addr clstack_top;
- SizeT clstack_max_size;
- UInt* client_auxv;
- Int loglevel, i;
+ HChar* tool =3D "memcheck"; // default to Memcheck
+ HChar** env =3D NULL;
+ Int need_help =3D 0; // 0 =3D no, 1 =3D --help, 2 =3D --h=
elp-debug
+ Addr initial_client_IP =3D 0;
+ Addr initial_client_SP =3D 0;
+ Addr clstack_top =3D 0;
+ SizeT clstack_max_size =3D 0;
+ UInt* client_auxv;
+ Int loglevel, i;
struct vki_rlimit zero =3D { 0, 0 };
+ struct exeinfo info;
=20
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
//
@@ -2005,10 +1932,17 @@
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
//--------------------------------------------------------------
- // Extract the stage1 name from the environment.
+ // Look for alternative libdir =20
+ { HChar *cp =3D VG_(getenv)(VALGRIND_LIB);
+ if (cp !=3D NULL)
+ VG_(libdir) =3D cp;
+ }
+
+ //--------------------------------------------------------------
+ // Extract the launcher name from the environment.
VG_(debugLog)(1, "main", "Getting stage1's name\n");
- name_of_stage1 =3D VG_(getenv)(VALGRINDSTAGE1);
- if (name_of_stage1 =3D=3D NULL) {
+ VG_(name_of_launcher) =3D VG_(getenv)(VALGRIND_LAUNCHER);
+ if (VG_(name_of_launcher) =3D=3D NULL) {
VG_(printf)("valgrind: You cannot run '%s' directly.\n", argv[0]);
VG_(printf)("valgrind: You should use $prefix/bin/valgrind.\n");
VG_(exit)(1);
@@ -2039,15 +1973,6 @@
scan_auxv(init_sp);
}
=20
- //--------------------------------------------------------------
- // Look for alternative libdir =20
- // p: none
- //--------------------------------------------------------------
- { HChar *cp =3D VG_(getenv)(VALGRINDLIB);
- if (cp !=3D NULL)
- VG_(libdir) =3D cp;
- }
-
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
// Command line argument handling order:
// * If --help/--help-debug are present, show usage message=20
@@ -2058,86 +1983,95 @@
//=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=20
//--------------------------------------------------------------
- // Get valgrind args + client args (inc. from VALGRIND_OPTS/.valgrind=
rc).
- // Pre-process the command line.
- // p: none
+ // Split up argv into: C args, V args, V extra args, and exename.
+ // p: dynamic memory allocation
//--------------------------------------------------------------
+ VG_(debugLog)(1, "main", "Split up command line");
+ VG_(split_up_argv)( argc, argv );
+ if (0) {
+ for (i =3D 0; i < VG_(args_for_valgrind).used; i++)
+ VG_(printf)("varg %s\n", VG_(args_for_valgrind).strs[i]);
+ VG_(printf)(" exe %s\n", VG_(args_the_exename));
+ for (i =3D 0; i < VG_(args_for_client).used; i++)
+ VG_(printf)("carg %s\n", VG_(args_for_client).strs[i]);
+ }
+
+ //--------------------------------------------------------------
+ // Extract tool name and whether help has been requested.
+ // Note we can't print the help message yet, even if requested,
+ // because the tool has not been initialised.
+ // p: split_up_argv [for VG_(args_for_valgrind)]
+ //--------------------------------------------------------------
VG_(debugLog)(1, "main", "Preprocess command line opts\n");
- VG_(get_command_line)(argc, argv, &vg_argc, &vg_argv, &cl_argv);
- pre_process_cmd_line_options(&need_help, &tool, &exec);
+ get_helprequest_and_toolname(&need_help, &tool);
=20
- // TODO: this should be done in pre_process_cmd_line_options().
- /* If this process was created by exec done by another Valgrind
- process, the arguments will only show up at this point. Hence
- we need to also snoop around in vg_argv to see if anyone is
- asking for debug logging. */
- if (loglevel =3D=3D 0) {
- for (i =3D 1; i < vg_argc; i++) {
- if (vg_argv[i][0] !=3D '-')
- break;
- if (VG_STREQ(vg_argv[i], "--"))=20
- break;
- if (VG_STREQ(vg_argv[i], "-d"))=20
- loglevel++;
- }
- VG_(debugLog_startup)(loglevel, "Stage 2 (second go)");
- }
+ // Set default vex control params
+ LibVEX_default_VexControl(& VG_(clo_vex_control));
=20
//--------------------------------------------------------------
// Load client executable, finding in $PATH if necessary
// p: pre_process_cmd_line_options() [for 'exec', 'need_help']
// p: layout_remaining_space [so there's space]
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Loading client\n");
- load_client(cl_argv, exec, need_help, &info, &initial_client_IP);
+ if (!need_help) {
+ VG_(debugLog)(1, "main", "Loading client\n");
=20
+ if (VG_(args_the_exename) =3D=3D NULL)
+ missing_prog();
+
+ load_client(&info, &initial_client_IP);
+ }
+
//--------------------------------------------------------------
// Set up client's environment
// p: set-libdir [for VG_(libdir)]
// p: pre_process_cmd_line_options [for tool]
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Setup client env\n");
- env =3D fix_environment(envp, tool);
+ if (!need_help) {
+ VG_(debugLog)(1, "main", "Setup client env\n");
+ env =3D setup_client_env(envp, tool);
+ }
=20
//--------------------------------------------------------------
// Setup client stack, eip, and VG_(client_arg[cv])
// p: load_client() [for 'info']
// p: fix_environment() [for 'env']
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Setup client stack\n");
- {=20
- void* init_sp =3D argv - 1;
- SizeT m1 =3D 1024 * 1024;
- SizeT m8 =3D 8 * m1;
- clstack_max_size =3D (SizeT)VG_(client_rlimit_stack).rlim_cur;
- if (clstack_max_size < m1) clstack_max_size =3D m1;
- if (clstack_max_size > m8) clstack_max_size =3D m8;
- clstack_max_size =3D VG_PGROUNDUP(clstack_max_size);
+ if (!need_help) {
+ void* init_sp =3D argv - 1;
+ SizeT m1 =3D 1024 * 1024;
+ SizeT m8 =3D 8 * m1;
+ VG_(debugLog)(1, "main", "Setup client stack\n");
+ clstack_max_size =3D (SizeT)VG_(client_rlimit_stack).rlim_cur;
+ if (clstack_max_size < m1) clstack_max_size =3D m1;
+ if (clstack_max_size > m8) clstack_max_size =3D m8;
+ clstack_max_size =3D VG_PGROUNDUP(clstack_max_size);
=20
- initial_client_SP
- =3D setup_client_stack( init_sp, cl_argv, env, &info,
- &client_auxv, clstack_top, clstack_max_si=
ze);
+ initial_client_SP
+ =3D setup_client_stack( init_sp, env,=20
+ &info, &client_auxv,=20
+ clstack_top, clstack_max_size );
=20
- VG_(free)(env);
+ VG_(free)(env);
+
+ VG_(debugLog)(2, "main",
+ "Client info: "
+ "entry=3D%p client_SP=3D%p brkbase=3D%p\n",
+ (void*)initial_client_IP,=20
+ (void*)initial_client_SP,
+ (void*)VG_(brk_base) );
}
=20
- VG_(debugLog)(2, "main",
- "Client info: "
- "entry=3D%p client_SP=3D%p vg_argc=3D%d brkbase=3D%p=
\n",
- (void*)initial_client_IP,=20
- (void*)initial_client_SP, vg_argc,=20
- (void*)VG_(brk_base) );
-
//--------------------------------------------------------------
// Setup client data (brk) segment. Initially a 1-page segment
// which abuts a shrinkable reservation.=20
// p: load_client() [for 'info' and hence VG_(brk_base)]
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Setup client data (brk) segment\n");
- {=20
+ if (!need_help) {=20
SizeT m1 =3D 1024 * 1024;
SizeT m8 =3D 8 * m1;
SizeT dseg_max_size =3D (SizeT)VG_(client_rlimit_data).rlim_cur;
+ VG_(debugLog)(1, "main", "Setup client data (brk) segment\n");
if (dseg_max_size < m1) dseg_max_size =3D m1;
if (dseg_max_size > m8) dseg_max_size =3D m8;
dseg_max_size =3D VG_PGROUNDUP(dseg_max_size);
@@ -2175,25 +2109,31 @@
// p: aspacem [??]
// p: pre_clo_init [for 'VG_(details).avg_translation_sizeB']
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Initialise TT/TC\n");
- VG_(init_tt_tc)();
+ if (!need_help) {
+ VG_(debugLog)(1, "main", "Initialise TT/TC\n");
+ VG_(init_tt_tc)();
+ }
=20
//--------------------------------------------------------------
// Initialise the redirect table.
// p: init_tt_tc [so it can call VG_(search_transtab) safely]
// p: aspacem [so can change ownership of sysinfo pages]
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Initialise redirects\n");
- { Bool setup_redirects_succeeded =3D VG_(setup_code_redirect_table)()=
;
- vg_assert(setup_redirects_succeeded);
+ if (!need_help) {=20
+ Bool setup_redirects_succeeded;
+ VG_(debugLog)(1, "main", "Initialise redirects\n");
+ setup_redirects_succeeded =3D VG_(setup_code_redirect_table)();
+ vg_assert(setup_redirects_succeeded);
}
=20
//--------------------------------------------------------------
// setup file descriptors
// p: n/a
//--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Setup file descriptors\n");
- setup_file_descriptors();
+ if (!need_help) {
+ VG_(debugLog)(1, "main", "Setup file descriptors\n");
+ setup_file_descriptors();
+ }
=20
//--------------------------------------------------------------
// Init tool part 2: pre_clo_init
@@ -2292,9 +2232,16 @@
for (i =3D 0; i < n_seg_starts; i++) {
seg =3D VG_(am_find_nsegment)( seg_starts[i] );
vg_assert(seg);
- if (seg->kind =3D=3D SkFileC || seg->kind =3D=3D SkAnonC)
+ if (seg->kind =3D=3D SkFileC || seg->kind =3D=3D SkAnonC) {
+ VG_(debugLog)(2, "main",=20
+ "tell tool about %010lx-%010lx %c%c%c\n",
+ seg->start, seg->end,
+ seg->hasR ? 'r' : '-',
+ seg->hasW ? 'w' : '-',
+ seg->hasX ? 'x' : '-' );
VG_TRACK( new_mem_startup, seg->start, seg->end+1-seg->start,=
=20
seg->hasR, seg->hasW, seg->hasX );
+ }
}
=20
VG_(free)( seg_starts );
@@ -2307,6 +2254,16 @@
vg_assert(initial_client_SP <=3D seg->end);
/* Stuff below the initial SP is unaddressable. */
VG_TRACK( die_mem_stack, seg->start, initial_client_SP - seg->start=
);
+ VG_(debugLog)(2, "main", "mark stack inaccessible %010lx-%010lx\n",
+ seg->start, initial_client_SP-1 );
+
+ /* Also the assembly helpers. */
+ VG_TRACK( new_mem_startup,
+ (Addr)&VG_(trampoline_stuff_start),
+ &VG_(trampoline_stuff_end) - &VG_(trampoline_stuff_start)=
,
+ False, /* readable? */
+ False, /* writable? */
+ True /* executable? */ );
}
=20
//--------------------------------------------------------------
@@ -2376,19 +2333,6 @@
}
=20
//--------------------------------------------------------------
- // Tell the tool about permissions in our handwritten assembly
- // helpers.
- // p: init tool [for 'new_mem_startup']
- //--------------------------------------------------------------
- VG_(debugLog)(1, "main", "Tell tool about permissions for asm helpers=
\n");
- VG_TRACK( new_mem_startup,
- (Addr)&VG_(trampoline_stuff_start),
- &VG_(trampoline_stuff_end) - &VG_(trampoline_stuff_start),
- False, /* readable? */
- False, /* writable? */
- True /* executable? */ );
-
- //--------------------------------------------------------------
// Verbosity message
// p: end_rdtsc_calibration [so startup message is printed first]
//--------------------------------------------------------------
Modified: branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-21 12:=
01:37 UTC (rev 4719)
+++ branches/ASPACEM/coregrind/m_syswrap/syswrap-generic.c 2005-09-22 11:=
34:48 UTC (rev 4720)
@@ -2444,12 +2444,9 @@
}
=20
if (VG_(clo_trace_children)) {
- Char* optvar =3D VG_(build_child_VALGRINDCLO)( (Char*)ARG1 );
+ // Set VALGRIND_LIB in ARG3 (the environment)
+ VG_(env_setenv)( (Char***)&ARG3, VALGRIND_LIB, VG_(libdir));
=20
- // Set VALGRINDCLO and VALGRINDLIB in ARG3 (the environment)
- VG_(env_setenv)( (Char***)&ARG3, VALGRINDCLO, optvar);
- VG_(env_setenv)( (Char***)&ARG3, VALGRINDLIB, VG_(libdir));
-
// Create executable name: "/proc/self/fd/<vgexecfd>", update ARG1
path =3D VG_(build_child_exename)();
}
Modified: branches/ASPACEM/coregrind/pub_core_clientstate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-21 12:01:37=
UTC (rev 4719)
+++ branches/ASPACEM/coregrind/pub_core_clientstate.h 2005-09-22 11:34:48=
UTC (rev 4720)
@@ -37,7 +37,10 @@
// client don't live here; they instead live in m_threadstate.h.
//--------------------------------------------------------------------
=20
+#include "pub_tool_clientstate.h"
+
// Address space globals
+
extern Addr VG_(client_base); // client address space limits
extern Addr VG_(client_end);
=20
@@ -48,7 +51,18 @@
extern Addr VG_(brk_base); // start of brk
extern Addr VG_(brk_limit); // current brk
=20
+// Client's executable file descriptor.
+extern Int VG_(clexecfd);
=20
+// Client's original rlimit data and rlimit stack
+extern struct vki_rlimit VG_(client_rlimit_data);
+extern struct vki_rlimit VG_(client_rlimit_stack);
+
+// Name of the launcher, as extracted from VALGRIND_LAUNCHER at
+// startup.
+extern HChar* VG_(name_of_launcher);
+
+
#endif // __PUB_CORE_CLIENTSTATE_H
=20
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/pub_core_commandline.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_commandline.h 2005-09-21 12:01:37=
UTC (rev 4719)
+++ branches/ASPACEM/coregrind/pub_core_commandline.h 2005-09-22 11:34:48=
UTC (rev 4720)
@@ -31,12 +31,15 @@
#ifndef __PUB_CORE_COMMANDLINE_H
#define __PUB_CORE_COMMANDLINE_H
=20
-#define VG_CLO_SEP '\01'
=20
-extern void VG_(get_command_line)( int argc, char** argv,
- Int* vg_argc_out, Char*** vg_argv_out=
,=20
- char*** cl_argv_out=
);
+/* Split up the args presented by the launcher to m_main.main(), and
+ park them in VG_(args_for_client), VG_(args_for_valgrind) and
+ VG_(args_for_valgrind_extras). The latter are acquired from
+ $VALGRIND_OPTS, ./.valgrindrc and ~/.valgrindrc. */
=20
+extern void VG_(split_up_argv)( Int argc, HChar** argv );
+
+
#endif // __PUB_CORE_COMMANDLINE_H
=20
/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/coregrind/pub_core_libcproc.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_libcproc.h 2005-09-21 12:01:37 UT=
C (rev 4719)
+++ branches/ASPACEM/coregrind/pub_core_libcproc.h 2005-09-22 11:34:48 UT=
C (rev 4720)
@@ -41,37 +41,19 @@
/* The directory we look for all our auxillary files in. Useful for
running Valgrind out of a build tree without having to do "make
install". */
-#define VALGRINDLIB "VALGRINDLIB"
+#define VALGRIND_LIB "VALGRIND_LIB"
=20
/* Additional command-line arguments; they are overridden by actual
command-line option. Each argument is separated by spaces. There
is no quoting mechanism. */
-#define VALGRINDOPTS "VALGRIND_OPTS"
+#define VALGRIND_OPTS "VALGRIND_OPTS"
=20
/* The full name of Valgrind's stage1 (launcher) executable. This is
set by stage1 and read by stage2, and is used for recursive
invokations of Valgrind on child processes. */
-#define VALGRINDSTAGE1 "VALGRIND_STAGE1"
+#define VALGRIND_LAUNCHER "VALGRIND_LAUNCHER"
=20
=20
-/* If this variable is present in the environment, then valgrind will
- not parse the command line for options at all; all options come
- from this variable. Arguments are terminated by ^A (\001). There
- is no quoting mechanism.
-
- This variable is not expected to be set by anything other than
- Valgrind itself, as part of its handling of execve with
- --trace-children=3Dyes. This variable should not be present in the
- client environment. */
-#define VALGRINDCLO "_VALGRIND_CLO"
-
-// Client's executable file descriptor.
-extern Int VG_(clexecfd);
-
-// Client's original rlimit data and rlimit stack
-extern struct vki_rlimit VG_(client_rlimit_data);
-extern struct vki_rlimit VG_(client_rlimit_stack);
-
// Environment manipulations
extern Char **VG_(env_setenv) ( Char ***envp, const Char* varname,
const Char *val );
Modified: branches/ASPACEM/coregrind/pub_core_main.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/coregrind/pub_core_main.h 2005-09-21 12:01:37 UTC (r=
ev 4719)
+++ branches/ASPACEM/coregrind/pub_core_main.h 2005-09-22 11:34:48 UTC (r=
ev 4720)
@@ -39,8 +39,7 @@
//--------------------------------------------------------------------
=20
// Help set up the child used when doing execve() with --trace-children=3D=
yes
-Char* VG_(build_child_VALGRINDCLO) ( Char* exename );
-Char* VG_(build_child_exename) ( void );
+Char* VG_(build_child_exename) ( void );
=20
// Do everything which needs doing before the process finally ends,
// like printing reports, etc
Modified: branches/ASPACEM/include/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/Makefile.am 2005-09-21 12:01:37 UTC (rev 471=
9)
+++ branches/ASPACEM/include/Makefile.am 2005-09-22 11:34:48 UTC (rev 472=
0)
@@ -5,6 +5,7 @@
pub_tool_basics.h \
pub_tool_basics_asm.h \
pub_tool_aspacemgr.h \
+ pub_tool_clientstate.h \
pub_tool_cpuid.h \
pub_tool_debuginfo.h \
pub_tool_errormgr.h \
Added: branches/ASPACEM/include/pub_tool_clientstate.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/pub_tool_clientstate.h 2005-09-21 12:01:37 U=
TC (rev 4719)
+++ branches/ASPACEM/include/pub_tool_clientstate.h 2005-09-22 11:34:48 U=
TC (rev 4720)
@@ -0,0 +1,74 @@
+
+/*--------------------------------------------------------------------*/
+/*--- Misc client state info pub_tool_clientstate.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_TOOL_CLIENTSTATE_H
+#define __PUB_TOOL_CLIENTSTATE_H
+
+
+// Command line pieces, after they have been extracted from argv in
+// m_main.main(). These are all NULL-terminated vectors.
+
+/* Expandable arrays of strings. */
+typedef
+ struct {
+ Int size;
+ Int used;
+ HChar** strs;
+ }
+ XArrayStrings;
+
+/* Args for the client. */
+extern XArrayStrings VG_(args_for_client);
+
+/* Args for V. This is the concatenation of the following:
+ - contents of ~/.valgrindrc
+ - contents of $VALGRIND_OPTS
+ - contents of ./.valgrindrc
+ - args from the command line
+ Only the last of these is passed onwards to child Valgrinds at
+ client sys_execve, since the children will re-acquire the first=20
+ 3 categories for themselves. Therefore we also record the=20
+ number of these no-pass-at-execve arguments. */
+extern XArrayStrings VG_(args_for_valgrind);
+
+/* Number of leading args in VG_(args_for_valgrind) not to pass on at
+ exec time. */
+extern Int VG_(args_for_valgrind_noexecpass);
+
+/* The name of the client executable, as specified on the command
+ line. */
+extern HChar* VG_(args_the_exename);
+
+
+#endif // __PUB_TOOL_CLIENTSTATE_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Modified: branches/ASPACEM/include/pub_tool_libcproc.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/include/pub_tool_libcproc.h 2005-09-21 12:01:37 UTC =
(rev 4719)
+++ branches/ASPACEM/include/pub_tool_libcproc.h 2005-09-22 11:34:48 UTC =
(rev 4720)
@@ -36,7 +36,6 @@
------------------------------------------------------------------ */
=20
/* Client args and environment (which can be inspected with VG_(getenv)(=
). */
-extern Int VG_(client_argc);
extern Char** VG_(client_argv);
extern Char** VG_(client_envp);
=20
Modified: branches/ASPACEM/massif/ms_main.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- branches/ASPACEM/massif/ms_main.c 2005-09-21 12:01:37 UTC (rev 4719)
+++ branches/ASPACEM/massif/ms_main.c 2005-09-22 11:34:48 UTC (rev 4720)
@@ -50,6 +50,7 @@
#include "pub_tool_replacemalloc.h"
#include "pub_tool_stacktrace.h"
#include "pub_tool_tooliface.h"
+#include "pub_tool_clientstate.h"
=20
#include "valgrind.h" // For {MALLOC,FREE}LIKE_BLOCK
=20
@@ -1374,8 +1375,8 @@
=20
// File header, including command line
SPRINTF(buf, "JOB \"");
- for (i =3D 0; i < VG_(client_argc); i++)
- SPRINTF(buf, "%s ", VG_(client_argv)[i]);
+ for (i =3D 0; i < VG_(args_for_client).used; i++)
+ SPRINTF(buf, "%s ", VG_(args_for_client).strs[i]);
SPRINTF(buf, /*" (%d ms/s...
[truncated message content] |