meson: add option for debugging udev

This commit is contained in:
Yu Watanabe 2018-11-23 00:28:27 +09:00
parent 67e4b38563
commit 20e97dd3de
3 changed files with 8 additions and 3 deletions

View file

@ -782,17 +782,21 @@ substs.set('DEBUGTTY', get_option('debug-tty'))
enable_debug_hashmap = false enable_debug_hashmap = false
enable_debug_mmap_cache = false enable_debug_mmap_cache = false
enable_debug_udev = false
foreach name : get_option('debug-extra') foreach name : get_option('debug-extra')
if name == 'hashmap' if name == 'hashmap'
enable_debug_hashmap = true enable_debug_hashmap = true
elif name == 'mmap-cache' elif name == 'mmap-cache'
enable_debug_mmap_cache = true enable_debug_mmap_cache = true
elif name == 'udev'
enable_debug_udev = true
else else
message('unknown debug option "@0@", ignoring'.format(name)) message('unknown debug option "@0@", ignoring'.format(name))
endif endif
endforeach endforeach
conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap) conf.set10('ENABLE_DEBUG_HASHMAP', enable_debug_hashmap)
conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache) conf.set10('ENABLE_DEBUG_MMAP_CACHE', enable_debug_mmap_cache)
conf.set10('ENABLE_DEBUG_UDEV', enable_debug_udev)
conf.set10('VALGRIND', get_option('valgrind')) conf.set10('VALGRIND', get_option('valgrind'))
conf.set10('LOG_TRACE', get_option('log-trace')) conf.set10('LOG_TRACE', get_option('log-trace'))
@ -3128,6 +3132,7 @@ foreach tuple : [
['gshadow'], ['gshadow'],
['debug hashmap'], ['debug hashmap'],
['debug mmap cache'], ['debug mmap cache'],
['debug udev'],
['valgrind', conf.get('VALGRIND') == 1], ['valgrind', conf.get('VALGRIND') == 1],
['trace logging', conf.get('LOG_TRACE') == 1], ['trace logging', conf.get('LOG_TRACE') == 1],
['link-udev-shared', get_option('link-udev-shared')], ['link-udev-shared', get_option('link-udev-shared')],

View file

@ -45,7 +45,7 @@ option('debug-shell', type : 'string', value : '/bin/sh',
description : 'path to debug shell binary') description : 'path to debug shell binary')
option('debug-tty', type : 'string', value : '/dev/tty9', option('debug-tty', type : 'string', value : '/dev/tty9',
description : 'specify the tty device for debug shell') description : 'specify the tty device for debug shell')
option('debug-extra', type : 'array', choices : ['hashmap', 'mmap-cache'], value : [], option('debug-extra', type : 'array', choices : ['hashmap', 'mmap-cache', 'udev'], value : [],
description : 'enable extra debugging') description : 'enable extra debugging')
option('memory-accounting-default', type : 'boolean', option('memory-accounting-default', type : 'boolean',
description : 'enable MemoryAccounting= by default') description : 'enable MemoryAccounting= by default')

View file

@ -221,7 +221,7 @@ struct rule_tmp {
unsigned token_cur; unsigned token_cur;
}; };
#ifdef DEBUG #if ENABLE_DEBUG_UDEV
static const char *operation_str(enum operation_type type) { static const char *operation_str(enum operation_type type) {
static const char *operation_strs[] = { static const char *operation_strs[] = {
[OP_UNSET] = "UNSET", [OP_UNSET] = "UNSET",
@ -442,7 +442,7 @@ static void dump_rules(struct udev_rules *rules) {
#else #else
static inline void dump_token(struct udev_rules *rules, struct token *token) {} static inline void dump_token(struct udev_rules *rules, struct token *token) {}
static inline void dump_rules(struct udev_rules *rules) {} static inline void dump_rules(struct udev_rules *rules) {}
#endif /* DEBUG */ #endif /* ENABLE_DEBUG_UDEV */
static int add_token(struct udev_rules *rules, struct token *token) { static int add_token(struct udev_rules *rules, struct token *token) {
/* grow buffer if needed */ /* grow buffer if needed */