~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/admin-guide/dynamic-debug-howto.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/admin-guide/dynamic-debug-howto.rst (Version linux-6.12-rc7) and /Documentation/admin-guide/dynamic-debug-howto.rst (Version linux-6.10.14)


  1 Dynamic debug                                       1 Dynamic debug
  2 +++++++++++++                                       2 +++++++++++++
  3                                                     3 
  4                                                     4 
  5 Introduction                                        5 Introduction
  6 ============                                        6 ============
  7                                                     7 
  8 Dynamic debug allows you to dynamically enable      8 Dynamic debug allows you to dynamically enable/disable kernel
  9 debug-print code to obtain additional kernel i      9 debug-print code to obtain additional kernel information.
 10                                                    10 
 11 If ``/proc/dynamic_debug/control`` exists, you     11 If ``/proc/dynamic_debug/control`` exists, your kernel has dynamic
 12 debug.  You'll need root access (sudo su) to u     12 debug.  You'll need root access (sudo su) to use this.
 13                                                    13 
 14 Dynamic debug provides:                            14 Dynamic debug provides:
 15                                                    15 
 16  * a Catalog of all *prdbgs* in your kernel.       16  * a Catalog of all *prdbgs* in your kernel.
 17    ``cat /proc/dynamic_debug/control`` to see      17    ``cat /proc/dynamic_debug/control`` to see them.
 18                                                    18 
 19  * a Simple query/command language to alter *p     19  * a Simple query/command language to alter *prdbgs* by selecting on
 20    any combination of 0 or 1 of:                   20    any combination of 0 or 1 of:
 21                                                    21 
 22    - source filename                               22    - source filename
 23    - function name                                 23    - function name
 24    - line number (including ranges of line num     24    - line number (including ranges of line numbers)
 25    - module name                                   25    - module name
 26    - format string                                 26    - format string
 27    - class name (as known/declared by each mod     27    - class name (as known/declared by each module)
 28                                                    28 
 29 NOTE: To actually get the debug-print output o << 
 30 need to adjust the kernel ``loglevel=``, or us << 
 31 Read about these kernel parameters in          << 
 32 Documentation/admin-guide/kernel-parameters.rs << 
 33                                                << 
 34 Viewing Dynamic Debug Behaviour                    29 Viewing Dynamic Debug Behaviour
 35 ===============================                    30 ===============================
 36                                                    31 
 37 You can view the currently configured behaviou     32 You can view the currently configured behaviour in the *prdbg* catalog::
 38                                                    33 
 39   :#> head -n7 /proc/dynamic_debug/control         34   :#> head -n7 /proc/dynamic_debug/control
 40   # filename:lineno [module]function flags for     35   # filename:lineno [module]function flags format
 41   init/main.c:1179 [main]initcall_blacklist =_     36   init/main.c:1179 [main]initcall_blacklist =_ "blacklisting initcall %s\012
 42   init/main.c:1218 [main]initcall_blacklisted      37   init/main.c:1218 [main]initcall_blacklisted =_ "initcall %s blacklisted\012"
 43   init/main.c:1424 [main]run_init_process =_ "     38   init/main.c:1424 [main]run_init_process =_ "  with arguments:\012"
 44   init/main.c:1426 [main]run_init_process =_ "     39   init/main.c:1426 [main]run_init_process =_ "    %s\012"
 45   init/main.c:1427 [main]run_init_process =_ "     40   init/main.c:1427 [main]run_init_process =_ "  with environment:\012"
 46   init/main.c:1429 [main]run_init_process =_ "     41   init/main.c:1429 [main]run_init_process =_ "    %s\012"
 47                                                    42 
 48 The 3rd space-delimited column shows the curre     43 The 3rd space-delimited column shows the current flags, preceded by
 49 a ``=`` for easy use with grep/cut. ``=p`` sho     44 a ``=`` for easy use with grep/cut. ``=p`` shows enabled callsites.
 50                                                    45 
 51 Controlling dynamic debug Behaviour                46 Controlling dynamic debug Behaviour
 52 ===================================                47 ===================================
 53                                                    48 
 54 The behaviour of *prdbg* sites are controlled      49 The behaviour of *prdbg* sites are controlled by writing
 55 query/commands to the control file.  Example::     50 query/commands to the control file.  Example::
 56                                                    51 
 57   # grease the interface                           52   # grease the interface
 58   :#> alias ddcmd='echo $* > /proc/dynamic_deb     53   :#> alias ddcmd='echo $* > /proc/dynamic_debug/control'
 59                                                    54 
 60   :#> ddcmd '-p; module main func run* +p'         55   :#> ddcmd '-p; module main func run* +p'
 61   :#> grep =p /proc/dynamic_debug/control          56   :#> grep =p /proc/dynamic_debug/control
 62   init/main.c:1424 [main]run_init_process =p "     57   init/main.c:1424 [main]run_init_process =p "  with arguments:\012"
 63   init/main.c:1426 [main]run_init_process =p "     58   init/main.c:1426 [main]run_init_process =p "    %s\012"
 64   init/main.c:1427 [main]run_init_process =p "     59   init/main.c:1427 [main]run_init_process =p "  with environment:\012"
 65   init/main.c:1429 [main]run_init_process =p "     60   init/main.c:1429 [main]run_init_process =p "    %s\012"
 66                                                    61 
 67 Error messages go to console/syslog::              62 Error messages go to console/syslog::
 68                                                    63 
 69   :#> ddcmd mode foo +p                            64   :#> ddcmd mode foo +p
 70   dyndbg: unknown keyword "mode"                   65   dyndbg: unknown keyword "mode"
 71   dyndbg: query parse failed                       66   dyndbg: query parse failed
 72   bash: echo: write error: Invalid argument        67   bash: echo: write error: Invalid argument
 73                                                    68 
 74 If debugfs is also enabled and mounted, ``dyna     69 If debugfs is also enabled and mounted, ``dynamic_debug/control`` is
 75 also under the mount-dir, typically ``/sys/ker     70 also under the mount-dir, typically ``/sys/kernel/debug/``.
 76                                                    71 
 77 Command Language Reference                         72 Command Language Reference
 78 ==========================                         73 ==========================
 79                                                    74 
 80 At the basic lexical level, a command is a seq     75 At the basic lexical level, a command is a sequence of words separated
 81 by spaces or tabs.  So these are all equivalen     76 by spaces or tabs.  So these are all equivalent::
 82                                                    77 
 83   :#> ddcmd file svcsock.c line 1603 +p            78   :#> ddcmd file svcsock.c line 1603 +p
 84   :#> ddcmd "file svcsock.c line 1603 +p"          79   :#> ddcmd "file svcsock.c line 1603 +p"
 85   :#> ddcmd '  file   svcsock.c     line  1603     80   :#> ddcmd '  file   svcsock.c     line  1603 +p  '
 86                                                    81 
 87 Command submissions are bounded by a write() s     82 Command submissions are bounded by a write() system call.
 88 Multiple commands can be written together, sep     83 Multiple commands can be written together, separated by ``;`` or ``\n``::
 89                                                    84 
 90   :#> ddcmd "func pnpacpi_get_resources +p; fu     85   :#> ddcmd "func pnpacpi_get_resources +p; func pnp_assign_mem +p"
 91   :#> ddcmd <<"EOC"                                86   :#> ddcmd <<"EOC"
 92   func pnpacpi_get_resources +p                    87   func pnpacpi_get_resources +p
 93   func pnp_assign_mem +p                           88   func pnp_assign_mem +p
 94   EOC                                              89   EOC
 95   :#> cat query-batch-file > /proc/dynamic_deb     90   :#> cat query-batch-file > /proc/dynamic_debug/control
 96                                                    91 
 97 You can also use wildcards in each query term.     92 You can also use wildcards in each query term. The match rule supports
 98 ``*`` (matches zero or more characters) and ``     93 ``*`` (matches zero or more characters) and ``?`` (matches exactly one
 99 character). For example, you can match all usb     94 character). For example, you can match all usb drivers::
100                                                    95 
101   :#> ddcmd file "drivers/usb/*" +p     # "" t     96   :#> ddcmd file "drivers/usb/*" +p     # "" to suppress shell expansion
102                                                    97 
103 Syntactically, a command is pairs of keyword v     98 Syntactically, a command is pairs of keyword values, followed by a
104 flags change or setting::                          99 flags change or setting::
105                                                   100 
106   command ::= match-spec* flags-spec              101   command ::= match-spec* flags-spec
107                                                   102 
108 The match-spec's select *prdbgs* from the cata    103 The match-spec's select *prdbgs* from the catalog, upon which to apply
109 the flags-spec, all constraints are ANDed toge    104 the flags-spec, all constraints are ANDed together.  An absent keyword
110 is the same as keyword "*".                       105 is the same as keyword "*".
111                                                   106 
112                                                   107 
113 A match specification is a keyword, which sele    108 A match specification is a keyword, which selects the attribute of
114 the callsite to be compared, and a value to co    109 the callsite to be compared, and a value to compare against.  Possible
115 keywords are:::                                   110 keywords are:::
116                                                   111 
117   match-spec ::= 'func' string |                  112   match-spec ::= 'func' string |
118                  'file' string |                  113                  'file' string |
119                  'module' string |                114                  'module' string |
120                  'format' string |                115                  'format' string |
121                  'class' string |                 116                  'class' string |
122                  'line' line-range                117                  'line' line-range
123                                                   118 
124   line-range ::= lineno |                         119   line-range ::= lineno |
125                  '-'lineno |                      120                  '-'lineno |
126                  lineno'-' |                      121                  lineno'-' |
127                  lineno'-'lineno                  122                  lineno'-'lineno
128                                                   123 
129   lineno ::= unsigned-int                         124   lineno ::= unsigned-int
130                                                   125 
131 .. note::                                         126 .. note::
132                                                   127 
133   ``line-range`` cannot contain space, e.g.       128   ``line-range`` cannot contain space, e.g.
134   "1-30" is valid range but "1 - 30" is not.      129   "1-30" is valid range but "1 - 30" is not.
135                                                   130 
136                                                   131 
137 The meanings of each keyword are:                 132 The meanings of each keyword are:
138                                                   133 
139 func                                              134 func
140     The given string is compared against the f    135     The given string is compared against the function name
141     of each callsite.  Example::                  136     of each callsite.  Example::
142                                                   137 
143         func svc_tcp_accept                       138         func svc_tcp_accept
144         func *recv*             # in rfcomm, b    139         func *recv*             # in rfcomm, bluetooth, ping, tcp
145                                                   140 
146 file                                              141 file
147     The given string is compared against eithe    142     The given string is compared against either the src-root relative
148     pathname, or the basename of the source fi    143     pathname, or the basename of the source file of each callsite.
149     Examples::                                    144     Examples::
150                                                   145 
151         file svcsock.c                            146         file svcsock.c
152         file kernel/freezer.c   # ie column 1     147         file kernel/freezer.c   # ie column 1 of control file
153         file drivers/usb/*      # all callsite    148         file drivers/usb/*      # all callsites under it
154         file inode.c:start_*    # parse :tail     149         file inode.c:start_*    # parse :tail as a func (above)
155         file inode.c:1-100      # parse :tail     150         file inode.c:1-100      # parse :tail as a line-range (above)
156                                                   151 
157 module                                            152 module
158     The given string is compared against the m    153     The given string is compared against the module name
159     of each callsite.  The module name is the     154     of each callsite.  The module name is the string as
160     seen in ``lsmod``, i.e. without the direct    155     seen in ``lsmod``, i.e. without the directory or the ``.ko``
161     suffix and with ``-`` changed to ``_``.  E    156     suffix and with ``-`` changed to ``_``.  Examples::
162                                                   157 
163         module sunrpc                             158         module sunrpc
164         module nfsd                               159         module nfsd
165         module drm*     # both drm, drm_kms_he    160         module drm*     # both drm, drm_kms_helper
166                                                   161 
167 format                                            162 format
168     The given string is searched for in the dy    163     The given string is searched for in the dynamic debug format
169     string.  Note that the string does not nee    164     string.  Note that the string does not need to match the
170     entire format, only some part.  Whitespace    165     entire format, only some part.  Whitespace and other
171     special characters can be escaped using C     166     special characters can be escaped using C octal character
172     escape ``\ooo`` notation, e.g. the space c    167     escape ``\ooo`` notation, e.g. the space character is ``\040``.
173     Alternatively, the string can be enclosed     168     Alternatively, the string can be enclosed in double quote
174     characters (``"``) or single quote charact    169     characters (``"``) or single quote characters (``'``).
175     Examples::                                    170     Examples::
176                                                   171 
177         format svcrdma:         // many of the    172         format svcrdma:         // many of the NFS/RDMA server pr_debugs
178         format readahead        // some pr_deb    173         format readahead        // some pr_debugs in the readahead cache
179         format nfsd:\040SETATTR // one way to     174         format nfsd:\040SETATTR // one way to match a format with whitespace
180         format "nfsd: SETATTR"  // a neater wa    175         format "nfsd: SETATTR"  // a neater way to match a format with whitespace
181         format 'nfsd: SETATTR'  // yet another    176         format 'nfsd: SETATTR'  // yet another way to match a format with whitespace
182                                                   177 
183 class                                             178 class
184     The given class_name is validated against     179     The given class_name is validated against each module, which may
185     have declared a list of known class_names.    180     have declared a list of known class_names.  If the class_name is
186     found for a module, callsite & class match    181     found for a module, callsite & class matching and adjustment
187     proceeds.  Examples::                         182     proceeds.  Examples::
188                                                   183 
189         class DRM_UT_KMS        # a DRM.debug     184         class DRM_UT_KMS        # a DRM.debug category
190         class JUNK              # silent non-m    185         class JUNK              # silent non-match
191         // class TLD_*          # NOTICE: no w    186         // class TLD_*          # NOTICE: no wildcard in class names
192                                                   187 
193 line                                              188 line
194     The given line number or range of line num    189     The given line number or range of line numbers is compared
195     against the line number of each ``pr_debug    190     against the line number of each ``pr_debug()`` callsite.  A single
196     line number matches the callsite line numb    191     line number matches the callsite line number exactly.  A
197     range of line numbers matches any callsite    192     range of line numbers matches any callsite between the first
198     and last line number inclusive.  An empty     193     and last line number inclusive.  An empty first number means
199     the first line in the file, an empty last     194     the first line in the file, an empty last line number means the
200     last line number in the file.  Examples::     195     last line number in the file.  Examples::
201                                                   196 
202         line 1603           // exactly line 16    197         line 1603           // exactly line 1603
203         line 1600-1605      // the six lines f    198         line 1600-1605      // the six lines from line 1600 to line 1605
204         line -1605          // the 1605 lines     199         line -1605          // the 1605 lines from line 1 to line 1605
205         line 1600-          // all lines from     200         line 1600-          // all lines from line 1600 to the end of the file
206                                                   201 
207 The flags specification comprises a change ope    202 The flags specification comprises a change operation followed
208 by one or more flag characters.  The change op    203 by one or more flag characters.  The change operation is one
209 of the characters::                               204 of the characters::
210                                                   205 
211   -    remove the given flags                     206   -    remove the given flags
212   +    add the given flags                        207   +    add the given flags
213   =    set the flags to the given flags           208   =    set the flags to the given flags
214                                                   209 
215 The flags are::                                   210 The flags are::
216                                                   211 
217   p    enables the pr_debug() callsite.           212   p    enables the pr_debug() callsite.
218   _    enables no flags.                          213   _    enables no flags.
219                                                   214 
220   Decorator flags add to the message-prefix, i    215   Decorator flags add to the message-prefix, in order:
221   t    Include thread ID, or <intr>               216   t    Include thread ID, or <intr>
222   m    Include module name                        217   m    Include module name
223   f    Include the function name                  218   f    Include the function name
224   s    Include the source file name               219   s    Include the source file name
225   l    Include line number                        220   l    Include line number
226                                                   221 
227 For ``print_hex_dump_debug()`` and ``print_hex    222 For ``print_hex_dump_debug()`` and ``print_hex_dump_bytes()``, only
228 the ``p`` flag has meaning, other flags are ig    223 the ``p`` flag has meaning, other flags are ignored.
229                                                   224 
230 Note the regexp ``^[-+=][fslmpt_]+$`` matches     225 Note the regexp ``^[-+=][fslmpt_]+$`` matches a flags specification.
231 To clear all flags at once, use ``=_`` or ``-f    226 To clear all flags at once, use ``=_`` or ``-fslmpt``.
232                                                   227 
233                                                   228 
234 Debug messages during Boot Process                229 Debug messages during Boot Process
235 ==================================                230 ==================================
236                                                   231 
237 To activate debug messages for core code and b    232 To activate debug messages for core code and built-in modules during
238 the boot process, even before userspace and de    233 the boot process, even before userspace and debugfs exists, use
239 ``dyndbg="QUERY"`` or ``module.dyndbg="QUERY"`    234 ``dyndbg="QUERY"`` or ``module.dyndbg="QUERY"``.  QUERY follows
240 the syntax described above, but must not excee    235 the syntax described above, but must not exceed 1023 characters.  Your
241 bootloader may impose lower limits.               236 bootloader may impose lower limits.
242                                                   237 
243 These ``dyndbg`` params are processed just aft    238 These ``dyndbg`` params are processed just after the ddebug tables are
244 processed, as part of the early_initcall.  Thu    239 processed, as part of the early_initcall.  Thus you can enable debug
245 messages in all code run after this early_init    240 messages in all code run after this early_initcall via this boot
246 parameter.                                        241 parameter.
247                                                   242 
248 On an x86 system for example ACPI enablement i    243 On an x86 system for example ACPI enablement is a subsys_initcall and::
249                                                   244 
250    dyndbg="file ec.c +p"                          245    dyndbg="file ec.c +p"
251                                                   246 
252 will show early Embedded Controller transactio    247 will show early Embedded Controller transactions during ACPI setup if
253 your machine (typically a laptop) has an Embed    248 your machine (typically a laptop) has an Embedded Controller.
254 PCI (or other devices) initialization also is     249 PCI (or other devices) initialization also is a hot candidate for using
255 this boot parameter for debugging purposes.       250 this boot parameter for debugging purposes.
256                                                   251 
257 If ``foo`` module is not built-in, ``foo.dyndb    252 If ``foo`` module is not built-in, ``foo.dyndbg`` will still be processed at
258 boot time, without effect, but will be reproce    253 boot time, without effect, but will be reprocessed when module is
259 loaded later. Bare ``dyndbg=`` is only process    254 loaded later. Bare ``dyndbg=`` is only processed at boot.
260                                                   255 
261                                                   256 
262 Debug Messages at Module Initialization Time      257 Debug Messages at Module Initialization Time
263 ============================================      258 ============================================
264                                                   259 
265 When ``modprobe foo`` is called, modprobe scan    260 When ``modprobe foo`` is called, modprobe scans ``/proc/cmdline`` for
266 ``foo.params``, strips ``foo.``, and passes th    261 ``foo.params``, strips ``foo.``, and passes them to the kernel along with
267 params given in modprobe args or ``/etc/modpro    262 params given in modprobe args or ``/etc/modprobe.d/*.conf`` files,
268 in the following order:                           263 in the following order:
269                                                   264 
270 1. parameters given via ``/etc/modprobe.d/*.co    265 1. parameters given via ``/etc/modprobe.d/*.conf``::
271                                                   266 
272         options foo dyndbg=+pt                    267         options foo dyndbg=+pt
273         options foo dyndbg # defaults to +p       268         options foo dyndbg # defaults to +p
274                                                   269 
275 2. ``foo.dyndbg`` as given in boot args, ``foo    270 2. ``foo.dyndbg`` as given in boot args, ``foo.`` is stripped and passed::
276                                                   271 
277         foo.dyndbg=" func bar +p; func buz +mp    272         foo.dyndbg=" func bar +p; func buz +mp"
278                                                   273 
279 3. args to modprobe::                             274 3. args to modprobe::
280                                                   275 
281         modprobe foo dyndbg==pmf # override pr    276         modprobe foo dyndbg==pmf # override previous settings
282                                                   277 
283 These ``dyndbg`` queries are applied in order,    278 These ``dyndbg`` queries are applied in order, with last having final say.
284 This allows boot args to override or modify th    279 This allows boot args to override or modify those from ``/etc/modprobe.d``
285 (sensible, since 1 is system wide, 2 is kernel    280 (sensible, since 1 is system wide, 2 is kernel or boot specific), and
286 modprobe args to override both.                   281 modprobe args to override both.
287                                                   282 
288 In the ``foo.dyndbg="QUERY"`` form, the query     283 In the ``foo.dyndbg="QUERY"`` form, the query must exclude ``module foo``.
289 ``foo`` is extracted from the param-name, and     284 ``foo`` is extracted from the param-name, and applied to each query in
290 ``QUERY``, and only 1 match-spec of each type     285 ``QUERY``, and only 1 match-spec of each type is allowed.
291                                                   286 
292 The ``dyndbg`` option is a "fake" module param    287 The ``dyndbg`` option is a "fake" module parameter, which means:
293                                                   288 
294 - modules do not need to define it explicitly     289 - modules do not need to define it explicitly
295 - every module gets it tacitly, whether they u    290 - every module gets it tacitly, whether they use pr_debug or not
296 - it doesn't appear in ``/sys/module/$module/p    291 - it doesn't appear in ``/sys/module/$module/parameters/``
297   To see it, grep the control file, or inspect    292   To see it, grep the control file, or inspect ``/proc/cmdline.``
298                                                   293 
299 For ``CONFIG_DYNAMIC_DEBUG`` kernels, any sett    294 For ``CONFIG_DYNAMIC_DEBUG`` kernels, any settings given at boot-time (or
300 enabled by ``-DDEBUG`` flag during compilation    295 enabled by ``-DDEBUG`` flag during compilation) can be disabled later via
301 the debugfs interface if the debug messages ar    296 the debugfs interface if the debug messages are no longer needed::
302                                                   297 
303    echo "module module_name -p" > /proc/dynami    298    echo "module module_name -p" > /proc/dynamic_debug/control
304                                                   299 
305 Examples                                          300 Examples
306 ========                                          301 ========
307                                                   302 
308 ::                                                303 ::
309                                                   304 
310   // enable the message at line 1603 of file s    305   // enable the message at line 1603 of file svcsock.c
311   :#> ddcmd 'file svcsock.c line 1603 +p'         306   :#> ddcmd 'file svcsock.c line 1603 +p'
312                                                   307 
313   // enable all the messages in file svcsock.c    308   // enable all the messages in file svcsock.c
314   :#> ddcmd 'file svcsock.c +p'                   309   :#> ddcmd 'file svcsock.c +p'
315                                                   310 
316   // enable all the messages in the NFS server    311   // enable all the messages in the NFS server module
317   :#> ddcmd 'module nfsd +p'                      312   :#> ddcmd 'module nfsd +p'
318                                                   313 
319   // enable all 12 messages in the function sv    314   // enable all 12 messages in the function svc_process()
320   :#> ddcmd 'func svc_process +p'                 315   :#> ddcmd 'func svc_process +p'
321                                                   316 
322   // disable all 12 messages in the function s    317   // disable all 12 messages in the function svc_process()
323   :#> ddcmd 'func svc_process -p'                 318   :#> ddcmd 'func svc_process -p'
324                                                   319 
325   // enable messages for NFS calls READ, READL    320   // enable messages for NFS calls READ, READLINK, READDIR and READDIR+.
326   :#> ddcmd 'format "nfsd: READ" +p'              321   :#> ddcmd 'format "nfsd: READ" +p'
327                                                   322 
328   // enable messages in files of which the pat    323   // enable messages in files of which the paths include string "usb"
329   :#> ddcmd 'file *usb* +p'                       324   :#> ddcmd 'file *usb* +p'
330                                                   325 
331   // enable all messages                          326   // enable all messages
332   :#> ddcmd '+p'                                  327   :#> ddcmd '+p'
333                                                   328 
334   // add module, function to all enabled messa    329   // add module, function to all enabled messages
335   :#> ddcmd '+mf'                                 330   :#> ddcmd '+mf'
336                                                   331 
337   // boot-args example, with newlines and comm    332   // boot-args example, with newlines and comments for readability
338   Kernel command line: ...                        333   Kernel command line: ...
339     // see what's going on in dyndbg=value pro    334     // see what's going on in dyndbg=value processing
340     dynamic_debug.verbose=3                       335     dynamic_debug.verbose=3
341     // enable pr_debugs in the btrfs module (c    336     // enable pr_debugs in the btrfs module (can be builtin or loadable)
342     btrfs.dyndbg="+p"                             337     btrfs.dyndbg="+p"
343     // enable pr_debugs in all files under ini    338     // enable pr_debugs in all files under init/
344     // and the function parse_one, #cmt is str    339     // and the function parse_one, #cmt is stripped
345     dyndbg="file init/* +p #cmt ; func parse_o    340     dyndbg="file init/* +p #cmt ; func parse_one +p"
346     // enable pr_debugs in 2 functions in a mo    341     // enable pr_debugs in 2 functions in a module loaded later
347     pc87360.dyndbg="func pc87360_init_device +    342     pc87360.dyndbg="func pc87360_init_device +p; func pc87360_find +p"
348                                                   343 
349 Kernel Configuration                              344 Kernel Configuration
350 ====================                              345 ====================
351                                                   346 
352 Dynamic Debug is enabled via kernel config ite    347 Dynamic Debug is enabled via kernel config items::
353                                                   348 
354   CONFIG_DYNAMIC_DEBUG=y        # build catalo    349   CONFIG_DYNAMIC_DEBUG=y        # build catalog, enables CORE
355   CONFIG_DYNAMIC_DEBUG_CORE=y   # enable mecha    350   CONFIG_DYNAMIC_DEBUG_CORE=y   # enable mechanics only, skip catalog
356                                                   351 
357 If you do not want to enable dynamic debug glo    352 If you do not want to enable dynamic debug globally (i.e. in some embedded
358 system), you may set ``CONFIG_DYNAMIC_DEBUG_CO    353 system), you may set ``CONFIG_DYNAMIC_DEBUG_CORE`` as basic support of dynamic
359 debug and add ``ccflags := -DDYNAMIC_DEBUG_MOD    354 debug and add ``ccflags := -DDYNAMIC_DEBUG_MODULE`` into the Makefile of any
360 modules which you'd like to dynamically debug     355 modules which you'd like to dynamically debug later.
361                                                   356 
362                                                   357 
363 Kernel *prdbg* API                                358 Kernel *prdbg* API
364 ==================                                359 ==================
365                                                   360 
366 The following functions are cataloged and cont    361 The following functions are cataloged and controllable when dynamic
367 debug is enabled::                                362 debug is enabled::
368                                                   363 
369   pr_debug()                                      364   pr_debug()
370   dev_dbg()                                       365   dev_dbg()
371   print_hex_dump_debug()                          366   print_hex_dump_debug()
372   print_hex_dump_bytes()                          367   print_hex_dump_bytes()
373                                                   368 
374 Otherwise, they are off by default; ``ccflags     369 Otherwise, they are off by default; ``ccflags += -DDEBUG`` or
375 ``#define DEBUG`` in a source file will enable    370 ``#define DEBUG`` in a source file will enable them appropriately.
376                                                   371 
377 If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``prin    372 If ``CONFIG_DYNAMIC_DEBUG`` is not set, ``print_hex_dump_debug()`` is
378 just a shortcut for ``print_hex_dump(KERN_DEBU    373 just a shortcut for ``print_hex_dump(KERN_DEBUG)``.
379                                                   374 
380 For ``print_hex_dump_debug()``/``print_hex_dum    375 For ``print_hex_dump_debug()``/``print_hex_dump_bytes()``, format string is
381 its ``prefix_str`` argument, if it is constant    376 its ``prefix_str`` argument, if it is constant string; or ``hexdump``
382 in case ``prefix_str`` is built dynamically.      377 in case ``prefix_str`` is built dynamically.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php