kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: martink@posteo.de (Martin Kepplinger)
To: kernelnewbies@lists.kernelnewbies.org
Subject: loglevel 7 (debug) and pr_debug()
Date: Wed, 16 Apr 2014 13:57:07 +0200	[thread overview]
Message-ID: <f3d3c24c42a29e9af96ddbfd8e478ea7@posteo.de> (raw)
In-Reply-To: <CAMTd__nKXAU_15pTWrhA7EUanBihyF5itNKkCOZpn6mVmd09vA@mail.gmail.com>

Am 16.04.2014 13:43 schrieb Denis Pithon:
> Martin,
> 
> I'm not sure did you enable DDEBUG when compiling your module ?
> pr_debug() macro is discarded if you omit DEBUG in compile time
> 
> A sample Makefile which enable pr_debug() :
> 
> obj-m += my_modue.o
> 
> KDIR ?= /lib/modules/`uname -r`/build
> CFLAGS_my_module.o := -DDEBUG
> 
> all:
>  make -C $(KDIR) M=$(PWD) modules
> 
> clean:
>  make -C $(KDIR) M=$(PWD) clean
> 
> Let me know ...
> regards

Thanks,

I did not, but now added -DDEBUG. The exact line is:
CFLAGS_my_module.o := -DDEBUG
when "my_module.o" is my object file. Did I get that right?

That doesn't change anything unfortunately. I can not read pr_debug() 
unless I
explicitely activate it in /sys/kernel/debug/dynamic_debug/control 
*after* insmod.

I'd like to just read all pr_debug() messages like pr_info().

thanks for your time!

> 
> On Wed, Apr 16, 2014 at 1:11 PM, Martin Kepplinger <martink@posteo.de> 
> wrote:
> 
>> Am 16.04.2014 11:58 schrieb Arun KS:
>> 
>>> Hi Martin,
>>> 
>>> On Wed, Apr 16, 2014 at 2:46 PM, Martin Kepplinger 
>>> <martink@posteo.de>
>>> wrote:
>>>> Am 2014-04-16 11:00, schrieb Arun KS:
>>>>> Hi Martin,
>>> ?>>
>>>>> On Wed, Apr 16, 2014 at 2:13 PM, Martin Kepplinger
>>>>> <martink@posteo.de> wrote:
>>>>>> I'm on Debian here and I don't really get pr_debug and
>>>>>> printk(KERN_DEBUG
>>> ?>>> ...). Let's stick to pr_debug.
>>>>>> 
>>>>>> I have DYNAMIC_DEBUG enabled and
>>>>>> root at laptop:/proc/sys/kernel# cat /proc/sys/kernel/printk
>>>>>> 7 ? ? ? 7 ? ? ? 1 ? ? ? 7
>>> ?>> This shows the console log level.
>>>>> This file controls the traffic to console. But all the log 
>>>>> messages
>>>>> will be present in logbuf.
>>>> 
>>>> How do I view debug messages from logbuf?
>>> ?>
>>>>> 
>>>>>> 
>>>>>> I write a module with pr_debug's. I load the module and I *don't*
>>>>>> see
>>>>>> anything in /var/log/messages (or anywhere in /var/log/* ). 
>>>>>> Adding
>>>>>> #define DEBUG doesn't help.
>>> ?>>>
>>>>>> /sys/kernel/debug/dynamic_debug/control has the pr_debug entries 
>>>>>> I
>>>>>> use
>>>>>> in my loaded module.
>>>>>> 
>>>>>> In short: How do I see debug log messages? Using pr_info() works 
>>>>>> as
>>> ?>>> expected. What am I missing? Do I need to edit my Makefile?
>>>>> Did you enable dynamic printing for your file?
>>>>> 
>>>>> Below command enables dynamic printing for file sdhci.c.
>>>>> echo 'file sdhci.c +p' > /sys/kernel/debug/dynamic_debug/control
>>> ?>
>>>> well. I tried that. The thing is, the pr_debug() symbols are in
>>>> "control" only after "insmod my_module". Then I can echo -n 'file
>>>> my_mobule.c +p' > control
>>>> But my pr_debug() messages get printed directly after insmod,
>>>> basically
>>> ?> in my module_init function. Enabling my file doesn't output
>>> anything in
>>>> /var/log/*
>>> So now you know why your pr_debug is absent in logbuf.
>>> 
>>> You can make your module as a built in and use bootargs.
>>> 
>>> eg:
>>> dyndbg="file your_filename.c +p"
>>> 
>>> Thanks,
>>> Arun
>>> 
>> 
>> So it's *not* possible at all to get pr_debug() messages just like
>> pr_info() messages?
>> Of what I've read, I assumed pr_debug() is just loglevel 7.
>> 
>> thanks for your help!
>> 
>>>> 
>>>>> 
>>>>> 
>>>>> Thanks,
>>>>> Arun
>>>>>> 
>>>>>> thanks!
>>>>>> ? ? ? ? ? ? ? ? ? ? ?martin
>>> ?>>>
>>>>>> --
>>>>>> Martin Kepplinger
>>>>>> e-mail ? ? ? ?martink AT posteo DOT at
>>>>>> chat (XMPP) ? martink AT jabber DOT at
>>>>>> 
>>>>>> _______________________________________________
>>> ?>>> Kernelnewbies mailing list
>>>>>> Kernelnewbies at kernelnewbies.org
>>>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies [1] 
>>>>>> [1]
>> 
>>> ?>>
>>>>> _______________________________________________
>>>>> Kernelnewbies mailing list
>>>>> Kernelnewbies at kernelnewbies.org
>>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies [1] 
>>>>> [1]
>> 
>>> ?>>
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Kernelnewbies mailing list
>>>> Kernelnewbies at kernelnewbies.org
>>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies [1] 
>>>> [1]
>>> 
>>> Links:
>>> ------
>>> [1] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies 
>>> [1]
>> 
>>> 
>>> _______________________________________________
>>> Kernelnewbies mailing list
>>> Kernelnewbies at kernelnewbies.org
>>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies [1]
>> 
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies [1]
> 
> 
> 
> Links:
> ------
> [1] http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
> 
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2014-04-16 11:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-16  8:43 loglevel 7 (debug) and pr_debug() Martin Kepplinger
2014-04-16  9:00 ` Arun KS
2014-04-16  9:16   ` Martin Kepplinger
2014-04-16  9:58     ` Arun KS
2014-04-16 11:11       ` Martin Kepplinger
2014-04-16 11:43         ` Denis Pithon
2014-04-16 11:57           ` Martin Kepplinger [this message]
2014-04-16 12:29             ` Arun KS
2014-04-16 12:30             ` Valdis.Kletnieks at vt.edu
2014-04-16 12:37             ` Denis Pithon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f3d3c24c42a29e9af96ddbfd8e478ea7@posteo.de \
    --to=martink@posteo.de \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).