Starting dbus-services over valgrind

Simon McVittie smcv at collabora.com
Fri Jul 6 11:51:47 UTC 2018


On Thu, 05 Jul 2018 at 21:13:33 +0000, Дилян Палаузов wrote:
> how can I run a dbus activated program under valgrind?

The Exec command is run directly by the dbus-daemon, not by a shell,
so you cannot use syntax like "&>>" in it. It's converted into an argv
array by following rules that implement a small subset of shell syntax,
similar to GLib's g_shell_parse_argv() and Python's shlex.split();
this is similar to .desktop files[1] and systemd units.

The easiest way is probably to return org.freedesktop.secrets.service to
its original contents, move the main gnome-keyring-daemon executable to
some other name like gnome-keyring-daemon.real, and create an executable
shell script at /usr/local/bin/gnome-keyring-daemon that runs valgrind
(or any other non-interactive debugging tool of your choice) on
/usr/local/bin/gnome-keyring-daemon.real.

Alternatively, you can use something like

Exec=/bin/bash -c 'exec /usr/local/bin/valgrind ... &>> /tmp/valgrind-gnome-keyring-daemon'

If you're using systemd, note that some D-Bus services might be launched
as systemd services instead of being run by the dbus-daemon. If you have
used the first method that I recommended, it will work equally well for
systemd, but if you have changed the Exec command, you might also have to
change the ExecStart command in a corresponding systemd unit.

A third option is to run gnome-keyring-daemon yourself, from an
interactive shell, wrapped in an appropriate debugger.

    smcv

[1] some desktop environments do use a shell to parse the Exec command for
    .desktop files, but this is not portable; GNOME and its derivatives
    like MATE and Cinnamon are common examples of desktop environments
    that don't use a shell for this


More information about the dbus mailing list