mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 16:42:26 +00:00
xcb errors: optional dependency with improved messages
Now message can look like: [xwayland/xwm.c:991] xcb error: op ChangeProperty (no minor), code Window (no extension), value 6291465 instead of this one when the lib is not available: [xwayland/xwm.c:999] xcb error: op 18:0, code 3, sequence 103, value 6291465 The value in case of Window is the window id, so we can tell what function applied on which window which is a good start. The sequence ought to be able to tell us more precisely which invocation it was, but we never log it when calling functions so is useless in practice and no longer logged.
This commit is contained in:
parent
2a9ba5c8dc
commit
f8428d1063
15
meson.build
15
meson.build
@ -64,6 +64,7 @@ xcb_xfixes = dependency('xcb-xfixes')
|
|||||||
xcb_image = dependency('xcb-image')
|
xcb_image = dependency('xcb-image')
|
||||||
xcb_render = dependency('xcb-render')
|
xcb_render = dependency('xcb-render')
|
||||||
xcb_icccm = dependency('xcb-icccm', required: false)
|
xcb_icccm = dependency('xcb-icccm', required: false)
|
||||||
|
xcb_errors = dependency('xcb-errors', required: get_option('enable_xcb_errors') == 'true')
|
||||||
x11_xcb = dependency('x11-xcb')
|
x11_xcb = dependency('x11-xcb')
|
||||||
libcap = dependency('libcap', required: get_option('enable_libcap') == 'true')
|
libcap = dependency('libcap', required: get_option('enable_libcap') == 'true')
|
||||||
systemd = dependency('libsystemd', required: get_option('enable_systemd') == 'true')
|
systemd = dependency('libsystemd', required: get_option('enable_systemd') == 'true')
|
||||||
@ -78,6 +79,10 @@ if xcb_icccm.found()
|
|||||||
conf_data.set('WLR_HAS_XCB_ICCCM', true)
|
conf_data.set('WLR_HAS_XCB_ICCCM', true)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if xcb_errors.found() and get_option('enable_xcb_errors') != 'false'
|
||||||
|
conf_data.set('WLR_HAS_XCB_ERRORS', true)
|
||||||
|
endif
|
||||||
|
|
||||||
if libcap.found() and get_option('enable_libcap') != 'false'
|
if libcap.found() and get_option('enable_libcap') != 'false'
|
||||||
conf_data.set('WLR_HAS_LIBCAP', true)
|
conf_data.set('WLR_HAS_LIBCAP', true)
|
||||||
wlr_deps += libcap
|
wlr_deps += libcap
|
||||||
@ -164,10 +169,12 @@ summary = [
|
|||||||
'----------------',
|
'----------------',
|
||||||
'wlroots @0@'.format(meson.project_version()),
|
'wlroots @0@'.format(meson.project_version()),
|
||||||
'',
|
'',
|
||||||
' libcap: @0@'.format(conf_data.get('WLR_HAS_LIBCAP', false)),
|
' libcap: @0@'.format(conf_data.get('WLR_HAS_LIBCAP', false)),
|
||||||
' systemd: @0@'.format(conf_data.get('WLR_HAS_SYSTEMD', false)),
|
' systemd: @0@'.format(conf_data.get('WLR_HAS_SYSTEMD', false)),
|
||||||
' elogind: @0@'.format(conf_data.get('WLR_HAS_ELOGIND', false)),
|
' elogind: @0@'.format(conf_data.get('WLR_HAS_ELOGIND', false)),
|
||||||
' xwayland: @0@'.format(conf_data.get('WLR_HAS_XWAYLAND', false)),
|
' xwayland: @0@'.format(conf_data.get('WLR_HAS_XWAYLAND', false)),
|
||||||
|
' xcb-icccm: @0@'.format(conf_data.get('WLR_HAS_XCB_ICCCM', false)),
|
||||||
|
' xcb-errors: @0@'.format(conf_data.get('WLR_HAS_XCB_ERRORS', false)),
|
||||||
'----------------',
|
'----------------',
|
||||||
''
|
''
|
||||||
]
|
]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
option('enable_libcap', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for capabilities')
|
option('enable_libcap', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for capabilities')
|
||||||
option('enable_systemd', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
|
option('enable_systemd', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
|
||||||
option('enable_elogind', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
|
option('enable_elogind', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Enable support for logind')
|
||||||
|
option('enable_xcb_errors', type: 'combo', choices: ['auto', 'true', 'false'], value: 'auto', description: 'Use xcb-errors util library')
|
||||||
option('enable_xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications')
|
option('enable_xwayland', type: 'boolean', value: true, description: 'Enable support X11 applications')
|
||||||
|
@ -15,6 +15,7 @@ lib_wlr_xwayland = static_library(
|
|||||||
xcb_image,
|
xcb_image,
|
||||||
xcb_render,
|
xcb_render,
|
||||||
xcb_icccm,
|
xcb_icccm,
|
||||||
|
xcb_errors,
|
||||||
xkbcommon,
|
xkbcommon,
|
||||||
pixman,
|
pixman,
|
||||||
],
|
],
|
||||||
|
@ -19,6 +19,9 @@
|
|||||||
#ifdef WLR_HAS_XCB_ICCCM
|
#ifdef WLR_HAS_XCB_ICCCM
|
||||||
#include <xcb/xcb_icccm.h>
|
#include <xcb/xcb_icccm.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef WLR_HAS_XCB_ERRORS
|
||||||
|
#include <xcb/xcb_errors.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
const char *atom_map[ATOM_LAST] = {
|
const char *atom_map[ATOM_LAST] = {
|
||||||
"WL_SURFACE_ID",
|
"WL_SURFACE_ID",
|
||||||
@ -955,9 +958,47 @@ static void xwm_handle_focus_in(struct wlr_xwm *xwm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
static void xwm_handle_xcb_error(struct wlr_xwm *xwm, xcb_value_error_t *ev) {
|
||||||
wlr_log(L_ERROR, "xcb error: code %d, sequence %d, value %d, opcode %d:%d",
|
#ifdef WLR_HAS_XCB_ERRORS
|
||||||
ev->error_code, ev->sequence, ev->bad_value,
|
xcb_errors_context_t *err_ctx;
|
||||||
ev->minor_opcode, ev->major_opcode);
|
if (xcb_errors_context_new(xwm->xcb_conn, &err_ctx)) {
|
||||||
|
wlr_log(L_DEBUG, "xcb error happened, but could not allocate error context");
|
||||||
|
goto log_raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *major_name;
|
||||||
|
major_name = xcb_errors_get_name_for_major_code(err_ctx, ev->major_opcode);
|
||||||
|
if (!major_name) {
|
||||||
|
wlr_log(L_DEBUG, "xcb error happened, but could not get major name");
|
||||||
|
xcb_errors_context_free(err_ctx);
|
||||||
|
goto log_raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *minor_name;
|
||||||
|
minor_name = xcb_errors_get_name_for_minor_code(err_ctx,
|
||||||
|
ev->major_opcode, ev->minor_opcode);
|
||||||
|
|
||||||
|
const char *error_name, *extension;
|
||||||
|
error_name = xcb_errors_get_name_for_error(err_ctx, ev->error_code, &extension);
|
||||||
|
if (!error_name) {
|
||||||
|
wlr_log(L_DEBUG, "xcb error happened, but could not get error name");
|
||||||
|
xcb_errors_context_free(err_ctx);
|
||||||
|
goto log_raw;
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_log(L_ERROR, "xcb error: op %s (%s), code %s (%s), value %"PRIu32,
|
||||||
|
major_name, minor_name ? minor_name : "no minor",
|
||||||
|
error_name, extension ? extension : "no extension",
|
||||||
|
ev->bad_value);
|
||||||
|
|
||||||
|
xcb_errors_context_free(err_ctx);
|
||||||
|
return;
|
||||||
|
log_raw:
|
||||||
|
#endif
|
||||||
|
wlr_log(L_ERROR,
|
||||||
|
"xcb error: op %"PRIu8":%"PRIu16", code %"PRIu8", sequence %"PRIu16", value %"PRIu32,
|
||||||
|
ev->major_opcode, ev->minor_opcode, ev->error_code,
|
||||||
|
ev->sequence, ev->bad_value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is in xcb/xcb_event.h, but pulling xcb-util just for a constant
|
/* This is in xcb/xcb_event.h, but pulling xcb-util just for a constant
|
||||||
|
Loading…
Reference in New Issue
Block a user