From: Paul H. <pa...@ha...> - 2003-05-27 21:22:02
|
On Tue, 27 May 2003, Alex Ivershen wrote: > Hi all, > I have an application that spawns quite a few children processes. These > children cannot be run standalone, they have to spawned by that master > process.=A0 What I would like to do is to spawn just one of the children > with Valgrind. I can tell the master application which child to spawn > with Valgrind via a command-line switch, but the actual spawning is where > I am at a loss.=A0 The master app is doing an execl() call,=A0 so I would > need to explicitly list all Valgrind options in that call and then the > application name. This is not very useful since I won't be able to change > skins and options on the fly. > > One way I could do it is tweak Valgrind code to read options from an > environment variable, say VALGRIND_OPTS=3D"-v --logfile=3D/tmp/VLOG" > --leak-check=3Dyes" and then in execl() call do something like: Write a 2 line script ValgrindWithOptions, which does: #!/bin/sh exec valgrind $VALGRIND_OPTS $* You can replace the 2 line script with a program in your language of choice, assuming your language of choice supports some form of exec() and won't trample any state information (like file descriptors) that the parent process sends to the child. > if ( valgrind switch is set ) > =A0=A0=A0 execl ( ... , "valgrind", "Application", .... ) =A0=A0=A0 execl ( ... , "ValgrindWithOptions", "Application", .... ) Or if there is enough information, you could rename "Application" and call your script Application. Then your script gets more complicated, because it would have to figure out which child process should be valgrind'ed. > else > =A0=A0=A0 execl ( ... , "Application", ... ) > I would rather not modify Valgrind source, since I would have to carry > over changes between Valgrind versions. Is there any easier=A0 way to do > what I am trying to accomplish?=A0 Any help would be greatly appreciated! > Thanks! > Alex Ivershen > > --=A0 > Alex G. Ivershen=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0 Inet Technologies, Inc. > Network Products Dept.=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 1500 N. Greenville Ave. > Inet Technologies Inc.=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 Richardson, TX 75081 > Phone: +1-469-330-4295=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0 USA > > "Black Holes are where God divided by zero" > =A0 ------------------------------------------------------- This SF.net > email is sponsored by: ObjectStore. If flattening out C++ or Java code to > make your application fit in a relational database is painful, don't do > it! Check out ObjectStore. Now part of Progress Software. > http://www.objectstore.net/sourceforge > _______________________________________________ Valgrind-users mailing > list Val...@li... > https://lists.sourceforge.net/lists/listinfo/valgrind-users > |