LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 4345|回复: 2

[转贴] Linux 平台上的C语言调试工具!

[复制链接]
发表于 2004-2-19 09:46:10 | 显示全部楼层 |阅读模式
Debugging Tools for C on Linux Platform
http://www.linuxgazette.com/node/view/8755

Submitted by Nikhil Bhargava on Tue, 02/17/2004 - 14:37.  Articles | General Interest
This article talks about debugging tools for applications in C on Linux platforms. Most of the tools are freely available on all major platforms with very wide user support. The tools help in static analysis of code as well as assist in dynamic evaluation of code.

Please note that tools listed here are suggestions of the author. This list is not a standard one. Changes have to be done in it depending upon the nature, scope and details of the application to be developed.
Debugging Tools


   1. Dmalloc http://dmalloc.com/

      The debug memory allocation or Dmalloc library is a freeware debugging tool which has been specially designed as a drop in replacement for the system's malloc, realloc, calloc, free and other memory management routines while providing powerful debugging facilities configurable at runtime. It makes changes during compile time and donot add runtime changes in binary. These facilities include such things as memory-leak tracking, fence-post write detection, file/line number reporting, and general logging of statistics. The library is reasonably portable having been run successfully on at least the following operating systems: AIX, BSD/OS, DG/UX, Free/Net/OpenBSD, GNU/Hurd, HPUX, Irix, Linux, MS-DOG, NeXT, OSF, SCO, Solaris, SunOS, Ultrix, Unixware, Windoze, and even Unicos on a Cray T3E. It has full support for programs the debugging of POSIX threads.

      The package includes the library, configuration scripts, debug utility application, test program, and documentation.

   2. Valgrind http://valgrind.kde.org/

      Valgrind is a GPL distributed system for debugging and profiling x86-Linux programs. I can also be helpful for programs for platforms other than x86 since behavior of x86 binary is similar to other binaries. The accompanying tools with Valgrind automatically detect many memory management and threading bugs, avoiding hours of frustrating bug-hunting, making programs more stable. It supports a through detailed profiling to help speed up the programs.

      The Valgrind distribution includes four tools: two memory error detectors, a thread error detector, and a cache profiler.

   3. Electricfence http://rpmfind.net/linux/RPM/con ... 2.2.2-2cl.i386.html

      Electric Fence is a freeware library that can be used for C programming and debugging. It can be linked at compile time and it will warn about possible problems such as freeing memory that doesn't exist, etc. It is basically a memory profiling tool. However currently it is available only on HP-Unix platform (I am not very sure though).

   4. GDB http://sources.redhat.com/gdb

      This is the Gnome Debugger which comes as a freeware support package with freeware Linux distribution like Red Hat, Slacware, and Debian etc. It has full support of many languages like C, C++, and Perl etc. It helps to debug the binaries of these languages in modes like single step, multiple step or complete run. It also has provisions of setting break points and trace value.

      It is helpful for stub testing, functional flow checking and bound checking. Further this is readily available with all flavours of Linux andUnix platforms and is amply supported in user community.

   5. Insight http://sources.redhat.com/insight

      Insight is a graphical user interface to GDB, the GNU Debugger written in Tcl/Tk by at Red Hat, Inc. and Cygnus Solutions Insight provides all features provided by GDB along with Graphical debugging interface replacing traditional command based interface.

   6. Memprof http://www.gnome.org/projects/memprof

      MemProf is a free ware memory Profiling and memory leak detection tool which comes as an addendum to common Linux distributions. It can generate a profile how much memory was allocated by each function in the program. It can scan memory and find blocks that have been allocated but are no longer referenced anywhere (dead code).

      MemProf works by pre-loading a library to override the C library's memory allocation functions and does not require recompiling the program. One advantage MemProf has over some other similar tools that are available is that it has a nice GUI front-end and is relatively easy to use.

  
I am Nikhil Bhargava from Delhi, India. I am a Computer Engineer currently working in C-DOT, India for past one year. Comments and Suggestions are always welcome.
发表于 2004-2-19 15:57:56 | 显示全部楼层
非常感谢!
发表于 2004-2-19 22:41:30 | 显示全部楼层
还有cchecker

也不错的检查库

另外还有lint 静态代码检查
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表