Reputation: 172
I'm just starting with C programming (following along with 'C The Hard Way') - anytime I try to run valgrind I'm getting Segmentation fault in terminal right off the bat.
I've installed and reinstalled valgrind
Any suggestions here?
Upvotes: 1
Views: 2024
Reputation: 1
Which program is SEGV faulting, valgrind
itself or your own program?
If it is your program, you could just compile it with debugging enabled (that is using gcc -g
on Linux) and then run it in the debugger (gdb
on Linux).
If it is valgrind
itself, since you are a newbie, you are unlucky, but you still can debug your program the traditional way (with gdb
). Using gdb
is documented here
Upvotes: 1
Reputation: 47762
Valgrind should never segfault - every (even buggy) program should be run and problems intercepted.
If you get segfaults even for innocuous commands like valgrind true
, I suggest you to download precompiled valgrind binaries for your OS, presumably with its package manager. Similar problems with compilation sometimes happen (could be bugs in the compiler, incompatibilities between the sources and the compiler, bad libraries...). You probably don't want to dig into this if you're still learning.
If valgrind merely reports a segfault in your program, post its messages. It means you have a bug in your program.
Upvotes: 2