Debugging tools

来源:互联网 发布:mysql数据库下载64位 编辑:程序博客网 时间:2024/06/07 07:03

splint - lint 的linux版本, 编译器的加强,检查变量是否在定义前使用,未使用的函数参数,等等。

           - 使用:splint -strict program.c

 

 

 

ctags - 生成一个文件,列出每一个函数被引用的地方。

           - ctags -x sourcefile sourcefile ...

 

 

 

cxref - 列出代码中的变量名、宏、函数等。

          - cxref *.c *.h

 

 

 

cflow - 列出函数调用关系,显示函数调用了哪些其他函数或被其他哪些函数调用。

 

 

 

 

prof - GNU版本为gprof,检查程序中每个函数调用所花费的时间,编译时候使用-p(prof)或者-pg(gprof),目录中生成一个.out文件。

        - gcc -pg -o program program.c

 

 

 

 valgrind - 检查内存泄露

                 - valgrind --leak-check=yes -v ./program