Skip to content

Commit 4e06fa4

Browse files
authored
Merge pull request #2007 from profanity-im/debug-1946
Debug #1946
2 parents 329ca8a + f27fa98 commit 4e06fa4

31 files changed

+318
-466
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ toc_fragment.html
7373

7474
# valgrind files
7575
valgrind.out
76+
my-prof.supp
7677

7778
# Generate docs
7879
apidocs/python/_build/

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ We provide a suppressions file `prof.supp`. It is a combination of the suppressi
110110

111111
`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`
112112

113+
There's also the option to create a "personalized" suppression file with the up-to-date glib2 and python suppressions.
114+
115+
`make my-prof.supp`
116+
117+
After executing this, you can replace the `--suppressions=prof.supp` argument in the above call, by `--suppressions=my-prof.supp`.
118+
113119
### clang
114120

115121
Running the clang static code analyzer helps improving the quality too.

Makefile.am

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,14 @@ clean-local:
343343
rm -f $(git_include) $(git_include).in
344344
endif
345345

346+
.PHONY: my-prof.supp
347+
my-prof.supp:
348+
@sed '/^# AUTO-GENERATED START/q' prof.supp > $@
349+
@cat /usr/share/glib-2.0/valgrind/glib.supp >> $@
350+
@wget -O- https://raw.githubusercontent.com/python/cpython/refs/tags/v`python3 --version | cut -d' ' -f2`/Misc/valgrind-python.supp >> $@
351+
@test -z "@GTK_VERSION@" || wget -O- https://raw.githubusercontent.com/GNOME/gtk/refs/tags/@GTK_VERSION@/gtk.supp >> $@
352+
@test -z "@GTK_VERSION@" || cat /usr/share/gtk-3.0/valgrind/gtk.supp >> $@
353+
346354
check-unit: tests/unittests/unittests
347355
tests/unittests/unittests
348356

autogen.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bootstrap.sh

configure.ac

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ AS_IF([test "x$PLATFORM" = xosx],
237237
dnl feature: icons-and-clipboard
238238
AS_IF([test "x$enable_icons_and_clipboard" != xno],
239239
[PKG_CHECK_MODULES([GTK], [gtk+-3.0 >= 3.24.0],
240-
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
240+
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])
241+
GTK_VERSION=`pkg-config --modversion gtk+-3.0`],
241242
[AS_IF([test "x$enable_icons_and_clipboard" = xyes],
242243
[PKG_CHECK_MODULES([GTK], [gtk+-2.0 >= 2.24.10],
243244
[AC_DEFINE([HAVE_GTK], [1], [libgtk module])],
@@ -389,6 +390,7 @@ LIBS="$glib_LIBS $gio_LIBS $PTHREAD_LIBS $curl_LIBS $libnotify_LIBS $python_LIBS
389390
AC_SUBST(AM_LDFLAGS)
390391
AC_SUBST(AM_CFLAGS)
391392
AC_SUBST(AM_CPPFLAGS)
393+
AC_SUBST(GTK_VERSION)
392394

393395
## Output
394396
AC_CONFIG_FILES([Makefile])
@@ -397,6 +399,7 @@ AC_OUTPUT
397399
AC_MSG_NOTICE([Summary of build options:
398400
PLATFORM : $target_os
399401
PACKAGE_STATUS : $PACKAGE_STATUS
402+
GTK_VERSION : $GTK_VERSION
400403
LIBS : $LIBS
401404
Install themes : $THEMES_INSTALL
402405
Themes path : $THEMES_PATH

prof.supp

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@
2323
fun:gtk_init_check
2424
...
2525
}
26+
{
27+
gtk_module_init
28+
Memcheck:Leak
29+
...
30+
fun:gtk_module_init
31+
...
32+
}
2633

2734
# glib
2835

@@ -43,7 +50,61 @@
4350
fun:omemo_crypto_init
4451
...
4552
}
53+
{
54+
gcry_mpi_scan
55+
Memcheck:Leak
56+
...
57+
fun:gcry_mpi_scan
58+
...
59+
}
60+
61+
# libreadline related
62+
{
63+
leak readline
64+
Memcheck:Leak
65+
...
66+
fun:readline
67+
}
68+
{
69+
leak add_history
70+
Memcheck:Leak
71+
...
72+
fun:add_history
73+
}
74+
{
75+
leak rl_make_bare_keymap
76+
Memcheck:Leak
77+
...
78+
fun:rl_make_bare_keymap
79+
}
80+
{
81+
leak rl_add_funmap_entry
82+
Memcheck:Leak
83+
...
84+
fun:rl_add_funmap_entry
85+
}
86+
{
87+
leak rl_initialize
88+
Memcheck:Leak
89+
...
90+
fun:rl_initialize
91+
}
92+
93+
# Python related
94+
{
95+
Handle PyMalloc confusing valgrind (possibly leaked)
96+
Memcheck:Leak
97+
...
98+
fun:_PyObject_GC_New
99+
}
100+
{
101+
Handle PyMalloc confusing valgrind (possibly leaked)
102+
Memcheck:Leak
103+
...
104+
fun:PyType_Ready
105+
}
46106

107+
# AUTO-GENERATED START
47108

48109
# GLib Valgrind suppressions file
49110
#

0 commit comments

Comments
 (0)