Git Product home page Git Product logo

valgrind-preload's Introduction

License Build Status codecov Total alerts Coverity Scan

What's this?

Valgrind-preload (AKA Pregrind) is a simple LD_PRELOAD-able library which will cause all spawned processes to be started under Valgrind.

It's functionality is similar to Valgrind's standard --trace-children=yes but fixes few disadvantages:

  • avoids intrumenting setuid processes (Valgrind doesn't handle them so you have to laboriously blacklist all of them via --trace-children-skip which is unreliable and disables instrumentation of grandchildren)
  • can easily be enabled for the whole distro or chroot via ld.so.preload (no need to search for init and replace it with a wrapper)

The tool seems to be pretty stable now, e.g. I was able to instrument complete Debian package builds and even found several new errors.

Usage

To use, just preload libpregrind.so to your app:

$ LD_PRELOAD=path/to/libpregrind.so app arg1 ...

You can also use a simple wrapper script:

$ path/to/pregrind app arg1 ...

Finally, if you want to instrument whole system, preload libpregrind.so globally:

$ echo path/to/libpregrind.so >> /etc/ld.so.preload

Note that in this mode libpregrind.so will be preloaded to all newly started processes so any malfunction may permanently break your system. It's thus highly recommended to only do this in a chroot or VM.

Library can be customized through environment variables:

  • PREGRIND_LOG_PATH - log to files inside this directory, rather than to stderr
  • PREGRIND_FLAGS - additional flags for Valgrind (e.g. --track-origins=yes)
  • PREGRIND_VERBOSE - print diagnostic info
  • PREGRIND_DISABLE - disable instrumentation
  • PREGRIND_BLACKLIST - name of file with wildcard patterns of files which should not be instrumented

Build

To build the tool, simply run make from top directory.

Trophies

Known issues

Various TODO and FIXME are scattered all over the codebase but tool should be quite robust. Ping me if you need more features.

valgrind-preload's People

Contributors

yugr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

clayne

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.