打开调试信息
如 在include/linux/device.h中.#ifdef DEBUG
#define dev_dbg(dev, format, arg...) \
dev_printk(KERN_DEBUG , dev , format , ## arg)
#else
static inline int __attribute__ ((format (printf, 2, 3)))
dev_dbg(struct device * dev, const char * fmt, ...)
{
return 0;
}
#endif
#ifdef VERBOSE_DEBUG
#define dev_vdbg dev_dbg
#else
static inline int __attribute__ ((format (printf, 2, 3)))
dev_vdbg(struct device * dev, const char * fmt, ...)
{
return 0;
}
#endif
如何打开DEBUG 和 VERBOSE_DEBUG 选项
又如 在include/linux/kernel.h 中
#ifdef DEBUG
/* If you are writing a driver, please use dev_dbg instead */
#define pr_debug(fmt, arg...) \
printk(KERN_DEBUG fmt, ##arg)
#else
static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
{
return 0;
}
#endif
这个DEBUG和device.h中的DEBUG是同一个吗? 即是打开一个 另外一个也相应打开。 那你就要看看是否包含了这个头文件了 看这两个头文件是不是都包含了定义DEBUG的头文件
如果是gcc -DDBUG传下来的 那么就是相同的
了解下作用域 举个例子说把。
在linux-2.6 上lux/kernel/power/main.c 有pr_debug(....)但是它没有打印出来, 在整个kernel中只有include/linux/kernel.h 中定义了pr_debug了。 但是在那个文件中又有
#ifdef DEBUG
/* If you are writing a driver, please use dev_dbg instead */
#define pr_debug(fmt, arg...) \
printk(KERN_DEBUG fmt, ##arg)
#else
static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char * fmt, ...)
{
return 0;
}
#endif
那么就是说要定义DEBUG后才可以打开, 那么最终问题是如何打开这个DEBUG宏呢?
Thanks. 你可以直接在gcc的参数中添加 -DDEBUG 回复 1# studyboy_3w
你好,你这个问题解决了吗?我也想知道改Makefile哪行,谢谢 回复 5# emmoblin
说的简单,内核makefile中有好多FLAGS,你能说的具体点吗?
页:
[1]