[gnome-builder/wip/gtk4-port: 1100/1774] plugins/valgrind: add toggles for show-leak-kinds
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/wip/gtk4-port: 1100/1774] plugins/valgrind: add toggles for show-leak-kinds
- Date: Mon, 11 Jul 2022 22:31:34 +0000 (UTC)
commit eb17f3e68164024156d57deb3f15aff8adc9cc63
Author: Christian Hergert <chergert redhat com>
Date: Fri May 20 17:04:49 2022 -0700
plugins/valgrind: add toggles for show-leak-kinds
.../valgrind/gbp-valgrind-workbench-addin.c | 16 +++++++++++++++
src/plugins/valgrind/gtk/menus.ui | 23 ++++++++++++++++++++++
2 files changed, 39 insertions(+)
---
diff --git a/src/plugins/valgrind/gbp-valgrind-workbench-addin.c
b/src/plugins/valgrind/gbp-valgrind-workbench-addin.c
index 11446f008..fa74a9847 100644
--- a/src/plugins/valgrind/gbp-valgrind-workbench-addin.c
+++ b/src/plugins/valgrind/gbp-valgrind-workbench-addin.c
@@ -131,6 +131,8 @@ gbp_valgrind_workbench_addin_run_handler (IdeRunManager *run_manager,
g_autofree char *name = NULL;
g_autofree char *track_origins = NULL;
g_autofree char *leak_check = NULL;
+ g_autofree char *show_leak_kinds = NULL;
+ g_autoptr(GString) leak_kinds = NULL;
char log_fd_param[32];
int map_fd;
int fd;
@@ -159,13 +161,23 @@ gbp_valgrind_workbench_addin_run_handler (IdeRunManager *run_manager,
map_fd = ide_runner_take_fd (runner, fd, -1);
g_snprintf (log_fd_param, sizeof log_fd_param, "--log-fd=%d", map_fd);
+ leak_kinds = g_string_new (NULL);
+ if (get_bool (self, "leak-kind-definite")) g_string_append (leak_kinds, "definite,");
+ if (get_bool (self, "leak-kind-possible")) g_string_append (leak_kinds, "possible,");
+ if (get_bool (self, "leak-kind-indirect")) g_string_append (leak_kinds, "indirect,");
+ if (get_bool (self, "leak-kind-reachable")) g_string_append (leak_kinds, "reachable,");
+ if (leak_kinds->len > 0)
+ g_string_truncate (leak_kinds, leak_kinds->len-1);
+
/* Convert action state to command-line arguments */
track_origins = g_strdup_printf ("--track-origins=%s", get_bool (self, "track-origins") ? "yes" : "no");
leak_check = g_strdup_printf ("--leak-check=%s", get_string (self, "leak-check"));
+ show_leak_kinds = g_strdup_printf ("--show-leak-kinds=%s", leak_kinds->str);
/* Reverse order so we can continually use prepend */
ide_runner_prepend_argv (runner, track_origins);
ide_runner_prepend_argv (runner, leak_check);
+ ide_runner_prepend_argv (runner, show_leak_kinds);
ide_runner_prepend_argv (runner, log_fd_param);
ide_runner_prepend_argv (runner, "valgrind");
@@ -257,6 +269,10 @@ gbp_valgrind_workbench_addin_project_loaded (IdeWorkbenchAddin *addin,
static const GActionEntry actions[] = {
{ "track-origins", NULL, NULL, "true", set_state },
{ "leak-check", NULL, "s", "'summary'", set_state },
+ { "leak-kind-definite", NULL, NULL, "true", set_state },
+ { "leak-kind-possible", NULL, NULL, "true", set_state },
+ { "leak-kind-indirect", NULL, NULL, "false", set_state },
+ { "leak-kind-reachable", NULL, NULL, "false", set_state },
};
static void
diff --git a/src/plugins/valgrind/gtk/menus.ui b/src/plugins/valgrind/gtk/menus.ui
index 54ceb7ff8..fdbfda5ab 100644
--- a/src/plugins/valgrind/gtk/menus.ui
+++ b/src/plugins/valgrind/gtk/menus.ui
@@ -46,6 +46,29 @@
<attribute name="role">radio</attribute>
</item>
</section>
+ <section id="run-menu-valgrind-leak-kinds">
+ <attribute name="label" translatable="yes">Leak Kinds</attribute>
+ <item>
+ <attribute name="label" translatable="yes">Definite</attribute>
+ <attribute name="action">valgrind.leak-kind-definite</attribute>
+ <attribute name="role">check</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Indirect</attribute>
+ <attribute name="action">valgrind.leak-kind-indirect</attribute>
+ <attribute name="role">check</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Possible</attribute>
+ <attribute name="action">valgrind.leak-kind-possible</attribute>
+ <attribute name="role">check</attribute>
+ </item>
+ <item>
+ <attribute name="label" translatable="yes">Reachable</attribute>
+ <attribute name="action">valgrind.leak-kind-reachable</attribute>
+ <attribute name="role">check</attribute>
+ </item>
+ </section>
</submenu>
</section>
</menu>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]