x86: add save_stack_trace_bp() for tracing from a specific stack frame
Subsystems (2)
PATCH 2/13 x86: add save_stack_trace_bp() for tracing from a specific stack frame
Quoted 1 line
From
05b948089c63279690712028d2d75b89385048beMon Sep 17 00:00:00 2001
From: Vegard Nossum <[email protected]>
Date: Tue, 20 May 2008 11:15:43 +0200
Subject: [PATCH 02/13] x86: add save_stack_trace_bp() for tracing from a specific stack frame
This will help kmemcheck (and possibly other debugging tools) since we can now simply pass regs->bp to the stack tracer instead of specifying the number of stack frames to skip, which is unreliable if gcc decides to inline functions, etc.
Note that this makes the API incomplete for other architectures, but I expect that those can be updated lazily, e.g. when they need it.
Signed-off-by Vegard Nossum <[email protected]>
--- arch/x86/kernel/stacktrace.c | 7 +++++++ include/linux/stacktrace.h | 1 + 2 files changed, 8 insertions(+), 0 deletions(-)
arch/x86/kernel/stacktrace.c +7 -0
@@ -75,6 +75,13 @@ void save_stack_trace(struct stack_trace *trace) trace->entries[trace->nr_entries++] =ULONG_MAX ; } +void save_stack_trace_bp (struct stack_trace *trace,unsigned long bp) +{ +dump_trace (current,NULL ,NULL , bp, &save_stack_ops, trace); +if (trace->nr_entries < trace->max_entries) + trace->entries[trace->nr_entries++] =ULONG_MAX ; +} +void save_stack_trace_tsk (struct task_struct *tsk,struct stack_trace *trace) {dump_trace (tsk,NULL ,NULL ,0 , &save_stack_ops_nosched, trace);
include/linux/stacktrace.h +1 -0
@@ -9,6 +9,7 @@ struct stack_trace { };extern void save_stack_trace (struct stack_trace *trace); +extern void save_stack_trace_bp (struct stack_trace *trace,unsigned long bp);extern void save_stack_trace_tsk (struct task_struct *tsk,struct stack_trace *trace);
Signature · 1 line
1.5.5.1