Commit 569309b4 authored by Aaro Koskinen's avatar Aaro Koskinen Committed by Ralf Baechle

MIPS: oprofile: Backtrace: don't fail on leaf functions

Continue the backtrace if we cannot find SP adjustment and RA save. In
that case, just assume the current RA. This allows us to get samples of
frequent callers of e.g. GLIBC memset().
Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nsn.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8109/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent 1b48142a
...@@ -65,7 +65,7 @@ static inline int is_end_of_function_marker(union mips_instruction *ip) ...@@ -65,7 +65,7 @@ static inline int is_end_of_function_marker(union mips_instruction *ip)
* - handle cases where the stack is adjusted inside a function * - handle cases where the stack is adjusted inside a function
* (generally doesn't happen) * (generally doesn't happen)
* - find optimal value for max_instr_check * - find optimal value for max_instr_check
* - try to find a way to handle leaf functions * - try to find a better way to handle leaf functions
*/ */
static inline int unwind_user_frame(struct stackframe *old_frame, static inline int unwind_user_frame(struct stackframe *old_frame,
...@@ -104,7 +104,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame, ...@@ -104,7 +104,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame,
} }
if (!ra_offset || !stack_size) if (!ra_offset || !stack_size)
return -1; goto done;
if (ra_offset) { if (ra_offset) {
new_frame.ra = old_frame->sp + ra_offset; new_frame.ra = old_frame->sp + ra_offset;
...@@ -121,6 +121,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame, ...@@ -121,6 +121,7 @@ static inline int unwind_user_frame(struct stackframe *old_frame,
if (new_frame.sp > old_frame->sp) if (new_frame.sp > old_frame->sp)
return -2; return -2;
done:
new_frame.pc = old_frame->ra; new_frame.pc = old_frame->ra;
*old_frame = new_frame; *old_frame = new_frame;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment