From 67922ae4d9ec3d080fb6e67cfdec73ccd9b66c4f Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Thu, 21 Nov 2024 15:32:34 +0100 Subject: [PATCH] Add make target `my-prof.supp` This creates a "as personal as possible" Valgrind suppressions file. Signed-off-by: Steffen Jaeckel --- .gitignore | 1 + CONTRIBUTING.md | 6 +++++ Makefile.am | 8 +++++++ prof.supp | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/.gitignore b/.gitignore index 75c8a5f4..7b04d430 100644 --- a/.gitignore +++ b/.gitignore @@ -73,6 +73,7 @@ toc_fragment.html # valgrind files valgrind.out +my-prof.supp # Generate docs apidocs/python/_build/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 864b95be..55f70a90 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -110,6 +110,12 @@ We provide a suppressions file `prof.supp`. It is a combination of the suppressi `G_DEBUG=gc-friendly G_SLICE=always-malloc valgrind --tool=memcheck --track-origins=yes --leak-check=full --leak-resolution=high --num-callers=30 --show-leak-kinds=definite --log-file=profval --suppressions=prof.supp ./profanity` +There's also the option to create a "personalized" suppression file with the up-to-date glib2 and python suppressions. + +`make my-prof.supp` + +After executing this, you can replace the `--suppressions=prof.supp` argument in the above call, by `--suppressions=my-prof.supp`. + ### clang Running the clang static code analyzer helps improving the quality too. diff --git a/Makefile.am b/Makefile.am index f9c89d64..bb649d04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -343,6 +343,14 @@ clean-local: rm -f $(git_include) $(git_include).in endif +.PHONY: my-prof.supp +my-prof.supp: + @sed '/^# AUTO-GENERATED START/q' prof.supp > $@ + @cat /usr/share/glib-2.0/valgrind/glib.supp >> $@ + @wget -O- https://raw.githubusercontent.com/python/cpython/refs/tags/v`python3 --version | cut -d' ' -f2`/Misc/valgrind-python.supp >> $@ + @wget -O- https://raw.githubusercontent.com/GNOME/gtk/refs/tags/`pkg-config --modversion gtk+-3.0`/gtk.supp >> $@ + @cat /usr/share/gtk-3.0/valgrind/gtk.supp >> $@ + check-unit: tests/unittests/unittests tests/unittests/unittests diff --git a/prof.supp b/prof.supp index 57c73589..4a218adf 100644 --- a/prof.supp +++ b/prof.supp @@ -23,6 +23,13 @@ fun:gtk_init_check ... } +{ + gtk_module_init + Memcheck:Leak + ... + fun:gtk_module_init + ... +} # glib @@ -43,7 +50,61 @@ fun:omemo_crypto_init ... } +{ + gcry_mpi_scan + Memcheck:Leak + ... + fun:gcry_mpi_scan + ... +} +# libreadline related +{ + leak readline + Memcheck:Leak + ... + fun:readline +} +{ + leak add_history + Memcheck:Leak + ... + fun:add_history +} +{ + leak rl_make_bare_keymap + Memcheck:Leak + ... + fun:rl_make_bare_keymap +} +{ + leak rl_add_funmap_entry + Memcheck:Leak + ... + fun:rl_add_funmap_entry +} +{ + leak rl_initialize + Memcheck:Leak + ... + fun:rl_initialize +} + +# Python related +{ + Handle PyMalloc confusing valgrind (possibly leaked) + Memcheck:Leak + ... + fun:_PyObject_GC_New +} +{ + Handle PyMalloc confusing valgrind (possibly leaked) + Memcheck:Leak + ... + fun:PyType_Ready +} + +# AUTO-GENERATED START # GLib Valgrind suppressions file #