有关BUG_ON()的实现
来源:互联网 发布:system数据库 编辑:程序博客网 时间:2024/05/23 17:59
看到一个crash dump
[17293.834304:1] kernel BUG at mm/slab.c:3072!
[17293.834311:1] Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
[17293.834319:1] Modules linked in: memalloc hx280enc hx170dec mali ump
[17293.834338:1] CPU: 1 Not tainted (3.4.0-g227f4c6-dirty #1)
[17293.834359:1] PC is at cache_free_debugcheck+0x234/0x388
[17293.834369:1] LR is at cache_free_debugcheck+0x90/0x388
[17293.834379:1] pc : [<c00adc74>] lr : [<c00adad0>] psr: 20000093
[17293.834384:1] sp : d799de58 ip : d799de58 fp : d799de9c
[17293.834392:1] r10: 00000000 r9 : 000ec83d r8 : ffc00000
[17293.834400:1] r7 : c0222f30 r6 : 001328b8 r5 : c883e000 r4 : ee0001c0
[17293.834408:1] r3 : 00100000 r2 : dc000004 r1 : 00000001 r0 : c883e000
当前出问题的位置很明确:
[17293.834304:1] kernel BUG at mm/slab.c:3072!
PC is at cache_free_debugcheck+0x234/0x388
3072: BUG_ON(objnr >= cachep->num);
但是,反汇编函数cache_free_debugcheck此时对应的指令是:
0xc00adc74 <cache_free_debugcheck+564>: ; <UNDEFINED> instruction: 0xe7f001f2
“<UNDEFINED> instruction: 0xe7f001f2”
难道是对应的指令有问题?RAM突然出现问题啦?
跟踪一下BUG_ON的实现,就是使用了undefined instruction 异常,上面的现象是正常的
3072: BUG_ON(objnr >= cachep->num);
include/asm-generic/bug.h
#ifndef HAVE_ARCH_BUG_ON
#define BUG_ON(condition) do { if (unlikely(condition)) BUG(); } while(0)
#endif
arch/arm/include/asm/bug.h
/*
* Use a suitable undefined instruction to use for ARM/Thumb2 bug handling.
* We need to be careful not to conflict with those used by other modules and
* the register_undef_hook() system.
*/
#ifdef CONFIG_THUMB2_KERNEL
#define BUG_INSTR_VALUE 0xde02
#define BUG_INSTR_TYPE ".hword "
#else
#define BUG_INSTR_VALUE 0xe7f001f2
#define BUG_INSTR_TYPE ".word "
#endif
#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
#define _BUG(file, line, value) __BUG(file, line, value)
#define __BUG(__file, __line, __value) \
do { \
asm volatile(BUG_INSTR_TYPE #__value); \
unreachable(); \
} while (0)
- 有关BUG_ON()的实现
- 有关BUG_ON()的实现
- BUG_ON实现分析
- BUG_ON内部实现分析
- BUG_ON()
- BUG_ON
- 关于BUG_ON()的一点笔记
- 关于BUG_ON()的一点笔记
- 关于BUG_ON()的一点笔记
- 关于BUG_ON() dump_stack 的一点笔记
- BUG_ON()和WARN_ON()的用法
- 有关sizeof()的实现
- BUG_ON && WARN_ON
- sql有关日期的实现
- sql有关日期的实现
- 双链表有关操作的实现
- vxworks有关ifaddr的实现
- 有关二叉排序树的代码实现
- FAQ about OPEN and CLOSE Plsql Cursor in V$OPEN_CURSOR View (文档 ID 235291.1)
- 设计模式介绍之一:开篇概述
- Oracle表空间相关命令
- Fibonacci数(二分递归版)、(迭代版)
- 一篇很好的vi教程
- 有关BUG_ON()的实现
- struts2开发环境搭建
- 【原创】Ubuntu安装JDK1.7.0_45和Eclipse4.3
- mysql修改表、字段、库的字符集
- gridview中获取主键的值方法
- hdu 2112 HDU Today
- 八年英语学习路及后序
- 为经典版eclipse增加web and JavaEE插件
- 一些畸形的定论