kaspersky
kaspersky

Reputation: 4097

How to make valgrind to exactly reproduce bug?

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

Answers (1)

ks1322
ks1322

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

Related Questions