Competitive Programmer Tools News

Valgrind || Best Tool for Competitive Programmers

Valgrind || Best Debugging Tool For Competitive Programmers

Valgrind is a GPL’d system for debugging and profiling Linux programs. With Valgrind’s tool suite you can automatically detect many memory management and threading bugs, avoiding hours of frustrating bug-hunting, making your programs more stable. You can also perform detailed profiling to help speed up your programs.

Image result for valgrind

Why should you use Valgrind?

  • Valgrind will save you hours of debugging time. With Valgrind tools, you can automatically detect many memory management and threading bugs. This gives you confidence that your programs are free of many common bugs, some of which would take hours to find manually, or never be found at all. You can find and eliminate bugs before they become a problem.
  • Valgrind can help you speed up your programs. With Valgrind tools, you can also perform very detailed profiling to help find bottlenecks in your programs.
  • Valgrind is free. Free-as-in-speech: you can download it, read the source code, make modifications, and pass them on, all within the limits of the GNU GPL. And free-as-in-beer: we aren’t charging for it.
  • Valgrind runs on several popular platforms, such as x86/Linux, AMD64/Linux, and PPC32/Linux. Valgrind works with all the major Linux distributions, including Red Hat, SuSE, Debian, Gentoo, Slackware, Mandrake, etc.
  • Valgrind is easy to use. Valgrind uses dynamic binary instrumentation, so you don’t need to modify, recompile or relink your applications. Just prefix your command line with Valgrind and everything works.
  • Valgrind is not a toy. Valgrind is first and foremost a debugging and profiling system for large, complex programs. We have had feedback from users working on projects with up to 25 million lines of code. It has been used on projects of all sizes, from single-user personal projects, to projects with hundreds of programmers.
  • Valgrind is suitable for any type of software. Valgrind has been used with desktop applications, libraries, databases, games, web browsers, network servers, distributed control systems, virtual reality frameworks, transaction servers, compilers, interpreters, virtual machines, telecom applications, embedded software, medical imaging, scientific programs, signal processing programs, video/audio programs, business intelligence software, financial/banking software, operating system daemons, etc, etc. See a list of projects using Valgrind.
  • Valgrind is widely used. Valgrind has been used by thousands of programmers across the world. We have received feedback from users in over 30 countries.
  • Valgrind works with programs written in any language. Because Valgrind works directly with program binaries, it works with programs written in any programming language, be they compiled, just-in-time compiled, or interpreted. The Valgrind tools are largely aimed at programs written in C and C++, because programs written in these languages tend to have the most bugs! But it can, for example, be used to debug and profile systems written in a mixture of languages. Valgrind has been used on programs written partly or entirely in C, C++, Java, Perl, Python, assembly code, Fortran, Ada, and many others.
  • Valgrind gives 100% coverage of user-space code, even within system libraries. You can even use Valgrind on programs for which you don’t have the source code.
  • Valgrind is extensible. Anyone can write powerful new tools that add arbitrary instrumentation to programs. This is much easier than writing such tools from scratch. This makes Valgrind ideal for experimenting with new kinds of program analysis tools. It has been used for research purposes by people at the following universities: Cambridge, MIT, UC Berkeley, UC Santa Barbara, Carnegie Mellon, Cornell, University of New Mexico, Australian National University, University of Melbourne, TU Muenchen (Munich) and Graz University of Technology.
  • Valgrind is actively maintained. The Valgrind developers are constantly working to fix bugs, improve Valgrind, and ensure it works as new Linux distributions and libraries come out. There are also mailing lists you can subscribe to, and contact if you’re having problems.

So what’s the catch? The main one is that programs run significantly more slowly under Valgrind. Depending on which tool you use, the slowdown factor can range from 5–100. This slowdown is similar to that of similar debugging and profiling tools. But since you don’t have to use Valgrind all the time, this usually isn’t too much of a problem. The hours you’ll save debugging will more than make up for it.

When should you use Valgrind?

It depends on your exact needs. Here are some examples of when people use Valgrind’s bug-detecting tools.

  • All the time. For small programs with short run-times, when developing you can always run the program under a Valgrind tool (usually Memcheck), knowing that memory bugs will be found immediately.
  • In automatic testing. By using Valgrind tools in your automatic unit, integration, system, or regression test, you can be confident no code will be unchecked.
  • After big changes. To ensure new bugs haven’t been introduced in the new code.
  • When a bug occurs. Get instant feedback about what the bug is, where it occurred, and why.
  • When a bug is suspected. Is your program behaving oddly? Use a Valgrind tool to discover if a bug is a cause.
  • Before a release. To give you confidence that your new release is as stable and bug-free as possible.
  • As for Valgrind’s profiling tools, use those whenever you want information about how your program is spending its time, or you want to speed it up.

