Linux-kernel debug printouts?

前端 未结 2 1320
陌清茗
陌清茗 2020-12-30 06:17

Is there a better way to debug printouts in the Linux kernel?

Right now littering the code with:

printk(KERN_DBG \"%s:%d - %s() \", __         


        
2条回答
  •  执念已碎
    2020-12-30 06:57

    If this is for quick debugging, just printk() works well.

    If this is for debugging in more production situation, maybe use pr_debug(), so messages can be enabled at runtime.

    Regardless, ("%s: xxx", func) is usually enough. These filenames and line numbers will become annoying very soon. This is also why you haven't found any "standard" solution -- because there is none.

提交回复
热议问题