Reputation: 5430
I've modified the small part of a simulator but I've faced to strange segmentation fault. GDB shows the error is appear from a class where I've not modified. I guess my code has memory access violation upon accessing its own array which accordingly destroys the content of other array (allocated in the program memory space). Is there any debugging tool to detect out-of-array-bound but inside-the-program-space accesses?
Upvotes: 3
Views: 669
Reputation: 1708
You are looking for valgrind.
It is available as a package on at least most linux distributions, and will detect memory access.
Just start the program with valgrind:
valgrind ./program
Upvotes: 1
Reputation: 9642
In short, Valgrind will do this. Just run it as valgrind /path/to/executable
Upvotes: 13