2013-05-14 17 views
0

我想生成一个堆栈跟踪报告,就像内核oops生成的报告一样。如何在自己的内核模块中生成堆栈跟踪

------------[ cut here ]------------

kernel BUG at /home/administrator/project/systech/bsp_tan/linux-.2.6/arch/arm/include/asm/dma-mapping.h:325!

Internal error: Oops - undefined instruction: 0 [#1] PREEMPT 
Modules linked in: 
CPU: 0 Not tainted (3.2.6 #67) 
PC is at my_func+0x118/0x230 
LR is at vprintk+0x3bc/0x440 

在那里的定义以及如何我可以与模块中触发它。

EDIT 1

如何寻找到PC(程序计数器)是当这种错误发生的行号。

PC is at my_func + 0x118/0x230

这是什么意思?

在此先感谢。

+1

尝试'dump_stack()'函数... – 2013-05-15 14:28:17

回答

0

这是在以下文件:

lib/bug.c 
kernel/panic.c 
+0

感谢,我们可以用户这些文件,这些功能我们的模块或驱动程序在跟踪寄存器和堆栈? ? – goodies 2013-05-14 07:01:14

+2

你可以调用模块内部的WARN_ON(1)来获得相同的报告。只需包含asm-generic/bug.h – kofemann 2013-05-14 07:15:30