diff options
Diffstat (limited to 'arch/sh/kernel/dwarf.c')
-rw-r--r-- | arch/sh/kernel/dwarf.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c index 4d8c7bd149df..6c9d0c10f2be 100644 --- a/arch/sh/kernel/dwarf.c +++ b/arch/sh/kernel/dwarf.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/mempool.h> | 21 | #include <linux/mempool.h> |
22 | #include <linux/mm.h> | 22 | #include <linux/mm.h> |
23 | #include <linux/elf.h> | 23 | #include <linux/elf.h> |
24 | #include <linux/ftrace.h> | ||
24 | #include <asm/dwarf.h> | 25 | #include <asm/dwarf.h> |
25 | #include <asm/unwinder.h> | 26 | #include <asm/unwinder.h> |
26 | #include <asm/sections.h> | 27 | #include <asm/sections.h> |
@@ -569,6 +570,27 @@ struct dwarf_frame * dwarf_unwind_stack(unsigned long pc, | |||
569 | if (!pc && !prev) | 570 | if (!pc && !prev) |
570 | pc = (unsigned long)current_text_addr(); | 571 | pc = (unsigned long)current_text_addr(); |
571 | 572 | ||
573 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER | ||
574 | /* | ||
575 | * If our stack has been patched by the function graph tracer | ||
576 | * then we might see the address of return_to_handler() where we | ||
577 | * expected to find the real return address. | ||
578 | */ | ||
579 | if (pc == (unsigned long)&return_to_handler) { | ||
580 | int index = current->curr_ret_stack; | ||
581 | |||
582 | /* | ||
583 | * We currently have no way of tracking how many | ||
584 | * return_to_handler()'s we've seen. If there is more | ||
585 | * than one patched return address on our stack, | ||
586 | * complain loudly. | ||
587 | */ | ||
588 | WARN_ON(index > 0); | ||
589 | |||
590 | pc = current->ret_stack[index].ret; | ||
591 | } | ||
592 | #endif | ||
593 | |||
572 | frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); | 594 | frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); |
573 | if (!frame) { | 595 | if (!frame) { |
574 | printk(KERN_ERR "Unable to allocate a dwarf frame\n"); | 596 | printk(KERN_ERR "Unable to allocate a dwarf frame\n"); |