* [PATCH] ARM: stacktrace: Fix return_address() for CONFIG_FRAME_POINTER
@ 2012-11-01 14:01 Dave Martin
0 siblings, 0 replies; only message in thread
From: Dave Martin @ 2012-11-01 14:01 UTC (permalink / raw)
To: linux-arm-kernel
return_address() currently relies on walk_stackframe() setting
frame->lr, but walk_stackframe() never sets this field.
Setting frame->lr from walk_stackframe() would require
walk_stackframe() to unwind one frame beyond the frame being
returned, and to track extra state in struct stackframe.
The value of this is debatable, so this patch modifies
caller_address() to unwind one extra level explicitly and reference
frame->pc instead of frame->lr.
Signed-off-by: Dave Martin <dave.martin@linaro.org>
---
arch/arm/kernel/return_address.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/kernel/return_address.c b/arch/arm/kernel/return_address.c
index 8085417..0854b54 100644
--- a/arch/arm/kernel/return_address.c
+++ b/arch/arm/kernel/return_address.c
@@ -26,7 +26,7 @@ static int save_return_addr(struct stackframe *frame, void *d)
struct return_address_data *data = d;
if (!data->level) {
- data->addr = (void *)frame->lr;
+ data->addr = (void *)frame->pc;
return 1;
} else {
@@ -41,7 +41,7 @@ void *return_address(unsigned int level)
struct stackframe frame;
register unsigned long current_sp asm ("sp");
- data.level = level + 1;
+ data.level = level + 2;
frame.fp = (unsigned long)__builtin_frame_address(0);
frame.sp = current_sp;
--
1.7.5.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2012-11-01 14:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-01 14:01 [PATCH] ARM: stacktrace: Fix return_address() for CONFIG_FRAME_POINTER Dave Martin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).