调用dump_stack()就会打印当前cpu的堆栈的调用函数了。参考内核源代码
arch/x86_64/kernel/traps.c
/*
* The architecture-independent dump_stack generator
*/
void dump_stack(void)
{
unsigned long dummy;
show_trace(&dummy);
}
/*
* When in-kernel, we also print out the stack and code at the
* time of the fault..
*/
if (in_kernel) {
printk("Stack: ");
show_stack(NULL, (unsigned long*)rsp);
linux kernel 里面打印堆栈的函数
本文深入探讨了Linux内核中用于打印当前CPU堆栈的dump_stack()函数,通过分析其源代码,解释了如何在内核环境下打印堆栈和代码,为深入理解Linux内核调试提供了实用指南。
2178

被折叠的 条评论
为什么被折叠?



