Tools

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.

IDE

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 Studio Express 2013 for Windows Desktop is available for free download. (Free as in beer). Please also check the license agreement for restrictions of use! (4/2015)

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.

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

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 and gprof. Thus, with very little effort, Cygwin provides the user with a practical software development system. Unfortunately, as of Feb. 2011, Valgrind is NOT part of Cygwin, as Valgrind has not been ported to run on the Windows operating 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

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 Linux and 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.

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.

PurifyPlus™, previously known as Quantify, is part of a set of commercial runtime analysis tools now sold by UNICOM. Information about PurifyPlus can be found here. Information on how to purchase the tool is also available on the web site. (4/2015)

VTune Intel® VTune™ Amplifier available for Windows and Linux.

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

Static Checkers

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

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

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.

Visual Studio 2013 Static Code Analysis – Visual Studio 2013 supports a static code analysis option.

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

Parallel Debugging, General

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

TotalViewTotalView is a threads debugger.

Debugging Intel / AMD multicore CPUs


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

  • Intel® Inspector XE – Page listing the Intel tools for memory and thread checking. Currently these tools are called Intel® Inspector XE, but marketing has renamed these frequently in the past years. (4/2015)
  • Intel® VTune™ Amplifier 2015 – current page to find VTune.

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

OpenMP – More information on OpenMP can be found here:

  • OpenMP.org – OpenMP website. The OpenMP Application Program Interface (API) supports multi-platform shared-memory parallel programming in C/C++ and Fortran on all architectures, including Unix platforms and Windows platforms
  • OpenMP – Wikipedia article
  • OpenMP in Visual C++ – documentation for OpenMP 2.0 support in Visual C++
  • GOMP – GCCs implementation of OpenMP, which is part of GCC

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

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