Valgrind

Valgrind ( vælɡrɪnd ) is a collection of tools for debugging, profiling and dynamic error analysis of programs. Are supported in principle the architectures x86, AMD64, s390x, ARM, and PPC32 PPC64 under the operating systems Linux, Android and Mac OS X. Experimental ports for FreeBSD and NetBSD also exist.

Valgrind was originally developed by the compiler specialists Julian Seward, the Google - O'Reilly Open Source Award received for this work.

Origin of the name

The name valgrind comes from Norse mythology, where it is the main entrance to Valhall.

System Design

The Valgrind tool collection consists of various tools that can be selected when entering the program. They differ primarily in their aim and scope.

It can be found with these various tools otherwise quite difficult to localize errors, such as array bounds overflows or use of uninitialized variables. In addition, performance problems can be analyzed very well and narrow.

Valgrind is a command line - oriented program for which there are various graphical front-ends ( Alleyoop, Gnogrind, KDevelop, Valgui, Valkyrie ).

System realization

Valgrind is at its core a virtual machine that just-in- time compilation (JIT ) are used. None of the program to be debugged runs ever directly on the host CPU, instead Valgrind translates the program into a temporary, simpler and platform - independent byte code, called the Vex IR ( since version 3.x, formerly UCode ). After converting various Valgrind tools can make various transformations (eg monitoring of memory or creating a process profile ) before Valgrind takes the new code into machine code, and finally running.

Although it can convert to the Vex IR and back a program many times slower, to then add up nor the times of the different tools, but the Vex IR is much more suitable for debugging and creating the tools, and the slow execution time is for most programs no problem. Then there is the advantage that the proposed program is not prepared, not even must include source code.

Tools

  • Memcheck
  • Addrcheck ( removed in 3.2.0 )
  • Cachegrind
  • Massif
  • Helgrind
  • Lackey, Nulgrind
  • Callgrind
  • External Cachegrind

Tools: memcheck

The main tool for debugging programs is memcheck, which can find the following error:

  • Use of uninitialized memory
  • Read and write accesses to shared memory
  • Writing about the memory limits
  • Memory leaks

Tools: callgrind

For measurements of a program is callgrind interesting that determines extensive statistics on the program used. The figures are directly comparable across different systems, because they do not measure the execution time required, but the number of CPU cycles. It also indicates whether algorithms can run in the cache of the CPU very quickly and how often it happens to be a hit or miss. The size of the caches can vary it, so can simulate different CPUs.

Tools: Helgrind

The tool Helgrind ( up to version 2.2 and from version 3.3.0 ) can help in the search for critical sections and facilitates debugging with threads.

798005
de