Hi, My codeblocks has been installed in lubuntu 16.04, so there is a "Valgrind" menu in the toolbar, as picture 1 illustrated.
When my code has not contains the user input, namely, no scanf() function, the "Valgrind/Run MemCheck" works very well.
But if the code contains the user input (i.e., scanf), when clicking "Valgrind/Run MemCheck", it makes codeblocks running forever, nothing to give back and not stop, and it seems that the valgrind waits for the user input, but I can't find the way to enter user input for valgrind in codeblocks.
Is there any way to fix this problem?
Not sure. Probably the valgrind plugin should be modified to do something similar to the debugger plugin, but I'm not even sure that valgrind supports redirecting stdin/out to something else then the current console.
Quote from: oBFusCATed on March 15, 2019, 02:40:03 PM
Not sure. Probably the valgrind plugin should be modified to do something similar to the debugger plugin, but I'm not even sure that valgrind supports redirecting stdin/out to something else then the current console.
Hi, oBFusCATed, thanks for replying.
Finally, after search many webs, I find that there is a way to use valgrind in the terminal:
1. gcc -g test.c
2. valgrind --tool=memcheck --leak-check=yes --show-reachable=yes ./a.out
Then the code (test.c) runs, so I can enter the user input. After completes the user input, then valgrind feedback the result in the comsole.