I'm trying to run an application using valgrind tool. But the application needs the parent process id which invoke the application as an argument.
valgrind --leak-check=no --error-limit=no MyApplication {Parent_Process_ID}
But since valgrind process is still starting, i cannot get the pid from bash. I tried the following way as taking the previous process pid.
valgrind --leak-check=no --error-limit=no MyApplication $!
But it gives the process id of process ran before valgrind.
Can someone help me get the pid of valgrind here?