Because it uses the VM hardware for detection, Electric Fence stops your program on the first instruction that causes a bounds violation. It's then trivial to use a debugger to display the offending statement.
Earlier kernels have problems with the memory protection implementation.
On some of these platforms, you'll have to uncomment lines in the Makefile that apply to your particular system. If you test Electric Fence on a platform not mentioned here, please send me a report. Complete information on the use of Electric Fence is in the manual page libefence.3 .