compositor: Use a minimal restore handler for crash clean up
authorKristian Høgsberg <krh@bitplanet.net>
Tue, 31 Jul 2012 18:32:01 +0000 (14:32 -0400)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 31 Jul 2012 18:32:01 +0000 (14:32 -0400)
commit7b884bc0de533450d4e7b29609db0fd7261046d2
tree60f2f7933f70198248db5c757fe78f4818a7f65e
parent023be102d7255118d6d7022a93823110a3a0a4c0
compositor: Use a minimal restore handler for crash clean up

When we hit a segv, it's often the case that we might crash again in
the attempt to clean up.  Instead we introduce a minimal restore callback
in the backend abstraction, that shuts down as simply as possible.  Then
we can call that from the segv handler, and then to aid debugging, we
raise SIGTRAP in the segv handler.  This lets us run gdb on weston from
a different vt, and if we tell gdb

  (gdb) handle SIGSEGV nostop

gdb won't stop when the segv happens but let weston clean up and switch vt,
and then stop when SIGTRAP is raised.

It's also possible to just let gdb catch the segv, and then use sysrq+k
followed by manual vt switch to get back.
src/compositor-drm.c
src/compositor-wayland.c
src/compositor-x11.c
src/compositor.c
src/compositor.h
src/tty.c