Scottie T
Scottie T

Reputation: 12175

How do I debug while running my program in Valgrind?

I was finishing up a code mod and wanted to run my program through Valgrind to make sure I've got all memory accounted for, but my program failed an assertion that doesn't fail when running on its own. Is it possible to stop in the debugger while running from Valgrind? I'm currently wading through the manual, but figured I could get my answer faster from you all.

Upvotes: 1

Views: 459

Answers (1)

Scottie T
Scottie T

Reputation: 12175

I discovered the --db-attach=yes argument. This will stop every time an error is detected and ask if you want to enter the debugger at this point.

For my program, this is proving to be difficult to use, however. I read a file from standard input for initialization, and I think Valgrind is interpreting EOLs as responding to its prompts.

Upvotes: 3

Related Questions