lib_LTLIBRARIES = libweston-@LIBWESTON_MAJOR@.la
libweston_@LIBWESTON_MAJOR@_la_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON
libweston_@LIBWESTON_MAJOR@_la_CFLAGS = $(AM_CFLAGS) \
- $(COMPOSITOR_CFLAGS) $(EGL_CFLAGS) $(LIBUNWIND_CFLAGS) $(LIBDRM_CFLAGS)
-libweston_@LIBWESTON_MAJOR@_la_LIBADD = $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \
+ $(COMPOSITOR_CFLAGS) $(EGL_CFLAGS) $(LIBDRM_CFLAGS)
+libweston_@LIBWESTON_MAJOR@_la_LIBADD = $(COMPOSITOR_LIBS) \
$(DL_LIBS) -lm $(CLOCK_GETTIME_LIBS) \
$(LIBINPUT_BACKEND_LIBS) libshared.la
libweston_@LIBWESTON_MAJOR@_la_LDFLAGS = -version-info $(LT_VERSION_INFO)
weston_CPPFLAGS = $(AM_CPPFLAGS) -DIN_WESTON \
-DMODULEDIR='"$(moduledir)"' \
-DXSERVER_PATH='"@XSERVER_PATH@"'
-weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS) $(LIBUNWIND_CFLAGS)
+weston_CFLAGS = $(AM_CFLAGS) $(COMPOSITOR_CFLAGS)
weston_LDADD = libshared.la libweston-@LIBWESTON_MAJOR@.la \
- $(COMPOSITOR_LIBS) $(LIBUNWIND_LIBS) \
+ $(COMPOSITOR_LIBS) \
$(DL_LIBS) $(LIBINPUT_BACKEND_LIBS) \
$(CLOCK_GETRES_LIBS) \
-lm
#include <sys/time.h>
#include <linux/limits.h>
-#ifdef HAVE_LIBUNWIND
-#define UNW_LOCAL_ONLY
-#include <libunwind.h>
-#endif
-
#include "weston.h"
#include "compositor.h"
#include "../shared/os-compatibility.h"
return 1;
}
-#ifdef HAVE_LIBUNWIND
-
-static void
-print_backtrace(void)
-{
- unw_cursor_t cursor;
- unw_context_t context;
- unw_word_t off;
- unw_proc_info_t pip;
- int ret, i = 0;
- char procname[256];
- const char *filename;
- Dl_info dlinfo;
-
- pip.unwind_info = NULL;
- ret = unw_getcontext(&context);
- if (ret) {
- weston_log("unw_getcontext: %d\n", ret);
- return;
- }
-
- ret = unw_init_local(&cursor, &context);
- if (ret) {
- weston_log("unw_init_local: %d\n", ret);
- return;
- }
-
- ret = unw_step(&cursor);
- while (ret > 0) {
- ret = unw_get_proc_info(&cursor, &pip);
- if (ret) {
- weston_log("unw_get_proc_info: %d\n", ret);
- break;
- }
-
- ret = unw_get_proc_name(&cursor, procname, 256, &off);
- if (ret && ret != -UNW_ENOMEM) {
- if (ret != -UNW_EUNSPEC)
- weston_log("unw_get_proc_name: %d\n", ret);
- procname[0] = '?';
- procname[1] = 0;
- }
-
- if (dladdr((void *)(pip.start_ip + off), &dlinfo) && dlinfo.dli_fname &&
- *dlinfo.dli_fname)
- filename = dlinfo.dli_fname;
- else
- filename = "?";
-
- weston_log("%u: %s (%s%s+0x%x) [%p]\n", i++, filename, procname,
- ret == -UNW_ENOMEM ? "..." : "", (int)off, (void *)(pip.start_ip + off));
-
- ret = unw_step(&cursor);
- if (ret < 0)
- weston_log("unw_step: %d\n", ret);
- }
-}
-
-#else
-
-static void
-print_backtrace(void)
-{
- void *buffer[32];
- int i, count;
- Dl_info info;
-
- count = backtrace(buffer, ARRAY_LENGTH(buffer));
- for (i = 0; i < count; i++) {
- dladdr(buffer[i], &info);
- weston_log(" [%016lx] %s (%s)\n",
- (long) buffer[i],
- info.dli_sname ? info.dli_sname : "--",
- info.dli_fname);
- }
-}
-
-#endif
-
static void
child_client_exec(int sockfd, const char *path)
{
return 1;
}
-static void
-on_caught_signal(int s, siginfo_t *siginfo, void *context)
-{
- /* This signal handler will do a best-effort backtrace, and
- * then call the backend restore function, which will switch
- * back to the vt we launched from or ungrab X etc and then
- * raise SIGTRAP. If we run weston under gdb from X or a
- * different vt, and tell gdb "handle *s* nostop", this
- * will allow weston to switch back to gdb on crash and then
- * gdb will catch the crash with SIGTRAP.*/
-
- weston_log("caught signal: %d\n", s);
-
- print_backtrace();
-
- if (segv_compositor && segv_compositor->backend)
- segv_compositor->backend->restore(segv_compositor);
-
- raise(SIGTRAP);
-}
-
-static void
-catch_signals(void)
-{
- struct sigaction action;
-
- action.sa_flags = SA_SIGINFO | SA_RESETHAND;
- action.sa_sigaction = on_caught_signal;
- sigemptyset(&action.sa_mask);
- sigaction(SIGSEGV, &action, NULL);
- sigaction(SIGABRT, &action, NULL);
-}
-
static const char *
clock_name(clockid_t clk_id)
{
weston_log_set_handler(vlog, vlog_continue);
weston_log_file_open(log);
- catch_signals();
-
weston_log("%s\n"
STAMP_SPACE "%s\n"
STAMP_SPACE "Bug reports to: %s\n"
fi
AC_SUBST(GCC_CFLAGS)
-AC_ARG_ENABLE(libunwind,
- AS_HELP_STRING([--disable-libunwind],
- [Disable libunwind usage for backtraces]),,
- enable_libunwind=auto)
-AM_CONDITIONAL(HAVE_LIBUNWIND, [test "x$enable_libunwind" = xyes])
-have_libunwind=no
-if test "x$enable_libunwind" != "xno"; then
- PKG_CHECK_MODULES(LIBUNWIND,
- libunwind,
- have_libunwind=yes,
- have_libunwind=no)
- if test "x$have_libunwind" = "xno" -a "x$enable_libunwind" = "xyes"; then
- AC_MSG_ERROR([libunwind support explicitly requested, but libunwind couldn't be found])
- fi
- if test "x$have_libunwind" = "xyes"; then
- enable_libunwind=yes
- AC_DEFINE(HAVE_LIBUNWIND, 1, [Have libunwind support])
- fi
-fi
-
if test "x$WESTON_NATIVE_BACKEND" = "x"; then
WESTON_NATIVE_BACKEND="drm-backend.so"
Wayland clients will automatically use this.
.
.\" ***************************************************************
-.SH DIAGNOSTICS
-Weston has a segmentation fault handler, that attempts to restore
-the virtual console or ungrab X before raising
-.BR SIGTRAP .
-If you run
-.BR weston " under " gdb (1)
-from an X11 terminal or a different virtual terminal, and tell gdb
-.IP
-handle SIGSEGV nostop
-.PP
-This will allow weston to switch back to gdb on crash and then
-gdb will catch the crash with SIGTRAP.
-.
-.\" ***************************************************************
.SH BUGS
Bugs should be reported to the freedesktop.org bugzilla at
https://bugs.freedesktop.org with product "Wayland" and