Friday, November 16, 2007

Debuggers, Compilers, IDEs

This page is about tools for debugging software in C/C++, and where to find them. We expect to revise this page on a regular basis, as tools are updated, and as new debugging technology becomes available.

Microsoft Visual Studio - The Microsoft IDE. Beautiful, well integrated environment, contains several compilers for C++, Java, Visual Basic, source code viewers, debuggers, etc. A restricted version of the IDE and compiler called Visual C++ 2005 Express Edition is available for free download. (Free as in beer). Compared to previous free versions, the IDE for source code debugging, and the optimizing compiler is now included. No code generation for x64. Also, no ATL or MFC libraries, but we do not use this, since it is not portable to Linux. Please also check the license agreement for restrictions of use!

  • You can find information about Visual Studio by going to www.msdn.microsoft.com and then looking for Visual Studio / Visual C++.

GDB - The GNU Project Debugger.

GCC - The GNU compiler collection. High-quality compiler, together with Microsoft Visual C++ the best there is. Available for almost any CPU, due to being Open Source, and very modular and portable. Part of most Linux installations, and is also an optional part of Cygwin.

  • The GNU compiler GCC can be found here: gcc.gnu.org. Current stable version is 4.2.2.

Eclipse CDT (C/C++ Development Tooling) - CDT is the C/C++ IDE for the Eclipse software framework.

Copyright © 2006-2007 Thorsten Grötker, Ulrich Holtmann, Holger Keding, Markus Wloka

Environments

Cygwin - is a Linux-like environment for the Windows operating system. You can find more information, documentation, and download instructions at www.cygwin.com. Cygwin provides the user with a command shell, editors such as vi and xemacs, and most tools also available on Unix and Linux. You can optionally install the gcc compiler and the debugging tools gdb, gprof, valgrind. Thus, with very little effort, Cygwin provides the user with a practical software development system.

VWware® - is a software environment that provides virtual machines on a host workstation. It allows the creation of multiple separate Windows and Linux workstation installations, all of which can run on a single host machine. VMware is typically used when a program needs to be tested with many compiler or OS versions, or when a particular debugging tool is only available on one platform. Currently, several products are available. We recommend to use VMware® Workstation, which is targeted at software developers. It contains a useful checkpointing feature, where one or more known stable states of a virtual machine can be saved and restored. This is very useful for obtaining a clean and reproducible debugging environment. For example, you should use checkpointing in cases where the software alters or destroys a machine installation, or where a debugging environment needs to be shielded from software maintenance changes.

Memory Debuggers

IBM® Rational® PurifyPlus™ - Purify is a commercial memory debugging tool, available on Linux, Windows and Solaris. Purify works by instrumenting the object code of a program, and is called during the link phase. No source code is required, and no special compiler flags or a recompilation of the object files are needed.

Valgrind - Valgrind is free software, available on Linux with x86 and PowerPC processors. The use model of Valgrind is simple. Valgrind interprets the object code, so it doesn't need to modify object files or executable, and therefore does not require special compiler flags, recompiling, or relinking the program. The valgrind command is simply added at the shell command line in front of the program to be executed. A further advantage of Valgrind is that no program source code is required, so Valgrind can be used to analyze black-box software modules from third parties where the source code is confidential and unavailable.

BoundsChecker is a commercial memory checking tool for Visual C++ on Windows. BoundChecker has two modes: ActiveCheck, which monitors calls to the operating system and memory management routines, and FinalCheck, which adds object code insertion to monitor buffer overflows and uninitialized memory reads.

Insure++ is a commercial tool for detecting runtime memory errors. More information, is available at www.parasoft.com. Insure++ uses source code instrumentation: it modifies the source on the fly just before it is given to the compiler. This use model requires to recompile the source files. There is some provision to support object code libraries where source code is not available.

Electric Fence is free software, available on many Unix platforms, at ElectricFence. . It modifies the behavior of the malloc() function which is part of the standard C/C++ library. Each piece of allocated memory is placed is a separate segment of virtual memory. Accesses to unallocated memory thus trigger an segmentation fault error.

Copyright © 2006-2007 Thorsten Grötker, Ulrich Holtmann, Holger Keding, Markus Wloka

Profilers

gprof - The GNU Profiler. Measures time spend in program, functions, code blocks, and what functions were called from other functions. Sampling-based, this means that the call graphs are inaccurate, but actual performance of the measured program is only reduced by a moderate amount. gprof is usually part of the gcc/g++ package. Current version is 2.17. Documentation can be found here.

IBM® Rational® PurifyPlus™, previously known as Quantify, is part of a set of commercial runtime analysis tools sold by IBM. Information about PurifyPlus can be found here. Information on how to purchase the tool is also available on the web site.

VTune - Intel® VTune™ Performance Analyzer available for Windows and Linux.

Callgrind - Callgrind: a heavyweight profiler, part of Valgrind, available only on Linux.

Copyright © 2006-2007 Thorsten Grötker, Ulrich Holtmann, Holger Keding, Markus Wloka

Static Checkers

Coverity Prevent - is a commercial static code checker sold by Coverity, Inc., and is based on bug-finding technology developed at in the Computer Systems Laboratory at Stanford University, USA.

  • More information, documentation, download instructions, and pricing: www.coverity.com

Lint - appeared in 1979 as part of the UNIX operating system. lint has become a synonym for code checking of various computer languages, however the original tool works only on the C language. lint is part of some OS distributions such as Solaris.

  • The Linux shell command 'man lint' will print information on usage and options
  • The man page can also be found here: lint.1.html.
  • A manual can be found at manu.html, and a tutorial on lint can be found at lint.

Splint - (Secure Programming Lint) is a static checker. It is based on the original UNIX {\tt lint}, with extension for additional checks and for source code annotations. Documentation, source code, and binaries are available under www.splint.org. Splint is also available as a package in the Cygwin environment for Windows.

VC++ Enterprise /analyze option - The more expensise Enterprise (team development) version of VC++ 8.0 supports an /analyze code analysis option that is integrated into the VC++ IDE.

Klocwork is a commercial static analysis tool. Information, documentation, pricing and trial software is available at www.klocwork.com.

Fortify Source Code Analysis Suite is a commercial static analysis tool. Information, documentation, pricing and trial software is available at www.fortifysoftware.com.

Copyright © 2006-2007 Thorsten Grötker, Ulrich Holtmann, Holger Keding, Markus Wloka

Parallel Debugging

MPICL - ( Portable Instrumentation Library for MPI) is a library for collecting and displaying events in message-passing parallel programs.

TotalView - Etnus TotalView is a threads debugger.

Programming and Debugging Intel and AMD multicore CPUs

The Intel Multicore Resource Center has papers and tools for programming and debugging the Intel multicore CPUs (registration required).

The main mechanisms for programming the Intel multicore CPUs are OpenMP, POSIX threads, and Windows threads.

OpenMP - More information can be found here:

TBB - Here is more information on Intel® Threading Building Blocks (TBB):

Posix Threads - Here is more information on POSIX threads programming:

Copyright © 2007 Thorsten Grötker, Ulrich Holtmann, Holger Keding, Markus Wloka