lashgar
lashgar

Reputation: 5430

Detecting out of array access violation

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

Answers (2)

perh
perh

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

slugonamission
slugonamission

Reputation: 9642

In short, Valgrind will do this. Just run it as valgrind /path/to/executable

Upvotes: 13

Related Questions