Reputation: 4097
I created a c program which crashes (segmentation fault). I want to find the error using valgrind, but when I run it:
valgrind -v ./executable
the program don't crash. It still crashes when I run it using gdb.
How can I set up valgrind to reproduce the bug, like gdb?
Upvotes: 1
Views: 223
Reputation: 35698
How can I set up valgrind to reproduce the bug, like gdb?
You should not and in fact you can't.
This is because program runs under Valgrind in environment slightly different from when it runs natively. This is how Valgrind works, see Valgrind FAQ.
What you really need is to fix all Valgrind errors, especially invalid reads.
Upvotes: 2