include/linux/dynamic_debug.h
Source file repositories/reference/linux-study-clean/include/linux/dynamic_debug.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/dynamic_debug.h- Extension
.h- Size
- 11510 bytes
- Lines
- 366
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/jump_label.hlinux/build_bug.hlinux/string.hlinux/errno.hlinux/printk.h
Detected Declarations
struct _ddebugstruct ddebug_class_mapstruct _ddebug_infostruct ddebug_class_paramstruct devicestruct net_devicestruct ib_devicestruct kernel_paramstruct kernel_paramenum class_map_typefunction __alignedfunction ddebug_dyndbg_module_param_cbfunction param_set_dyndbg_classesfunction param_get_dyndbg_classes
Annotated Snippet
struct _ddebug {
/*
* These fields are used to drive the user interface
* for selecting and displaying debug callsites.
*/
const char *modname;
const char *function;
const char *filename;
const char *format;
unsigned int lineno:18;
#define CLS_BITS 6
unsigned int 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)
#define _DPRINTK_FLAGS_INCL_STACK (1<<6)
#define _DPRINTK_FLAGS_INCL_ANY \
(_DPRINTK_FLAGS_INCL_MODNAME | _DPRINTK_FLAGS_INCL_FUNCNAME |\
_DPRINTK_FLAGS_INCL_LINENO | _DPRINTK_FLAGS_INCL_TID |\
_DPRINTK_FLAGS_INCL_SOURCENAME | _DPRINTK_FLAGS_INCL_STACK)
#if defined DEBUG
#define _DPRINTK_FLAGS_DEFAULT _DPRINTK_FLAGS_PRINT
#else
#define _DPRINTK_FLAGS_DEFAULT 0
#endif
unsigned int flags:8;
#ifdef CONFIG_JUMP_LABEL
union {
struct static_key_true dd_key_true;
struct static_key_false dd_key_false;
} key;
#endif
} __attribute__((aligned(8)));
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;
const char *mod_name; /* needed for builtins */
const char **class_names;
const int length;
const int 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, ...) \
static const char *_var##_classnames[] = { __VA_ARGS__ }; \
static struct ddebug_class_map __aligned(8) __used \
Annotation
- Immediate include surface: `linux/jump_label.h`, `linux/build_bug.h`, `linux/string.h`, `linux/errno.h`, `linux/printk.h`.
- Detected declarations: `struct _ddebug`, `struct ddebug_class_map`, `struct _ddebug_info`, `struct ddebug_class_param`, `struct device`, `struct net_device`, `struct ib_device`, `struct kernel_param`, `struct kernel_param`, `enum class_map_type`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.