Please note that User Registration has been temporarily disabled due to a recent increase in automated registrations. If anyone needs an account, please request one here: RequestAccount. Thanks for your patience!--Wmat (talk)
Please email User:Wmat if you experience any issues with the Request Account form.

Difference between revisions of "Debugging by printing"

From eLinux.org
Jump to: navigation, search
Line 19: Line 19:
 
* dynamic debug, pr_debug and dev_dbg
 
* dynamic debug, pr_debug and dev_dbg
 
* pr_warn and family - see printk.h for details
 
* pr_warn and family - see printk.h for details
* early_printk
+
* early_printk,
 +
** maybe  Early printk via EHCI debug port (if I have the hardware, which I doubt)
 
* printascii, printch and printhex (on ARM only?)
 
* printascii, printch and printhex (on ARM only?)
 
* /dev/kmsg , /proc/kmsg
 
* /dev/kmsg , /proc/kmsg
 +
* maybe netconsole
 +
* PRINTK_TIME
  
 
* Examples - maybe use example module.
 
* Examples - maybe use example module.

Revision as of 22:38, 15 June 2011


Note: This article is currently only a draft and is a part of a series of articles I'm going to publish the next few months - if you want to contribute to it, please feel free to. However it would be nice if you could coordinate your efforts with me


debugging by printing is probably the simplest way to get some information from the kernel, especially when using the kernels equivalent of printf, the printk function.

The main advantage of debugging with printk is that no sophisticated setup is needed and printk can be called from almost anywhere at any time. Printk can be called while holding a lock, from interrupt and process context and does not need any special preparation. It is just there and just works.

The only real exception is early in the boot process where no console is available yet, but there is special function named early_printk just for this special case, which is available if CONFIG_EARLY_PRINTK is set.


What this article will be about - ideas

  • printk format
  • Debug/log levels - dmesg -n /proc/sys/kernel/printk
  • printk_ratelimited
  • dynamic debug, pr_debug and dev_dbg
  • pr_warn and family - see printk.h for details
  • early_printk,
    • maybe Early printk via EHCI debug port (if I have the hardware, which I doubt)
  • printascii, printch and printhex (on ARM only?)
  • /dev/kmsg , /proc/kmsg
  • maybe netconsole
  • PRINTK_TIME
  • Examples - maybe use example module.


References


External links