diff options
author | Vegard Nossum <vegard.nossum@gmail.com> | 2008-05-20 05:15:43 -0400 |
---|---|---|
committer | Vegard Nossum <vegard.nossum@gmail.com> | 2009-06-12 17:01:05 -0400 |
commit | acc6be5405b90c9f0fb0eb8a74ec4d4b7b5bf48f (patch) | |
tree | 28b6a59cb0085b30d65e672813c35381b3e62490 | |
parent | 8ebf975608aaebd7feb33d77f07ba21a6380e086 (diff) |
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.
Cc: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
-rw-r--r-- | arch/x86/kernel/stacktrace.c | 7 | ||||
-rw-r--r-- | include/linux/stacktrace.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 4aaf7e48394f..c3eb207181fe 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c | |||
@@ -77,6 +77,13 @@ void save_stack_trace(struct stack_trace *trace) | |||
77 | } | 77 | } |
78 | EXPORT_SYMBOL_GPL(save_stack_trace); | 78 | EXPORT_SYMBOL_GPL(save_stack_trace); |
79 | 79 | ||
80 | void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp) | ||
81 | { | ||
82 | dump_trace(current, NULL, NULL, bp, &save_stack_ops, trace); | ||
83 | if (trace->nr_entries < trace->max_entries) | ||
84 | trace->entries[trace->nr_entries++] = ULONG_MAX; | ||
85 | } | ||
86 | |||
80 | void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) | 87 | void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) |
81 | { | 88 | { |
82 | dump_trace(tsk, NULL, NULL, 0, &save_stack_ops_nosched, trace); | 89 | dump_trace(tsk, NULL, NULL, 0, &save_stack_ops_nosched, trace); |
diff --git a/include/linux/stacktrace.h b/include/linux/stacktrace.h index 1a8cecc4f38c..551f6c7d5044 100644 --- a/include/linux/stacktrace.h +++ b/include/linux/stacktrace.h | |||
@@ -11,6 +11,7 @@ struct stack_trace { | |||
11 | }; | 11 | }; |
12 | 12 | ||
13 | extern void save_stack_trace(struct stack_trace *trace); | 13 | extern void save_stack_trace(struct stack_trace *trace); |
14 | extern void save_stack_trace_bp(struct stack_trace *trace, unsigned long bp); | ||
14 | extern void save_stack_trace_tsk(struct task_struct *tsk, | 15 | extern void save_stack_trace_tsk(struct task_struct *tsk, |
15 | struct stack_trace *trace); | 16 | struct stack_trace *trace); |
16 | 17 | ||