Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug #1946 #2007

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ toc_fragment.html

# valgrind files
valgrind.out
my-prof.supp

# Generate docs
apidocs/python/_build/
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 8 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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 >> $@
@test -z "@GTK_VERSION@" || wget -O- https://raw.githubusercontent.com/GNOME/gtk/refs/tags/@GTK_VERSION@/gtk.supp >> $@
@test -z "@GTK_VERSION@" || cat /usr/share/gtk-3.0/valgrind/gtk.supp >> $@

check-unit: tests/unittests/unittests
tests/unittests/unittests

Expand Down
1 change: 1 addition & 0 deletions autogen.sh
5 changes: 4 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,8 @@ AS_IF([test "x$PLATFORM" = xosx],
dnl feature: icons-and-clipboard
AS_IF([test "x$enable_icons_and_clipboard" != xno],
[PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.24.0],
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])
GTK_VERSION=`pkg-config --modversion gtk+-3.0`],
[AS_IF([test "x$enable_icons_and_clipboard" = xyes],
[PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.24.10],
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
Expand Down Expand Up @@ -389,6 +390,7 @@ LIBS="$glib_LIBS $gio_LIBS $PTHREAD_LIBS $curl_LIBS $libnotify_LIBS $python_LIBS
AC_SUBST(AM_LDFLAGS)
AC_SUBST(AM_CFLAGS)
AC_SUBST(AM_CPPFLAGS)
AC_SUBST(GTK_VERSION)

## Output
AC_CONFIG_FILES([Makefile])
Expand All @@ -397,6 +399,7 @@ AC_OUTPUT
AC_MSG_NOTICE([Summary of build options:
PLATFORM : $target_os
PACKAGE_STATUS : $PACKAGE_STATUS
GTK_VERSION : $GTK_VERSION
LIBS : $LIBS
Install themes : $THEMES_INSTALL
Themes path : $THEMES_PATH
Expand Down
61 changes: 61 additions & 0 deletions prof.supp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@
fun:gtk_init_check
...
}
{
gtk_module_init
Memcheck:Leak
...
fun:gtk_module_init
...
}

# glib

Expand All @@ -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
#
Expand Down
Loading
Loading