Debugging Akonadi Agents
Agents are automatically started by the Akonadi server and thus are not debugable from the start on by the usual methods. A similar problem is known from KIO slaves, the solution is similar as well.
Attaching gdb at startup
Export the environment variable AKONADI_DEBUG_WAIT and put the agent type in there you want to debug. You only need to specify a part of the agent type, not the whole one. Example:
When starting an agent of this type, you'll see the following debug output by the Akonadi server which is pretty much self-explanatory.
============================================================ ProcessControl: Suspending process akonadi_knut_resouce 'gdb -pid 1234' to debug 'kill -SIGCONT 1234' to continue ============================================================
Running an agent in valgrind
Running an agent in valgrind is done in a similar way, you need to export AKONADI_VALGRIND and put the agent type in there.
Additionally, you can specifiy the valgrind tool to use by exporting AKONADI_VALGRIND_SKIN, the default is memcheck.