| .. | .. |
|---|
| 13 | 13 | ``print_hex_dump_debug()``/``print_hex_dump_bytes()`` calls can be dynamically |
|---|
| 14 | 14 | enabled per-callsite. |
|---|
| 15 | 15 | |
|---|
| 16 | +If you do not want to enable dynamic debug globally (i.e. in some embedded |
|---|
| 17 | +system), you may set ``CONFIG_DYNAMIC_DEBUG_CORE`` as basic support of dynamic |
|---|
| 18 | +debug and add ``ccflags := -DDYNAMIC_DEBUG_MODULE`` into the Makefile of any |
|---|
| 19 | +modules which you'd like to dynamically debug later. |
|---|
| 20 | + |
|---|
| 16 | 21 | If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is just |
|---|
| 17 | 22 | shortcut for ``print_hex_dump(KERN_DEBUG)``. |
|---|
| 18 | 23 | |
|---|
| .. | .. |
|---|
| 65 | 70 | |
|---|
| 66 | 71 | nullarbor:~ # cat <debugfs>/dynamic_debug/control |
|---|
| 67 | 72 | # filename:lineno [module]function flags format |
|---|
| 68 | | - /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012" |
|---|
| 69 | | - /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012" |
|---|
| 70 | | - /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012" |
|---|
| 71 | | - /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012" |
|---|
| 73 | + net/sunrpc/svc_rdma.c:323 [svcxprt_rdma]svc_rdma_cleanup =_ "SVCRDMA Module Removed, deregister RPC RDMA transport\012" |
|---|
| 74 | + net/sunrpc/svc_rdma.c:341 [svcxprt_rdma]svc_rdma_init =_ "\011max_inline : %d\012" |
|---|
| 75 | + net/sunrpc/svc_rdma.c:340 [svcxprt_rdma]svc_rdma_init =_ "\011sq_depth : %d\012" |
|---|
| 76 | + net/sunrpc/svc_rdma.c:338 [svcxprt_rdma]svc_rdma_init =_ "\011max_requests : %d\012" |
|---|
| 72 | 77 | ... |
|---|
| 73 | 78 | |
|---|
| 74 | 79 | |
|---|
| .. | .. |
|---|
| 88 | 93 | |
|---|
| 89 | 94 | nullarbor:~ # awk '$3 != "=_"' <debugfs>/dynamic_debug/control |
|---|
| 90 | 95 | # filename:lineno [module]function flags format |
|---|
| 91 | | - /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012" |
|---|
| 96 | + net/sunrpc/svcsock.c:1603 [sunrpc]svc_send p "svc_process: st_sendto returned %d\012" |
|---|
| 92 | 97 | |
|---|
| 93 | 98 | Command Language Reference |
|---|
| 94 | 99 | ========================== |
|---|
| .. | .. |
|---|
| 113 | 118 | |
|---|
| 114 | 119 | ~# cat query-batch-file > <debugfs>/dynamic_debug/control |
|---|
| 115 | 120 | |
|---|
| 116 | | -A another way is to use wildcard. The match rule support ``*`` (matches |
|---|
| 117 | | -zero or more characters) and ``?`` (matches exactly one character).For |
|---|
| 121 | +Another way is to use wildcards. The match rule supports ``*`` (matches |
|---|
| 122 | +zero or more characters) and ``?`` (matches exactly one character). For |
|---|
| 118 | 123 | example, you can match all usb drivers:: |
|---|
| 119 | 124 | |
|---|
| 120 | 125 | ~# echo "file drivers/usb/* +p" > <debugfs>/dynamic_debug/control |
|---|
| .. | .. |
|---|
| 159 | 164 | of each callsite. Example:: |
|---|
| 160 | 165 | |
|---|
| 161 | 166 | func svc_tcp_accept |
|---|
| 167 | + func *recv* # in rfcomm, bluetooth, ping, tcp |
|---|
| 162 | 168 | |
|---|
| 163 | 169 | file |
|---|
| 164 | | - The given string is compared against either the full pathname, the |
|---|
| 165 | | - src-root relative pathname, or the basename of the source file of |
|---|
| 166 | | - each callsite. Examples:: |
|---|
| 170 | + The given string is compared against either the src-root relative |
|---|
| 171 | + pathname, or the basename of the source file of each callsite. |
|---|
| 172 | + Examples:: |
|---|
| 167 | 173 | |
|---|
| 168 | 174 | file svcsock.c |
|---|
| 169 | | - file kernel/freezer.c |
|---|
| 170 | | - file /usr/src/packages/BUILD/sgi-enhancednfs-1.4/default/net/sunrpc/svcsock.c |
|---|
| 175 | + file kernel/freezer.c # ie column 1 of control file |
|---|
| 176 | + file drivers/usb/* # all callsites under it |
|---|
| 177 | + file inode.c:start_* # parse :tail as a func (above) |
|---|
| 178 | + file inode.c:1-100 # parse :tail as a line-range (above) |
|---|
| 171 | 179 | |
|---|
| 172 | 180 | module |
|---|
| 173 | 181 | The given string is compared against the module name |
|---|
| .. | .. |
|---|
| 177 | 185 | |
|---|
| 178 | 186 | module sunrpc |
|---|
| 179 | 187 | module nfsd |
|---|
| 188 | + module drm* # both drm, drm_kms_helper |
|---|
| 180 | 189 | |
|---|
| 181 | 190 | format |
|---|
| 182 | 191 | The given string is searched for in the dynamic debug format |
|---|
| .. | .. |
|---|
| 246 | 255 | bootloader may impose lower limits. |
|---|
| 247 | 256 | |
|---|
| 248 | 257 | These ``dyndbg`` params are processed just after the ddebug tables are |
|---|
| 249 | | -processed, as part of the arch_initcall. Thus you can enable debug |
|---|
| 250 | | -messages in all code run after this arch_initcall via this boot |
|---|
| 258 | +processed, as part of the early_initcall. Thus you can enable debug |
|---|
| 259 | +messages in all code run after this early_initcall via this boot |
|---|
| 251 | 260 | parameter. |
|---|
| 252 | 261 | |
|---|
| 253 | 262 | On an x86 system for example ACPI enablement is a subsys_initcall and:: |
|---|
| .. | .. |
|---|
| 261 | 270 | |
|---|
| 262 | 271 | If ``foo`` module is not built-in, ``foo.dyndbg`` will still be processed at |
|---|
| 263 | 272 | boot time, without effect, but will be reprocessed when module is |
|---|
| 264 | | -loaded later. ``dyndbg_query=`` and bare ``dyndbg=`` are only processed at |
|---|
| 273 | +loaded later. ``ddebug_query=`` and bare ``dyndbg=`` are only processed at |
|---|
| 265 | 274 | boot. |
|---|
| 266 | 275 | |
|---|
| 267 | 276 | |
|---|
| .. | .. |
|---|
| 304 | 313 | |
|---|
| 305 | 314 | For ``CONFIG_DYNAMIC_DEBUG`` kernels, any settings given at boot-time (or |
|---|
| 306 | 315 | enabled by ``-DDEBUG`` flag during compilation) can be disabled later via |
|---|
| 307 | | -the sysfs interface if the debug messages are no longer needed:: |
|---|
| 316 | +the debugfs interface if the debug messages are no longer needed:: |
|---|
| 308 | 317 | |
|---|
| 309 | 318 | echo "module module_name -p" > <debugfs>/dynamic_debug/control |
|---|
| 310 | 319 | |
|---|