Tricks about debug

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Tricks about debug相关的知识,希望对你有一定的参考价值。

  Add macros in header files:

 1 #undef PDEBUG /* undef it, just in case */
 2 #ifdef SCULL_DEBUG
 3 # ifdef __KERNEL__
 4 /* This one if debugging is on, and kernel space */
 5 # define PDEBUG(fmt, args...) printk( KERN_DEBUG "scull: " fmt, ## args)
 6 # else
 7 /* This one for user space */
 8 # define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args)
 9 # endif
10 #else
11 # define PDEBUG(fmt, args...) /* not debugging: nothing */
12 #endif
13 #undef PDEBUGG
14 #define PDEBUGG(fmt, args...) /* nothing: it‘s a placeholder */

  Add following lines to makefile:

1 # Comment/uncomment the following line to disable/enable debugging
2 DEBUG = y
3 # Add your debugging flag (or not) to CFLAGS
4 ifeq ($(DEBUG),y)
5   DEBFLAGS = -O -g -DSCULL_DEBUG # "-O" is needed to expand inlines
6 else
7   DEBFLAGS = -O2
8 endif
9 CFLAGS += $(DEBFLAGS)

 

以上是关于Tricks about debug的主要内容,如果未能解决你的问题,请参考以下文章

debugging Auto Layout:Debugging Tricks and Tips

Tips and Tricks for Debugging in chrome

Halo2学习笔记——用户手册之Tips and tricks

这些 C++ 代码片段有啥作用?

tricks深度神经网络模型训练中的 tricks(原理与代码汇总)

Unity HTFramework框架(四十)Debug的性能监控