文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Bug trap in Linux on ARM

Bug trap in Linux on ARM

时间:2009-04-25  来源:chriscross

During the developing of Linux, kernel hackers may sometimes have the feeling that there are be loopholes in their logic, and the loophole may possibly give rise to potential bugs in the code. Nevertheless, they are not able to totally figure out the mistake and weed out the bug profoundly at that point.
In this case, one can leave a bug trap in the code, so that in debugging the bug can be discovered at the first time.
The bug trap is written as below on ARM:

/* include/asm-arm/bug.h */

#ifdef CONFIG_BUG
#ifdef CONFIG_DEBUG_BUGVERBOSE
extern void __bug(const char *file, int line) __attribute__((noreturn));
/* give file/line information */
#define BUG()           __bug(__FILE__, __LINE__)

/* arch/arm/kernel/traps.c */

        printk(KERN_CRIT"kernel BUG at %s:%d!\n", file, line);
        *(int *)0 = 0;

        /* Avoid "noreturn function does return" */
        for (;;);
}
EXPORT_SYMBOL(__bug);
相关阅读 更多 +
排行榜 更多 +
利星行服务

利星行服务

购物比价 下载
最后一夜

最后一夜

角色扮演 下载
财会学堂

财会学堂

学习教育 下载