Skip to main content

Valgrind output readable for human beings

Project description

https://badge.fury.io/py/valgreen.svg

Valgrind output readable for human beings

With Valgreen:

https://i.imgur.com/V0XrzXp.gif

With Valgrind:

https://i.imgur.com/rVXnlEB.gif

Installation

As simple as pip3 install valgreen. Keep in mind you need a working Valgrind installation!

Usage

Just write valgreen ./exec instead of valgrind --leak-check=full --track-origins=yes --show-reachable=yes ./exec

Example

Valgreen vs Valgrind output

$ gcc -g example.c -o example
$ valgreen ./example

 1) Conditional jump or move depends on uninitialised value(s)
   at main (example.c:8)
   Uninitialised value was created by a stack allocation
   at main (example.c:4)

 2) Invalid write of size 1
   at main (example.c:12)
    Address 0x522d042 is 0 bytes after a block of size 2 alloc'd
    at malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by main (example.c:11)

 3) Invalid read of size 1
   at main (example.c:15)
    Address 0x522d045 is 3 bytes after a block of size 2 alloc'd
    at malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by main (example.c:11)

 4) Invalid free() / delete / delete[] / realloc()
   at free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by main (example.c:19)
   Address 0x522d040 is 0 bytes inside a block of size 2 free'd
   at free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by main (example.c:18)
   Block was alloc'd at
   at malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by main (example.c:11)

 5) 100 bytes in 1 blocks are definitely lost in loss record 1 of 1
   at malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
    by main (example.c:22)

$ valgrind --leak-check=full --track-origins=yes --show-reachable=yes ./example

==7750== Memcheck, a memory error detector
==7750== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==7750== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==7750== Command: ./example
==7750==
==7750== Conditional jump or move depends on uninitialised value(s)
==7750==    at 0x108696: main (example.c:8)
==7750==  Uninitialised value was created by a stack allocation
==7750==    at 0x10868A: main (example.c:4)
==7750==
==7750== Invalid write of size 1
==7750==    at 0x1086B5: main (example.c:12)
==7750==  Address 0x522d042 is 0 bytes after a block of size 2 alloc'd
==7750==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7750==    by 0x1086A8: main (example.c:11)
==7750==
==7750== Invalid read of size 1
==7750==    at 0x1086BC: main (example.c:15)
==7750==  Address 0x522d045 is 3 bytes after a block of size 2 alloc'd
==7750==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7750==    by 0x1086A8: main (example.c:11)
==7750==
==7750== Invalid free() / delete / delete[] / realloc()
==7750==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7750==    by 0x1086DA: main (example.c:19)
==7750==  Address 0x522d040 is 0 bytes inside a block of size 2 free'd
==7750==    at 0x4C30D3B: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7750==    by 0x1086CE: main (example.c:18)
==7750==  Block was alloc'd at
==7750==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7750==    by 0x1086A8: main (example.c:11)
==7750==
==7750==
==7750== HEAP SUMMARY:
==7750==     in use at exit: 100 bytes in 1 blocks
==7750==   total heap usage: 2 allocs, 2 frees, 102 bytes allocated
==7750==
==7750== 100 bytes in 1 blocks are definitely lost in loss record 1 of 1
==7750==    at 0x4C2FB0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==7750==    by 0x1086E4: main (example.c:22)
==7750==
==7750== LEAK SUMMARY:
==7750==    definitely lost: 100 bytes in 1 blocks
==7750==    indirectly lost: 0 bytes in 0 blocks
==7750==      possibly lost: 0 bytes in 0 blocks
==7750==    still reachable: 0 bytes in 0 blocks
==7750==         suppressed: 0 bytes in 0 blocks
==7750==
==7750== For counts of detected and suppressed errors, rerun with: -v
==7750== ERROR SUMMARY: 5 errors from 5 contexts (suppressed: 0 from 0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

valgreen-0.5-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file valgreen-0.5-py3-none-any.whl.

File metadata

  • Download URL: valgreen-0.5-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

File hashes

Hashes for valgreen-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0874147f1d4bde9706e32e72118c23511e9a87a9e1affc3b03e04f1557bd5af1
MD5 e07a3b725c91f4a35a0b837820ec0b33
BLAKE2b-256 a9ab2dd809e21e22d581ab05f6c82abf1c245719368bcc2363895519e168ba44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page