From 837a3d84d04bc46261ea2cf22eb06fe48968ce42 Mon Sep 17 00:00:00 2001 From: Matt Fleming Date: Sat, 24 Oct 2009 18:56:57 +0000 Subject: [PATCH] --- yaml --- r: 167893 b: refs/heads/master c: 60339fad5c68c9c533cd14e67194ff8f727c41d9 h: refs/heads/master i: 167891: d0abd173130686f5989ef6810dc3dbe2ffb738c2 v: v3 --- [refs] | 2 +- trunk/arch/sh/kernel/dwarf.c | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index 66f75df11490..5d9574d8bac2 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 26fadd3672964596d33548490b9756014ae0f414 +refs/heads/master: 60339fad5c68c9c533cd14e67194ff8f727c41d9 diff --git a/trunk/arch/sh/kernel/dwarf.c b/trunk/arch/sh/kernel/dwarf.c index 03b3616c80a5..2d07084e4882 100644 --- a/trunk/arch/sh/kernel/dwarf.c +++ b/trunk/arch/sh/kernel/dwarf.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include @@ -557,6 +558,27 @@ struct dwarf_frame * dwarf_unwind_stack(unsigned long pc, if (!pc && !prev) pc = (unsigned long)current_text_addr(); +#ifdef CONFIG_FUNCTION_GRAPH_TRACER + /* + * If our stack has been patched by the function graph tracer + * then we might see the address of return_to_handler() where we + * expected to find the real return address. + */ + if (pc == (unsigned long)&return_to_handler) { + int index = current->curr_ret_stack; + + /* + * We currently have no way of tracking how many + * return_to_handler()'s we've seen. If there is more + * than one patched return address on our stack, + * complain loudly. + */ + WARN_ON(index > 0); + + pc = current->ret_stack[index].ret; + } +#endif + frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); if (!frame) { printk(KERN_ERR "Unable to allocate a dwarf frame\n");