Here is a Linux example where cgi (./myexe) reads from stdin. We put the input in the mystdin file. Thus, valgrind can read input from the terminal, we do -input-fd = 3 and tell the shell to redirect / dev / tty to file descriptor 3. So that we can control gdb, we add the stdin redirection from / dev / tty in the -db parameter -paramater for valgrind. This is probably the worst example. Hope this helps.
valgrind --input-fd=3 --db-command='gdb -nw %f %p < /dev/tty' --db-attach=yes ./myexe < mystdin 3</dev/tty
source share