Projects Using Valgrind

Research

Valgrind has been used as the starting point for various research projects.

  • RISE: this University of New Mexico project used Valgrind to implement randomized instruction set emulation, in order to disrupt binary code injection attacks.
  • Daikon: MIT’s invariant detection system uses Valgrind to implement a trace-gathering tool named Kvasir.
  • Taintcheck: CMU’s exploit detector and analyser is implemented as a Valgrind tool.

Office Software

  • OpenOffice: an open source multi-platform office productivity suite. (Examples of bugs found.)
  • StarOffice: a commercial multi-platform office productivity suite, based on OpenOffice.
  • AbiWord: a multi-platform, full-featured and ultra-efficient word processor.
  • KOffice: a multi-application, integrated office suite.
  • Gnumeric: a replacement for proprietary spreadsheets.
  • Evolution: integrated email, calendar, scheduling, contact management and task-list system.
  • Mozilla Thunderbird: a powerful email and newsgroup client derived from the Mozilla suite.
  • Krita: a painting and image editing application.

Web Browsers

  • Mozilla: web application suite, for browsing, email, IRC chat and HTML editing.
  • Mozilla Firefox: a lean, fast web browser derived from the Mozilla suite.
  • Opera: a fast, multi-platform web browser.
  • Konqueror: a web browser, file manager, and universal document viewing application.
  • Galeon: a web browser for GNOME that uses Mozilla’s rendering engine.
  • Embrowser: a small extensible web browser for internet appliances.

Databases and Search Engines

  • MySQL: the World’s most popular open source database. (A thank you from MySQL.)
  • PostgreSQL: the World’s most advanced open source database.
  • SQLite: The most widely deployed database engine; a self-contained, zero-configuration, serverless in-process library. (Appreciation from SQLite.)
  • Teratext Database System: a terabyte-capable text database.
  • MonetDB: a high performance database supporting complex queries over tables with hundreds of columns and multi-million rows.
  • Natix: a native XML database management system.
  • Teracruz dbAppliance: a database performance monitoring and acceleration tool.
  • Exalead: a search and navigation platform, including search engine, XML processing libraries, and statistical linguistics.
  • Cyberquery: a high performance ad-hoc query and production reporting system.
  • FAST Data Search: an enterprise real-time search and information retrieval system.
  • Xapian: an open source probabilistic information retrieval library.

Scientific

  • NASA Mars Exploration Rover: navigation and vision systems.
  • Atlas and CMS experiments at CERN’s Large Hadron Collider: Data acquisition, reconstruction, analysis, visualisation and simulation software.
  • ROOT: a widely-used data access, analysis and visualisation system.
  • SLURM: A highly scalable cluster resource manager.
  • PACX-MPI: a library for running parallel application on clusters connected through high-speed networks or the internet.
  • SHIPFLOW/Chapman: special purpose software for investigating marine vessel hydrodynamics.
  • Teem: a collection of C libraries for manipulating and visualizing structured scientific data.
  • Free Finite Element Package: numerical libraries for linear finite elements in two dimensions.
  • Cactus: a framework for parallel computation and collaborative code development.
  • Carpet: a mesh refinement driver for Cactus.
  • HarmonyWare: NURBS-based geometry translator tools.
  • MIRA Assembler: a whole genome shotgun and EST sequence assembler.
  • Parma Polyhedra Library: a modern C++ library for the manipulation of convex polyhedra.
  • VXL: C++ Libraries for computer vision research and implementation.
  • Beosim: a Beowulf grid simulator.
  • Zori: a GPL quantum Monte Carlo (QMC) program.
  • Babel: high performance language interoperability for scientific computing.
  • CATHEDRAL: a protein structure comparison algorithm.
  • Cubit: a geometry and mesh generation toolkit.
  • Allegro: a genetic linkage analysis package.
  • GDAL: a multiformat geospatial raster/vector translator library.
  • R: a free software environment for statistical computing and graphics.
  • statist: a small and portable statistics program.
  • MbDyn: a free software multibody dynamics analysis system.
  • Magma: an algebra, number theory, geometry and combinatorics package.
  • McQSAR: a quantitative structure-activity relationships engine used for computer-aided drug design.
  • ObjCryst/Fox: tools for crystal structure determination from X-ray powder diffraction data.
  • CP2K: a molecular simulation package.
  • OMW: a package for tactical maritime surveillance of ships, oil slicks, and sea state from synthetic aperture RADAR satellite imagery.

