|
From: Nathan R. <na...@cs...> - 2010-01-13 04:52:24
|
Hello everyone,
Thanks for this well written framework. It has proved to be very useful to me.
Currently, I'm running the Catchconv Valgrind extension against an
application to generate a path constraint. The application in question
clones() several times and even has a clone() from inside of a
clone()'d thread/process.
I added some debug message printing into Catchconv's main callback
function, ca_instrument(), using VG_(printf) and VG_(message). In the
case where there is only one clone(), the proper messages made it to
stderr/stdout. However, in the case where there are multiple clones
and chains of clones, only one of those process' messages ever made it
to stderr/stdout.
The tool behaved as expected and the relevant messages were printed.
This was not the case for the doubly-clone()'d process.
If anyone could give me some pointers on how to debug this problem so
I may get output for Catchconv's interaction with the clones, I would
be very appreciative.
Thanks again,
Nathan Rittenhouse
PS: here is the code for the sanity check case that worked
successfully with Catchconv:
#include <malloc.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <sched.h>
#include <stdio.h>
int theClone(char * fileName){
char blah = 0;
FILE * inputFile = NULL;
printf("fileName: %s\n", fileName);
inputFile = fopen(fileName, "r");
fread(&blah, 1, 1, inputFile);
if(blah == 3)
printf(">> hit case where blah = 3! <<\n");
fclose(inputFile);
return 0;
}
int main(int argc, char **argv){
pid_t childPid = 0;
void * stack = NULL;
if(argc < 2){
printf(">> Usage: %s <filename> <<\n", argv[0]);
return -1;
}
if(!(stack = malloc((1024*4)))){
perror("malloc: could not allocate stack");
return -1;
}
if((childPid = clone(&theClone, (char*)stack + (1024*4),
SIGCHLD|CLONE_FS|CLONE_FILES|CLONE_VM,argv[1])) == -1){
perror("clone");
return -1;
}
if((childPid = waitpid(childPid, 0, 0)) == -1){
perror("waitpid");
return -1;
}
return 0;
}
|
|
From: tom f. <tf...@al...> - 2010-01-13 05:19:10
|
Nathan Rittenhouse <na...@cs...> writes: > Currently, I'm running the Catchconv Valgrind extension against > an application to generate a path constraint. The application in > question clones() several times and even has a clone() from inside of > a clone()'d thread/process. > > I added some debug message printing into Catchconv's main callback > function, ca_instrument(), using VG_(printf) and VG_(message). In the > case where there is only one clone(), the proper messages made it to > stderr/stdout. However, in the case where there are multiple clones > and chains of clones, only one of those process' messages ever made > it to stderr/stdout. Valgrind has a couple options dealing with fork and exec: --trace-children=no|yes Valgrind-ise child processes (follow execve)? [no] --child-silent-after-fork=no|yes omit child output between fork & exec? [no] note that the defaults for both of them are "no". Have you tried running with these explicitly enabled? Cheers, -tom |
|
From: Nathan R. <na...@cs...> - 2010-01-13 05:25:32
|
Hello Tom, Yes, I have tried --trace-children=yes. This had no effect. The other option appears to not be supported in Catchconv's Valgrind, however, from my understanding, it should not have an effect on Catchconv's ability to output to stdout. Thanks again, Nathan On Wed, Jan 13, 2010 at 12:20 AM, tom fogal <tf...@al...> wrote: > Nathan Rittenhouse <na...@cs...> writes: >> Currently, I'm running the Catchconv Valgrind extension against >> an application to generate a path constraint. The application in >> question clones() several times and even has a clone() from inside of >> a clone()'d thread/process. >> >> I added some debug message printing into Catchconv's main callback >> function, ca_instrument(), using VG_(printf) and VG_(message). In the >> case where there is only one clone(), the proper messages made it to >> stderr/stdout. However, in the case where there are multiple clones >> and chains of clones, only one of those process' messages ever made >> it to stderr/stdout. > > Valgrind has a couple options dealing with fork and exec: > > --trace-children=no|yes Valgrind-ise child processes (follow execve)? [no] > --child-silent-after-fork=no|yes omit child output between fork & exec? [no] > > note that the defaults for both of them are "no". Have you tried > running with these explicitly enabled? > > Cheers, > > -tom > |