Valgrind

from Wikipedia, the free encyclopedia
valgrind
Basic data

developer Valgrind developer
Current  version 3.16.0
(May 27, 2020)
operating system Linux , Android , FreeBSD , macOS , Solaris
programming language C.
category Debugger , profiler
License GPL ( Free Software )
German speaking No
www.valgrind.org

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

Valgrind was originally developed by the compiler construction specialist Julian Seward , who received the Google-O'Reilly Open Source Award in 2006 for this work.

Origin of name

The name Valgrind comes from Norse mythology and is the main entrance to Valhall .

System structure

The Valgrind tool collection consists of various tools that can be selected when the program is called up. They differ primarily in their direction and scope. Various errors that are otherwise difficult to localize can be found with these tools, e.g. B. field limit overflows or the use of non-initialized variables. In addition, performance problems can be analyzed and narrowed down very well.

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

System implementation

Valgrind is essentially a virtual machine with just-in-time compilation (JIT). Nothing of the program to be debugged runs directly on the host CPU , instead Valgrind translates the program into a temporary, simpler and platform-independent bytecode , the so-called Vex IR (from version 3.x, previously UCode). After the conversion, various Valgrind tools can carry out various transformations (e.g. monitoring the memory or creating a process profile) before Valgrind takes the new code, translates it into machine code and finally lets it run.

The conversion to the Vex IR and back makes a program run many times slower, and the times of the various tools are added, but the Vex IR is much more suitable for debugging and creating the tools, and the execution time is slow no problem for most programs. In addition, there is the advantage that the program to be checked does not have to be prepared, and does not even have to be in the source code .

Tools

  • Memcheck
  • Addrcheck (removed in 3.2.0)
  • Cachegrind
  • DRD
  • Massif
  • Helgrind
  • Lackey, Nulgrind
  • DHAT
  • Callgrind
  • SGcheck
  • BBV

Tool: memcheck

The most important tool for debugging programs is memcheck , which can find the following errors:

  • Use of uninitialized memory
  • Read and write access to shared memory
  • Writing beyond memory limits
  • Memory leaks

Tool: callgrind

Callgrind is interesting for measuring a program , which determines extensive statistics about the program used. The numbers are directly comparable on different systems because they do not measure the required execution time, but the number of CPU cycles. It also indicates whether algorithms can run particularly quickly in the CPU's cache and how often a hit or miss occurs. The size of the cache can be varied, so different CPUs can be simulated.

Tool: helgrind

The helgrind tool (up to version 2.2 and from version 3.3.0) helps to find critical sections and makes debugging with threads easier.

See also

Web links

Individual evidence

  1. ^ The Valgrind Developers
  2. Current Released
  3. ^ The valgrind Open Source Project on Open Hub: Languages ​​Page . In: Open Hub . (accessed October 18, 2018).
  4. Google-O'Reilly Open Source Awards - Hall of Fame , accessed November 18, 2018.