打印stack信息

1. Kernel态

执行dump_stack就可打印stack信息.

asmlinkage void __div0(void)
{
	printk("Division by zero in kernel.\n");
	dump_stack(); // dump current task stack
}

2. Java

Exeption e = new Exception("this is a log");
e.printStackTrace();

try {
    int i = 0;
    throw new Exception("2222");
} catch(Exception e) {
    e.printStackTrace();
}


你可能感兴趣的:(打印stack信息)