2007-06-12 14:32:06 how to see kernel debug message
James Pruett (UNITED STATES)
Message: 36247 Hi,
I want to see detailed debug messages, eg pr_debug("hi");
Q: How do I turn that on?
Here are my settings
In u-boot:
bf537> printenv bootargs
bootargs=root=/dev/mtdblock0 rw console=ttyBF0,57600 debug loglevel=7
During boot I see:
Kernel command line: root=/dev/mtdblock0 rw console=ttyBF0,57600 debug loglevel=7
But I never see output from for example:
pr_debug("restoring spi ctl \n" )
thanks for any leads.
jp
QuoteReplyEditDelete
2007-06-12 14:46:25 Re: how to see kernel debug message
Mike Frysinger (UNITED STATES)
Message: 36248 pr_debug() isnt actually compiled into the kernel unless you have #define DEBUG at the top of your file
once you've booted, just run `dmesg` to see the full buffer
QuoteReplyEditDelete
2007-06-12 14:53:54 Re: how to see kernel debug message
James Pruett (UNITED STATES)
Message: 36249 thanks
QuoteReplyEditDelete
2008-03-13 10:06:34 Re: how to see kernel debug message
murti iki (GERMANY)
Message: 52457 Hello I am wondering if there is an overhead size difference between printk and pr_debug or are they actually the same thing.
One more question would be about displaying these messages. Below I wrote a short hello module but after compiling it and loading it, I can not see the "does it write" message in the output of dmesg command.
What am I doing wrong?
thanks alot
murti
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#define DEBUG
static int __init mymod_init(void) {
printk(KERN_INFO "Hello, my module\n");
pr_debug("does it write");
return 0;
}
static void __exit mymod_exit(void) {
printk(KERN_INFO "goodbye my module\n");
}
module_init(mymod_init);
module_exit(mymod_exit);
MODULE_LICENSE("GPL");
QuoteReplyEditDelete
2008-03-13 13:08:20 Re: how to see kernel debug message
Mike Frysinger (UNITED STATES)
Message: 52462 you didnt put DEBUG at the top of the file, so it wasnt used by any of the headers
QuoteReplyEditDelete
2008-03-14 03:37:34 Re: how to see kernel debug message
murti iki (GERMANY)
Message: 52504 Thanks a lot for your help, it seems that I need to review how the C preprocessor works before going further
About the other question, can you also tell me if pr_debug is actually a printk or
does it use another mechanism with less overhead?
cheers
murti
QuoteReplyEditDelete
2008-03-14 04:58:54 Re: how to see kernel debug message
Yi Li (CHINA)
Message: 52524 if looking at include/linux/kernel.h for pr_debug() definition, things would be clear.
QuoteReplyEditDelete
2008-03-14 06:17:02 Re: how to see kernel debug message
murti iki (GERMANY)
Message: 52530 thanks Yi,
It's clear now.