R&D/OS

Kernel debugging

sunshout 2014. 1. 2. 20:31

Name

String

Meaning

alias function

KERN_EMERG

"<0>"

Emergency messages, system is about to crash or is unstable

pr_emerg

KERN_ALERT

"<1>"

Something bad happened and action must be taken immediately

pr_alert

KERN_CRIT

"<2>"

A critical condition occurred like a serious hardware/software failure

pr_crit

KERN_ERR

"<3>"

An error condition, often used by drivers to indicate difficulties with the hardware

pr_err

KERN_WARNING

"<4>"

A warning, meaning nothing serious by itself but might indicate problems

pr_warning

KERN_NOTICE

"<5>"

Nothing serious, but notably nevertheless. Often used to report security events.

pr_notice

KERN_INFO

"<6>"

Informational message e.g. startup information at driver initialization

pr_info

KERN_DEBUG

"<7>"

Debug messages

pr_debug, pr_devel if DEBUG is defined

KERN_CONT

"<c>"

"continued" line of log printout (only done after a line that had no enclosing \n) [1]

pr_cont


현재 log level

$ cat /proc/sys/kernel/printk
	7       4       1       7
	current	default	minimum	boot-time-default


Log Level 수정

# echo 8 > /proc/sys/kernel/printk




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.

    For example, to see all attempts to spawn a usermode helper (such as
    /sbin/hotplug), add to lib/Makefile the line:

        CFLAGS_kobject_uevent.o := -DDEBUG

    Then boot the new kernel, do something that spawns a usermode helper, and
    use the "dmesg" command to view the pr_debug() output.