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.
diff --git a/src/compositor.h b/src/compositor.h
index 22c0174..7112796 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -335,6 +335,7 @@
int has_bind_display;
void (*destroy)(struct weston_compositor *ec);
+ void (*restore)(struct weston_compositor *ec);
int (*authenticate)(struct weston_compositor *c, uint32_t id);
void (*ping_handler)(struct weston_surface *surface, uint32_t serial);
@@ -702,6 +703,9 @@
void
tty_destroy(struct tty *tty);
+void
+tty_reset(struct tty *tty);
+
int
tty_activate_vt(struct tty *tty, int vt);