Skip to content

Commit 927e528

Browse files
committed
Merge #11035: [contrib] Add Valgrind suppressions file
4a426d8 Add note about Valgrind suppressions file in developer-notes.md (practicalswift) 84e2462 contrib: Add Valgrind suppressions file (practicalswift) Pull request description: Includes known Valgrind warnings in our dependencies that cannot be fixed in-tree. Example use: ``` $ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite ``` Running with the suppressions file under Ubuntu 16.04: ``` $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite --run_test=wallet_crypto … ==10769== LEAK SUMMARY: ==10769== definitely lost: 0 bytes in 0 blocks ==10769== indirectly lost: 0 bytes in 0 blocks ==10769== possibly lost: 0 bytes in 0 blocks ==10769== still reachable: 0 bytes in 0 blocks ==10769== suppressed: 72,704 bytes in 1 blocks ``` Running without the suppressions file under Ubuntu 16.04: ``` $ valgrind --leak-check=full --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite --run_test=wallet_crypto … ==10724== 72,704 bytes in 1 blocks are still reachable in loss record 1 of 1 ==10724== at 0x4C2DBF6: malloc (vg_replace_malloc.c:299) ==10724== by 0x6F74EFF: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21) ==10724== by 0x40106B9: call_init.part.0 (dl-init.c:72) ==10724== by 0x40107CA: call_init (dl-init.c:30) ==10724== by 0x40107CA: _dl_init (dl-init.c:120) ==10724== by 0x4000C69: ??? (in /lib/x86_64-linux-gnu/ld-2.23.so) ==10724== by 0x2: ??? ==10724== by 0x1FFF0006D2: ??? ==10724== by 0x1FFF0006E8: ??? ==10724== by 0x1FFF0006FF: ??? ==10724== ==10724== LEAK SUMMARY: ==10724== definitely lost: 0 bytes in 0 blocks ==10724== indirectly lost: 0 bytes in 0 blocks ==10724== possibly lost: 0 bytes in 0 blocks ==10724== still reachable: 72,704 bytes in 1 blocks ==10724== suppressed: 0 bytes in 0 blocks ``` Tree-SHA512: 9c92079fc61313ea678deb6aaa16a3a71c3154c757459793eb9ca0d90a9a74c6faebfb04c9135e1b398ca34224fb7f03bd9c488ea0e8debf6894f69f030a31d3
2 parents 7fbf3c6 + 4a426d8 commit 927e528

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

contrib/valgrind.supp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Valgrind suppressions file for Bitcoin.
2+
#
3+
# Includes known Valgrind warnings in our dependencies that cannot be fixed
4+
# in-tree.
5+
#
6+
# Example use:
7+
# $ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin
8+
# $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \
9+
# --show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite
10+
{
11+
Suppress libstdc++ warning - https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65434
12+
Memcheck:Leak
13+
match-leak-kinds: reachable
14+
fun:malloc
15+
obj:*/libstdc++.*
16+
fun:call_init.part.0
17+
fun:call_init
18+
fun:_dl_init
19+
obj:*/ld-*.so
20+
}
21+
{
22+
Suppress libdb warning - https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=662917
23+
Memcheck:Cond
24+
obj:*/libdb_cxx-*.so
25+
fun:__log_put
26+
obj:*/libdb_cxx-*.so
27+
fun:__log_put_record
28+
}
29+
{
30+
Suppress leveldb warning (leveldb::InitModule()) - https://github.com/google/leveldb/issues/113
31+
Memcheck:Leak
32+
match-leak-kinds: reachable
33+
fun:_Znwm
34+
fun:_ZN7leveldbL10InitModuleEv
35+
}
36+
{
37+
Suppress leveldb warning (leveldb::Env::Default()) - https://github.com/google/leveldb/issues/113
38+
Memcheck:Leak
39+
match-leak-kinds: reachable
40+
fun:_Znwm
41+
...
42+
fun:_ZN7leveldbL14InitDefaultEnvEv
43+
}

doc/developer-notes.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,21 @@ can be very difficult to track down. Compiling with -DDEBUG_LOCKORDER (configure
167167
CXXFLAGS="-DDEBUG_LOCKORDER -g") inserts run-time checks to keep track of which locks
168168
are held, and adds warnings to the debug.log file if inconsistencies are detected.
169169

170+
**Valgrind suppressions file**
171+
172+
Valgrind is a programming tool for memory debugging, memory leak detection, and
173+
profiling. The repo contains a Valgrind suppressions file
174+
([`valgrind.supp`](https://github.com/bitcoin/bitcoin/blob/master/contrib/valgrind.supp))
175+
which includes known Valgrind warnings in our dependencies that cannot be fixed
176+
in-tree. Example use:
177+
178+
```shell
179+
$ valgrind --suppressions=contrib/valgrind.supp src/test/test_bitcoin
180+
$ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \
181+
--show-leak-kinds=all src/test/test_bitcoin --log_level=test_suite
182+
$ valgrind -v --leak-check=full src/bitcoind -printtoconsole
183+
```
184+
170185
Locking/mutex usage notes
171186
-------------------------
172187

0 commit comments

Comments
 (0)