1

I have process A wich forks process B. A and B - are different application. Both compiled with -g flag.

to run it with callgrind I use command: valgrind --tool=callgrind --trace-children=yes ./A [params]

callgrind.out.xxx for parent process (A) contains function names. for child process(B) - it doesn't contains. What could be wrong here?

Thanks

user331241
  • 31
  • 4

1 Answers1

0

Have you tried with latest version of valgrind ?

The only current problem which seems obvious to me is:

...you will have to make sure that the output file format string (controlled by --callgrind-out-file) does contain %p (which is true by default). Otherwise, the outputs from the parent and child will overwrite each other or will be intermingled, which almost certainly is not what you want.

extracted from callgrind documentation.

Doomsday
  • 2,650
  • 25
  • 33
  • This documentation also says that special call is needed in child "*If your program forks, the child will inherit all the profiling data that has been gathered for the parent. To start with empty profile counter values in the child, the client request CALLGRIND_ZERO_STATS; can be inserted into code to be executed by the child, directly after fork.*". Also, the B process is different application, started by `fork` + `exec`, and there is no documentation about `exec` – osgx Feb 18 '15 at 17:40
  • 1
    It's worth noting that if you want valgrind to trace child processes launched with ```fork + exec```, you also need the ```--trace-children=yes``` flag. See the valgrind ```man``` page for documentation about ```exec```. – SullX May 17 '16 at 15:28