stacktrace.c

来自「omap3 linux 2.6 用nocc去除了冗余代码」· C语言 代码 · 共 36 行

C
36
字号
#include <linux/module.h>#include <linux/sched.h>#include <linux/stacktrace.h>#include "stacktrace.h"int walk_stackframe(unsigned long fp, unsigned long low, unsigned long high,		    int (*fn)(struct stackframe *, void *), void *data){	struct stackframe *frame;	do {		/*		 * Check current frame pointer is within bounds		 */		if (fp < (low + 12) || fp + 4 >= high)			break;		frame = (struct stackframe *)(fp - 12);		if (fn(frame, data))			break;		/*		 * Update the low bound - the next frame must always		 * be at a higher address than the current frame.		 */		low = fp + 4;		fp = frame->fp;	} while (fp);	return 0;}EXPORT_SYMBOL(walk_stackframe);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?