Graphics and Visualization

  • RenderMan: rendering package used for all of Pixar’s movies, The Lord of the Rings, The Matrix Trilogy, the Star Wars prequels, etc.
  • The GIMP: the GNU Image Manipulation Program.
  • Blender: a free open source 3D content creation suite.
  • OpenSG: a portable scenegraph system for creating realtime graphics programs, e.g. for virtual reality applications.
  • EQUINOX-3D: a modeling, animation and renderering suite for 3D graphics on Linux and Unix.
  • BrainVISA / Anatomist: a visualization tool for brain mapping, dedicated to structural data browsing.
  • VTK: an open source software system for 3D computer graphics, image processing, and visualization.
  • Coin: a multi-platform scene graph library for realtime 3D graphics.
  • ParaView: a visualizer for large data sets.
  • KolourPaint: an easy-to-use paint program for KDE.
  • GraphicsMagick: a collection of utilities, libraries, and scripting interfaces for performing image processing.
  • 3Delight: A fast RenderMan-compliant renderer.
  • Leptonica: An open source C library for efficient image processing and image analysis operations.
  • Insight Toolkit: ITK is an open source software system to support the Visible Human Project.

Simulation

  • ASPECT: a data stream monitoring and visualization tool, for simulation analysis.
  • FlightGear: an open source, multi-platform, cooperative flight simulator.
  • SimGear: building-block libraries for quickly assembling 3D simulations, games, and visualization applications.
  • Gadget: An open source modelling framework, used to simulate and optimise statistical marine ecosystem models.
  • BeoSim: a multi-cluster computational grid simulator for parallel job scheduling research.

Programming Language Implementations

  • Perl: a general-purpose programming language; the duct-tape of the internet.
  • Python: an interpreted, interactive, object-oriented programming language.
  • PHP: a web-oriented scripting language.
  • Mono: a free implementation of the .NET development framework.
  • LLVM: a compiler infrastructure.
  • Pike: a dynamic programming language with powerful built-in data types allowing simple and fast data manipulation.
  • ST200 VLIW C compiler: the STMicroelectronics ST200 VLIW production C compiler.
  • Cyberscreen: a fourth generation language and rapid application development environment.
  • Lava: an experimental OO programming language implementation, including a structure editor.
  • Aikido: an interpreted prototyping and scripting language with a syntax that resembles C++ and Java.
  • DParser: a scannerless GLR parser/generator.
  • Qore: a dynamically-typed object-oriented language designed for interfacing, embedding logic in applications, and SMP scalability (released under the LGPL).
  • Lush: an object-oriented programming language designed for researchers, experimenters, and engineers interested in large-scale numerical and graphic applications.

Development Tools

  • GNU ddd: a graphical front-end for GDB, DBX, WDB, Ladebug, JDB, XDB, bashdb, and the Perl, Python and PHP debuggers.
  • OProfile: a system-wide, kernel- and user-space profiler for Linux.
  • Monotone: a free, distributed version control system.
  • Squish: a cross-platform automated GUI testing framework for Qt/C++ applications.
  • Dart: an open source, distributed, software quality system.
  • CMake: a cross-platform, open source make system.
  • eboxy: a tool for creating graphical user interfaces for set-top boxes.
  • Umbrello: a UML modeller.
  • Zero: a flexible debugger for C and C++ applications on Linux.

Development Environments and Libraries

  • KDE: an open source graphical desktop environment for Unix workstations.
  • GNOME: a desktop environment and developer platform for Unix and Linux systems.
  • libstdc++: the GNU C++ standard library.
  • Qt by Trolltech: a multi-platform, C++ application development framework.
  • uClibc: a compact C library for embedded systems.
  • libxml2/libxslt: GNOME’s multi-platform XML C parser and toolkit.
  • Boost C++ libraries: a collection of portable C++ source libraries.
  • Smieciuch++: a precise garbage collector library for C++.
  • XPLC: lightweight cross-platform components to aid software extension and reuse.
  • LibVNCServer: a free library which makes it fun to write a server that connects to VNCViewer.
  • FOX Toolkit: a platform-independent C++ toolkit for developing graphical user interface applications.
  • gtk2-perl: a set of perl bindings for Gtk+ 2.x and various related libraries.
  • VR Juggler: an open source library for developing cross platform virtual reality applications.
  • Mini-XML: a small XML parsing library.
  • Fast Light Toolkit (FLTK): a cross-platform C++ GUI toolkit for UNIX, Linux, Windows and MacOS X.
  • Opie: a graphical user environment for PDAs and other Linux devices.
  • iwear: a multi-library framework for mobile computers.
  • xynth: an embedded and portable windowing system.

