posts - 189,comments - 115,trackbacks - 0

Linux 平台上的C语言调试工具!

Debugging Tools for C on Linux Platform

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

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

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

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

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

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

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.





◆LIUXUY 磁盘系统源程序:










◆一个有关 FreeBSD 的网站:


◆brainf*ck 语言的解释器























































◆用c编一个分数计算器程序 :


























◆scanf 讨论:

















































◆COS X曲线
































◆COS X曲线


◆@ 的读音:










◆汇编语言嵌入C 程序段:











◆C 的文本文件行操作:


























◆关于main 的参数:

◆main 函数返回值问题:




















◆far 远程指针简述:










◆make file(unix下)易错地方:










◆scanf:floating points format not linked:



◆PC 底层系统编程:


◆有关 FreeBSD 的网站:














WPS Office 2005个人版免费下载:


posted on 2007-12-06 21:36 MEYE 阅读(2715) 评论(2)  编辑  收藏

# re: Linux 平台上的C语言调试工具!
2008-09-18 10:22 | domemt
totalview适合linux下开发的多种语言调试 是linux下运行的第一款图形化的调试工具  回复  更多评论
# re: Linux 平台上的C语言调试工具!
2010-06-23 16:30 | ed hardy
非常感谢楼主的提供,大大的有用!!  回复  更多评论