<div dir="ltr">Hello Martin and Dennis,<div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 16, 2014 at 5:27 PM, Martin Kepplinger <span dir="ltr"><<a href="mailto:martink@posteo.de" target="_blank">martink@posteo.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Am 16.04.2014 13:43 schrieb Denis Pithon:<br>
<div class="">> Martin,<br>
><br>
> I'm not sure did you enable DDEBUG when compiling your module ?<br>
> pr_debug() macro is discarded if you omit DEBUG in compile time<br>
><br>
> A sample Makefile which enable pr_debug() :<br>
><br>
> obj-m += my_modue.o<br>
><br>
> KDIR ?= /lib/modules/`uname -r`/build<br>
> CFLAGS_my_module.o := -DDEBUG<br>
><br>
> all:<br>
> make -C $(KDIR) M=$(PWD) modules<br>
><br>
> clean:<br>
> make -C $(KDIR) M=$(PWD) clean<br>
><br>
> Let me know ...<br>
> regards<br>
<br>
</div>Thanks,<br>
<br>
I did not, but now added -DDEBUG. The exact line is:<br>
CFLAGS_my_module.o := -DDEBUG<br>
when "my_module.o" is my object file. Did I get that right?<br>
<br>
That doesn't change anything unfortunately. I can not read pr_debug()<br>
unless I<br>
explicitely activate it in /sys/kernel/debug/dynamic_debug/control<br>
*after* insmod.<br></blockquote><div><br></div><div>Adding -DDEBUG will not change anything if CONFIG_DYNAMIC_DEBUG is defined in your .config</div><div><br></div><div>The reason is because CONFIG_DYNAMIC_DEBUG has priority over DEBUG.</div>
<div><br></div><div>File:include/linux/printk.h</div><div>--------------------------stripped-------------------------------</div><div>#if defined(CONFIG_DYNAMIC_DEBUG)</div><div>/* dynamic_pr_debug() uses pr_fmt() internally so we don't need it here */</div>
<div>#define pr_debug(fmt, ...) \</div><div> dynamic_pr_debug(fmt, ##__VA_ARGS__)</div><div>#elif defined(DEBUG)</div><div>#define pr_debug(fmt, ...) \</div><div> printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)</div>
<div>#else</div><div>#define pr_debug(fmt, ...) \</div><div> no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)</div><div>#endif</div><div>--------------------------stripped-------------------------------<br></div><div>
<br></div><div>So the quick way is to disable CONFIG_DYNAMIC_DEBUG and add -DDEBUG in your makefile.</div><div><br></div><div>Thanks,</div><div>Arun</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I'd like to just read all pr_debug() messages like pr_info().<br>
<br>
thanks for your time!<br>
<div class=""><div class="h5"><br>
><br>
> On Wed, Apr 16, 2014 at 1:11 PM, Martin Kepplinger <<a href="mailto:martink@posteo.de">martink@posteo.de</a>><br>
> wrote:<br>
><br>
>> Am 16.04.2014 11:58 schrieb Arun KS:<br>
>><br>
>>> Hi Martin,<br>
>>><br>
>>> On Wed, Apr 16, 2014 at 2:46 PM, Martin Kepplinger<br>
>>> <<a href="mailto:martink@posteo.de">martink@posteo.de</a>><br>
>>> wrote:<br>
>>>> Am 2014-04-16 11:00, schrieb Arun KS:<br>
>>>>> Hi Martin,<br>
>>> >><br>
>>>>> On Wed, Apr 16, 2014 at 2:13 PM, Martin Kepplinger<br>
>>>>> <<a href="mailto:martink@posteo.de">martink@posteo.de</a>> wrote:<br>
>>>>>> I'm on Debian here and I don't really get pr_debug and<br>
>>>>>> printk(KERN_DEBUG<br>
>>> >>> ...). Let's stick to pr_debug.<br>
>>>>>><br>
>>>>>> I have DYNAMIC_DEBUG enabled and<br>
>>>>>> root@laptop:/proc/sys/kernel# cat /proc/sys/kernel/printk<br>
>>>>>> 7 7 1 7<br>
>>> >> This shows the console log level.<br>
>>>>> This file controls the traffic to console. But all the log<br>
>>>>> messages<br>
>>>>> will be present in logbuf.<br>
>>>><br>
>>>> How do I view debug messages from logbuf?<br>
>>> ><br>
>>>>><br>
>>>>>><br>
>>>>>> I write a module with pr_debug's. I load the module and I *don't*<br>
>>>>>> see<br>
>>>>>> anything in /var/log/messages (or anywhere in /var/log/* ).<br>
>>>>>> Adding<br>
>>>>>> #define DEBUG doesn't help.<br>
>>> >>><br>
>>>>>> /sys/kernel/debug/dynamic_debug/control has the pr_debug entries<br>
>>>>>> I<br>
>>>>>> use<br>
>>>>>> in my loaded module.<br>
>>>>>><br>
>>>>>> In short: How do I see debug log messages? Using pr_info() works<br>
>>>>>> as<br>
>>> >>> expected. What am I missing? Do I need to edit my Makefile?<br>
>>>>> Did you enable dynamic printing for your file?<br>
>>>>><br>
>>>>> Below command enables dynamic printing for file sdhci.c.<br>
>>>>> echo 'file sdhci.c +p' > /sys/kernel/debug/dynamic_debug/control<br>
>>> ><br>
>>>> well. I tried that. The thing is, the pr_debug() symbols are in<br>
>>>> "control" only after "insmod my_module". Then I can echo -n 'file<br>
>>>> my_mobule.c +p' > control<br>
>>>> But my pr_debug() messages get printed directly after insmod,<br>
>>>> basically<br>
>>> > in my module_init function. Enabling my file doesn't output<br>
>>> anything in<br>
>>>> /var/log/*<br>
>>> So now you know why your pr_debug is absent in logbuf.<br>
>>><br>
>>> You can make your module as a built in and use bootargs.<br>
>>><br>
>>> eg:<br>
>>> dyndbg="file your_filename.c +p"<br>
>>><br>
>>> Thanks,<br>
>>> Arun<br>
>>><br>
>><br>
>> So it's *not* possible at all to get pr_debug() messages just like<br>
>> pr_info() messages?<br>
>> Of what I've read, I assumed pr_debug() is just loglevel 7.<br>
>><br>
>> thanks for your help!<br>
>><br>
>>>><br>
>>>>><br>
>>>>><br>
>>>>> Thanks,<br>
>>>>> Arun<br>
>>>>>><br>
>>>>>> thanks!<br>
>>>>>> martin<br>
>>> >>><br>
>>>>>> --<br>
>>>>>> Martin Kepplinger<br>
>>>>>> e-mail martink AT posteo DOT at<br>
>>>>>> chat (XMPP) martink AT jabber DOT at<br>
>>>>>><br>
>>>>>> _______________________________________________<br>
>>> >>> Kernelnewbies mailing list<br>
>>>>>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>>>>>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a> [1]<br>
>>>>>> [1]<br>
>><br>
>>> >><br>
>>>>> _______________________________________________<br>
>>>>> Kernelnewbies mailing list<br>
>>>>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>>>>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a> [1]<br>
>>>>> [1]<br>
>><br>
>>> >><br>
>>>><br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Kernelnewbies mailing list<br>
>>>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>>>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a> [1]<br>
</div></div><div class=""><div class="h5">>>>> [1]<br>
>>><br>
>>> Links:<br>
>>> ------<br>
>>> [1] <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
>>> [1]<br>
>><br>
>>><br>
>>> _______________________________________________<br>
>>> Kernelnewbies mailing list<br>
>>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a> [1]<br>
>><br>
>> _______________________________________________<br>
>> Kernelnewbies mailing list<br>
>> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
>> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a> [1]<br>
><br>
><br>
><br>
> Links:<br>
> ------<br>
> [1] <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br></div></div>