How to enable dynamic debugging (pr_debug
) at boot for multiple files by supplying a command line argument to the linux kernel?
I tried to provide the following as an argument -
dyndbg='file drivers/<filename1> +p file drivers/<filename2> +p file drivers/<filename3> +p'
However the dynamic debugging was not enabled.
Is my syntax correct?
To activate debug messages for core code and built-in modules during the boot process, even before userspace and debugfs exists, use dyndbg="QUERY" , module. dyndbg="QUERY" , or ddebug_query="QUERY" ( ddebug_query is obsoleted by dyndbg , and deprecated).
pr_debug() Some files call pr_debug(), which is ordinarily an empty macro that discards its arguments at compile time. To enable debugging output, build the appropriate file with -DDEBUG by adding CFLAGS_[filename].o := -DDEBUG. to the makefile.
upon the kernel booted and the prompt appear to enable debug level messages by executing either dmesg -n 8 or echo 8 > /proc/sys/kernel/printk.
Debugfs exists as a simple way for kernel developers to make information available to user space. Unlike /proc, which is only meant for information about a process, or sysfs, which has strict one-value-per-file rules, debugfs has no rules at all. Developers can put any information they want there.
Separate control commands with semicolons.
dyndbg='file drivers/<filename1> +p; file drivers/<filename2> +p; file drivers/<filename3> +p'
First, check if you have enabled CONFIG_DYNAMIC_DEBUG=y
this in the .config
file
Test if this works properly when the kernel is booted.
echo -n 'module module_name +p' > /debugfs/dynamic_debug/control
Make sure the QUERY is in correct format (where the path to the module/folder is correct) when specified with dyndbg=QUERY
For built-in module use dyndbg='module module_name +p'
For loadable module use module_name.dyndbg=<query>
ex: xhci_hcd.dyndbg=+p
You can add it to your Linux default command line by writing the /etc/default/grub
file as follows:
GRUB_CMDLINE_LINUX_DEFAULT="xhci_hcd.dyndbg=+p"
Refer link:
Debug messages during Boot Process
To activate debug messages for core code and built-in modules during the boot process, even before userspace and debugfs exists, use dyndbg="QUERY", module.dyndbg="QUERY", or ddebug_query="QUERY" (ddebug_query is obsoleted by dyndbg, and deprecated). QUERY follows the syntax described above, but must not exceed 1023 characters. Your bootloader may impose lower limits.
These dyndbg params are processed just after the ddebug tables are processed, as part of the arch_initcall. Thus you can enable debug messages in all code run after this arch_initcall via this boot parameter.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With