Linux日志开启debug,linux内核调试日志开关-让pr_debug输出

1、让pr_debug能输出

--- a/kernel/printk/printk.c

+++ b/kernel/printk/printk.c

@@ -59,7 +59,7 @@

/* We show everything that is MOREimportant than this.. */

#define MINIMUM_CONSOLE_LOGLEVEL 1 /*Minimum loglevel we let people use */

-#define DEFAULT_CONSOLE_LOGLEVEL 7 /*anything MORE serious than KERN_DEBUG */

+#define DEFAULT_CONSOLE_LOGLEVEL 8 /*anything MORE serious than KERN_DEBUG */

int console_printk[4] = {

DEFAULT_CONSOLE_LOGLEVEL, /* console_loglevel */

2、让模块内代码都能输出

--- a/drivers/of/Makefile

+++ b/drivers/of/Makefile

EXTRA_CFLAGS += -DDEBUG

3、让每个文件输出

--- a/drivers/of/Makefile

+++ b/drivers/of/Makefile

文件include之前加define DEBUG

或者Makefile里面增加

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.

4、内核打印控制

d,lx,ld,,lu,这几个都是输出32位的

hd,hx,hu,这几个都是输出16位数据的,

hhd,hhx,hhu,这几个都是输出8位的,

lld,ll,llu,llx,这几个都是输出64位的,

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值