/* * An instance of this structure is created in a special * ELF section at every dynamic debug callsite. At runtime, * the special section is treated as an array of these.
*/ struct _ddebug { /* * These fields are used to drive the user interface * for selecting and displaying debug callsites.
*/ constchar *modname; constchar *function; constchar *filename; constchar *format; unsignedint lineno:18; #define CLS_BITS 6 unsignedint class_id:CLS_BITS; #define _DPRINTK_CLASS_DFLT ((1 << CLS_BITS) - 1) /* * The flags field controls the behaviour at the callsite. * The bits here are changed dynamically when the user * writes commands to <debugfs>/dynamic_debug/control
*/ #define _DPRINTK_FLAGS_NONE 0 #define _DPRINTK_FLAGS_PRINT (1<<0) /* printk() a message using the format */ #define _DPRINTK_FLAGS_INCL_MODNAME (1<<1) #define _DPRINTK_FLAGS_INCL_FUNCNAME (1<<2) #define _DPRINTK_FLAGS_INCL_LINENO (1<<3) #define _DPRINTK_FLAGS_INCL_TID (1<<4) #define _DPRINTK_FLAGS_INCL_SOURCENAME (1<<5)
enum class_map_type {
DD_CLASS_TYPE_DISJOINT_BITS, /** * DD_CLASS_TYPE_DISJOINT_BITS: classes are independent, one per bit. * expecting hex input. Built for drm.debug, basis for other types.
*/
DD_CLASS_TYPE_LEVEL_NUM, /** * DD_CLASS_TYPE_LEVEL_NUM: input is numeric level, 0-N. * N turns on just bits N-1 .. 0, so N=0 turns all bits off.
*/
DD_CLASS_TYPE_DISJOINT_NAMES, /** * DD_CLASS_TYPE_DISJOINT_NAMES: input is a CSV of [+-]CLASS_NAMES, * classes are independent, like _DISJOINT_BITS.
*/
DD_CLASS_TYPE_LEVEL_NAMES, /** * DD_CLASS_TYPE_LEVEL_NAMES: input is a CSV of [+-]CLASS_NAMES, * intended for names like: INFO,DEBUG,TRACE, with a module prefix * avoid EMERG,ALERT,CRIT,ERR,WARNING: they're not debug
*/
};
struct ddebug_class_map { struct list_head link; struct module *mod; constchar *mod_name; /* needed for builtins */ constchar **class_names; constint length; constint base; /* index of 1st .class_id, allows split/shared space */ enum class_map_type map_type;
};
/** * DECLARE_DYNDBG_CLASSMAP - declare classnames known by a module * @_var: a struct ddebug_class_map, passed to module_param_cb * @_type: enum class_map_type, chooses bits/verbose, numeric/symbolic * @_base: offset of 1st class-name. splits .class_id space * @classes: class-names used to control class'd prdbgs
*/ #define DECLARE_DYNDBG_CLASSMAP(_var, _maptype, _base, ...) \ staticconstchar *_var##_classnames[] = { __VA_ARGS__ }; \ staticstruct ddebug_class_map __aligned(8) __used \
__section("__dyndbg_classes") _var = { \
.mod = THIS_MODULE, \
.mod_name = KBUILD_MODNAME, \
.base = _base, \
.map_type = _maptype, \
.length = NUM_TYPE_ARGS(char*, __VA_ARGS__), \
.class_names = _var##_classnames, \
} #define NUM_TYPE_ARGS(eltype, ...) \
(sizeof((eltype[]){__VA_ARGS__}) / sizeof(eltype))
/* * "Factory macro" for generating a call to func, guarded by a * DYNAMIC_DEBUG_BRANCH. The dynamic debug descriptor will be * initialized using the fmt argument. The function will be called with * the address of the descriptor as first argument, followed by all * the varargs. Note that fmt is repeated in invocations of this * macro.
*/ #define _dynamic_func_call_cls(cls, fmt, func, ...) \
__dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__) #define _dynamic_func_call(fmt, func, ...) \
_dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
/* * A variant that does the same, except that the descriptor is not * passed as the first argument to the function; it is only called * with precisely the macro's varargs.
*/ #define _dynamic_func_call_cls_no_desc(cls, fmt, func, ...) \
__dynamic_func_call_cls_no_desc(__UNIQUE_ID(ddebug), cls, fmt, \
func, ##__VA_ARGS__) #define _dynamic_func_call_no_desc(fmt, func, ...) \
_dynamic_func_call_cls_no_desc(_DPRINTK_CLASS_DFLT, fmt, \
func, ##__VA_ARGS__)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.