Not a complete answer, just a thought:
you may attach to a working process using gdb -p <processId> /path/to/executable/being/debugged
. Or just use strace -p <pid>
.
BTW Right now I'm doing this for LibreOffice with KDE4 dialogs plugin hanging on startup (somewhere in libSM interaction) :) A typical race condition, because it works perfectly being run under gdb from start