Audio/Video

  • Ogg Vorbis: a toolset for the high-quality, MP3-style patent-free audio codec.
  • Icecast: a streaming audio server, used for internet radio and similar applications.
  • Rosegarden: a MIDI and audio sequencer and notation editor.
  • Mixxx: digital DJ software.
  • AIDO: a home entertainment media system, complete with servers, clients, and protocols, handling any TV-presentable content.
  • Kdenlive: video editing suite.
  • amaroK: a KDE media player.
  • Speex: a patent-free voice codec.
  • libcdio: the GNU compact disc input and control library.
  • VCDImager: a full-featured mastering suite for video CDs and super video CDs.
  • FLAC: A free lossless audio codec.
  • Buzztard: A modular “Tracker”-style audio sequencer.
  • Ardour: A digital audio workstation.
  • libsndfile: a library for reading/writing sound files.
  • libsamplerate: an audio sample rate converter.
  • Annodex: an open source system for video surfing.

System

  • Samba: an open source suite providing seamless file and print services to SMB/CIFS clients.
  • Common UNIX Printing System (CUPS): a portable printing layer for UNIX-based operating systems.
  • Xinetd: a secure and powerful replacement for inetd, the internet services daemon.
  • ntop: a network traffic probe that shows network usage.
  • Prelude IDS: a hybrid intrusion detection system for network/host security.
  • SynCE: a WinCE communications layer.
  • Gutenprint: printer drivers for use with Ghostscript, CUPS, Foomatic, and The GIMP.
  • NX: X Window compression software.
  • Xsupplicant: an 802.1X client for Linux.
  • ICPLD: A network connection performance monitor.
  • RIOT: The friendly operating system for the Internet of Things.

Games

Internet

  • Squid: a full-featured web proxy cache.
  • PowerDNS: a modern, advanced and high performance authoritative-only nameserver.
  • Pan: a newsreader supporting offline newsreading, article filtering, and multiple connections.
  • Psi: a cross-platform Jabber client designed for the Jabber power user.
  • GNUnet: a secure peer-to-peer file sharing framework.
  • Gtk-Gnutella: a P2P application for the Gnutella network that aims for high uptimes.
  • ripMIME: an email decoding engine and library.
  • Bidwatcher: an eBay auction listing tracker.
  • QSF: a small fast statistical spam filter.
  • JMBA: a junk mail buffering agent (email challenge/response system).
  • URL filter: a URL database and internet filter.
  • Polipo: a small and fast caching web proxy.
  • libSPF: Sender Policy Framework (SPF) library employing a form of SMTP anti-forgery.
  • MyServer: a powerful and easy to configure web server.

Messaging/Communications

  • Yahoo! Messenger: a free instant messaging service.
  • naim: an instant messaging console client for AIM, ICQ, IRC, and The lily CMC.
  • Kadu: an IM client for the Gadu-Gadu network.
  • InspIRCd: a modular C++ IRC server.
  • GNU Gatekeeper: a free H.323 gatekeeper to manage VoIP networks.

Business/Financial

  • SAS: a 25 MLOC integrated data management, business intelligence and analysis system.
  • SmartASR: a billing system.

Other

  • Eurocontrol/CFMU’s ETFMS: air traffic flow management for Europe; and IFPS: a flight plan validation and distribution system for all flights flying in/over Europe.
  • Dia: a diagram creator, particularly suited to drawing simple circuit diagrams, and more.
  • SportVision: various tools for virtual enhancements to live TV sports broadcasts.
  • ORINOCO: a tool to estimate the power dissipation of hardware/ASIC designs.
  • xmlBlaster: a publish/subscribe and PtP message oriented middleware with easy access from C, C++, Java, Perl, Python.
  • Papaya: a GTK+-2.0 MUD client for UNIX and Windows.
  • LibMSWrite: a free, platform-independent library that reads and writes the MS Write 3.0/3.1 document format.
  • Mnet: a distributed file store.
  • Speed Dragon Tools: programming tools for the Speed Dragon ISDN PBX.
  • libExtractor: a library for extracting metadata from files.
  • MICO: a freely available and fully compliant C++ implementation of the CORBA standard.
  • Citadel: An open source, standalone, groupware and collaboration server.
  • ArahWeave: a dobby and jacquard weaving CAD/CAM program.
  • Survex: an open source cave-surveying software package.
  • xfce4-xmms2-client: a GUI client for xmms2.
  • ClamAV: an open source (GPL) anti-virus toolkit for UNIX, designed especially for e-mail scanning on mail gateways.

Want to know more:

Official Documentation

http://valgrind.org/docs/

Source Code

http://valgrind.org/downloads/

 





Leave a Reply