I posted this a while back, it comes from the Window maker people. One note, launch X via startx, switch back to a console and login again. Run gdb from there and not within X.
ulimit -c unlimited in bash will also let crashing apps leave core files which you can then track down.
debug_a_wm
Description: debug_a_wm
