Electric Fence内存使用调试
时间:2007-06-28 来源:linuxiang
在shell中设置EF_PROTECT_BELOW环境变量即可,export EF_PROTECT_BELOW=1,在Makefile中加入他的库链接lefence,启动core dump,ulimit -c unlimited,启动程序即可调试。
可以检测内存非法使用,越界,数组越界等等问题。
下面是软件man手册上的说明
INSTRUCTIONS FOR DEBUGGING YOUR PROGRAM
1. Link with libefence.a as explained above.
2. Run your program in a debugger and fix any overruns or accesses to free memory.
3. Quit the debugger.
4. Set EF_PROTECT_BELOW = 1 in the shell environment.
5. Repeat step 2, this time repairing underruns if they occur.
6. Quit the debugger.
7. Read the restrictions in the section on WORD-ALIGNMENT AND OVERRUN DETECTION. See if
you can set EF_ALIGNMENT to 0 and repeat step 2. Sometimes this will be too much
work, or there will be problems with library routines for which you don’t have the
source, that will prevent you from doing this.
软件下载http://perens.com/FreeSoftware/
可以检测内存非法使用,越界,数组越界等等问题。
下面是软件man手册上的说明
INSTRUCTIONS FOR DEBUGGING YOUR PROGRAM
1. Link with libefence.a as explained above.
2. Run your program in a debugger and fix any overruns or accesses to free memory.
3. Quit the debugger.
4. Set EF_PROTECT_BELOW = 1 in the shell environment.
5. Repeat step 2, this time repairing underruns if they occur.
6. Quit the debugger.
7. Read the restrictions in the section on WORD-ALIGNMENT AND OVERRUN DETECTION. See if
you can set EF_ALIGNMENT to 0 and repeat step 2. Sometimes this will be too much
work, or there will be problems with library routines for which you don’t have the
source, that will prevent you from doing this.
软件下载http://perens.com/FreeSoftware/
相关阅读 更多 +










