linux/kernel/backtracetest.c
<<
>>
Prefs
   1/*
   2 * Simple stack backtrace regression test module
   3 *
   4 * (C) Copyright 2008 Intel Corporation
   5 * Author: Arjan van de Ven <arjan@linux.intel.com>
   6 *
   7 * This program is free software; you can redistribute it and/or
   8 * modify it under the terms of the GNU General Public License
   9 * as published by the Free Software Foundation; version 2
  10 * of the License.
  11 */
  12
  13#include <linux/module.h>
  14#include <linux/sched.h>
  15#include <linux/delay.h>
  16
  17static struct timer_list backtrace_timer;
  18
  19static void backtrace_test_timer(unsigned long data)
  20{
  21        printk("Testing a backtrace from irq context.\n");
  22        printk("The following trace is a kernel self test and not a bug!\n");
  23        dump_stack();
  24}
  25static int backtrace_regression_test(void)
  26{
  27        printk("====[ backtrace testing ]===========\n");
  28        printk("Testing a backtrace from process context.\n");
  29        printk("The following trace is a kernel self test and not a bug!\n");
  30        dump_stack();
  31
  32        init_timer(&backtrace_timer);
  33        backtrace_timer.function = backtrace_test_timer;
  34        mod_timer(&backtrace_timer, jiffies + 10);
  35
  36        msleep(10);
  37        printk("====[ end of backtrace testing ]====\n");
  38        return 0;
  39}
  40
  41static void exitf(void)
  42{
  43}
  44
  45module_init(backtrace_regression_test);
  46module_exit(exitf);
  47MODULE_LICENSE("GPL");
  48MODULE_AUTHOR("Arjan van de Ven <arjan@linux.intel.com>");
  49
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.