C 调试信息

1540阅读 0评论2016-01-10 644924073
分类:嵌入式

#include

#define debug_message (printf("%s %s()  [%d]:\n",__FILE__,__func__,__LINE__),printf)

int main(int argc, const char *argv[])
{
   debug_message;
   //printf("\n");
   printf("hello world\n");
   return 0;
}


内核调试信息
printk(KERN_DEBUG "Here I am: %s:%i\n", _ _FILE_ _, _ _LINE_ _);  //类似C
内核打印级别:

linux内核日志分为8个级别,其宏定义如下:

#define KERN_EMERG    "<0>"    /* system is unusable            */
#define KERN_ALERT    "<1>"    /* action must be taken immediately    */
#define KERN_CRIT    "<2>"    /* critical conditions            */
#define KERN_ERR    "<3>"    /* error conditions            */
#define KERN_WARNING    "<4>"    /* warning conditions            */
#define KERN_NOTICE    "<5>"    /* normal but significant condition    */
#define KERN_INFO    "<6>"    /* informational            */
#define KERN_DEBUG    "<7>"    /* debug-level messages            */




上一篇:交叉编译器介绍
下一篇:GCC编程四个过程:预处理-编译-汇编-链接