每天一个topic -- c 语言小工具
2013-08-20 23:17 chonghui1001 阅读(249) 评论(0) 编辑 收藏 举报1. 内存检查工具 efence, 编译的时候需要加上 -lefence -lpthread 提供多线程支持
gdb test
r
where
这时候可以看到准确的输出信息是哪一行内存溢出了
2. 语法检查工具 splint
splint -strict *.c
还是只能静态检查逻辑错误没法检查出来
3. 性能检测工具 gprof
编译的时候需要带上选项 -pg
gcc -pt -o test test.c
./test 执行程序后会生成一个 gmon.out 文件
然后是命令 gprof ./test 可以看到性能profile 文件