2017-11-24 22:00:32 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2006-07-03 15:24:41 +08:00
|
|
|
/*
|
|
|
|
* Stack trace management functions
|
|
|
|
*
|
2012-07-20 17:15:04 +08:00
|
|
|
* Copyright IBM Corp. 2006
|
2006-07-03 15:24:41 +08:00
|
|
|
* Author(s): Heiko Carstens <heiko.carstens@de.ibm.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/stacktrace.h>
|
2019-01-28 15:33:08 +08:00
|
|
|
#include <asm/stacktrace.h>
|
|
|
|
#include <asm/unwind.h>
|
2016-02-01 21:14:04 +08:00
|
|
|
|
2019-08-14 20:27:44 +08:00
|
|
|
void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
|
|
|
|
struct task_struct *task, struct pt_regs *regs)
|
2016-02-01 21:14:04 +08:00
|
|
|
{
|
2019-01-28 15:33:08 +08:00
|
|
|
struct unwind_state state;
|
2019-08-14 20:27:44 +08:00
|
|
|
unsigned long addr;
|
2016-02-01 21:14:04 +08:00
|
|
|
|
2019-08-14 20:27:44 +08:00
|
|
|
unwind_for_each_frame(&state, task, regs, 0) {
|
|
|
|
addr = unwind_get_return_address(&state);
|
|
|
|
if (!addr || !consume_entry(cookie, addr, false))
|
2019-01-28 15:33:08 +08:00
|
|
|
break;
|
|
|
|
}
|
2008-02-05 23:50:45 +08:00
|
|
|
}
|