diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-01-28 19:48:24 +0100 |
---|---|---|
committer | Jiri Olsa <jolsa@redhat.com> | 2013-05-02 18:06:31 +0200 |
commit | 700da8eee36a5bdab1d4a0b1980601f21a1ef3f4 (patch) | |
tree | 7f86a93e28923a9a7890c650a5668db8c0d4628a | |
parent | 42feeadf3a07d12b1ea424cad4fcca3131e86d5a (diff) | |
download | linux-unwind-unwind2.tar.gz |
unwind: Add dump_stack testunwind2
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | kernel/dwarf_unwind/unwind.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/kernel/dwarf_unwind/unwind.c b/kernel/dwarf_unwind/unwind.c index b64e1a226f4194..af64b7bcc6729a 100644 --- a/kernel/dwarf_unwind/unwind.c +++ b/kernel/dwarf_unwind/unwind.c @@ -342,3 +342,45 @@ int dwarf_unwind(struct pt_regs *regs, dwarf_unwind_cb cb, void *data) return ret; } + +static ssize_t +test_write(struct file *filp, const char __user *ubuf, + size_t cnt, loff_t *ppos) +{ + printk("Testing dwarf unwind from process context.\n"); + + if (dwarf_unwind_debug) { + printk("Dwarf unwind debug enabled: "); + + if (dwarf_unwind_debug & DU_DEBUG_READ) + printk("read "); + if (dwarf_unwind_debug & DU_DEBUG_FRAMES) + printk("frames "); + if (dwarf_unwind_debug & DU_DEBUG_EH_FRAMES) + printk("eh-frames "); + if (dwarf_unwind_debug & DU_DEBUG_CFI) + printk("cfi "); + if (dwarf_unwind_debug & DU_DEBUG_EXPR) + printk("expr"); + + printk("\n"); + } + + dump_stack(); + return cnt; +} + +static const struct file_operations test_fops = { + .write = test_write, +}; + +static int __init unwind_init_test(void) +{ + if (!debugfs_create_file("unwind_test", 0644, NULL, NULL, + &test_fops)) + return -ENOMEM; + + return 0; +} + +late_initcall(unwind_init_test); |